Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/server/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if (process.env.NODE_ENV === 'production') {
}

// Prometheus metrics (OpenTelemetry handled by observability factory)
if (env.public.otelEnabled) {
if (env.public.otelMetricsEnabled) {
// Prometheus metrics — pass prom-client's global default registry so that
// RBAC and any other module-level metrics (auto-registered to `register`)
// are serialized alongside Hono's own HTTP metrics on /metrics.
Expand Down
3 changes: 2 additions & 1 deletion app/utils/env/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ export const env: Env = {
logCurl: data.LOG_CURL !== 'false' && data.NODE_ENV === 'development',
logRedactTokens: data.LOG_REDACT_TOKENS !== 'false' || data.NODE_ENV === 'production',
logPayloads: data.LOG_PAYLOADS === 'true' || data.NODE_ENV === 'development',
otelEnabled: data.OTEL_ENABLED === true && !!data.OTEL_EXPORTER_OTLP_ENDPOINT,
otelMetricsEnabled: data.OTEL_ENABLED === true,
otelTracingEnabled: data.OTEL_ENABLED === true && !!data.OTEL_EXPORTER_OTLP_ENDPOINT,
otelLogLevel: data.OTEL_LOG_LEVEL,
googleMapsApiKey: data.GOOGLE_MAPS_API_KEY || undefined,
paymentTermsEnabled: data.PAYMENT_TERMS_ENABLED === 'true',
Expand Down
6 changes: 4 additions & 2 deletions app/utils/env/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const clientDefaults: PublicEnv = {
logCurl: false,
logRedactTokens: true,
logPayloads: false,
otelEnabled: false,
otelMetricsEnabled: false,
otelTracingEnabled: false,
otelLogLevel: undefined,
googleMapsApiKey: undefined,
paymentTermsEnabled: false,
Expand Down Expand Up @@ -74,7 +75,8 @@ function getPublicEnv(): PublicEnv {
logCurl: source.LOG_CURL !== 'false' && nodeEnv === 'development',
logRedactTokens: source.LOG_REDACT_TOKENS !== 'false' || nodeEnv === 'production',
logPayloads: source.LOG_PAYLOADS === 'true' || nodeEnv === 'development',
otelEnabled: source.OTEL_ENABLED === 'true' && !!source.OTEL_EXPORTER_OTLP_ENDPOINT,
otelMetricsEnabled: source.OTEL_ENABLED === 'true',
otelTracingEnabled: source.OTEL_ENABLED === 'true' && !!source.OTEL_EXPORTER_OTLP_ENDPOINT,
otelLogLevel: source.OTEL_LOG_LEVEL as PublicEnv['otelLogLevel'],
googleMapsApiKey: source.GOOGLE_MAPS_API_KEY || undefined,
paymentTermsEnabled: source.PAYMENT_TERMS_ENABLED === 'true',
Expand Down
5 changes: 4 additions & 1 deletion app/utils/env/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export interface PublicEnv {
// Optional: Observability
sentryDsn?: string;
sentryEnv?: string;
otelEnabled: boolean;
// OTEL_ENABLED alone: serve Prometheus /metrics (pull-based, no OTLP endpoint needed).
otelMetricsEnabled: boolean;
// OTEL_ENABLED and OTEL_EXPORTER_OTLP_ENDPOINT: push traces over OTLP.
otelTracingEnabled: boolean;
otelLogLevel?: 'debug' | 'info' | 'warn' | 'error';

// Optional: Analytics & Support
Expand Down
4 changes: 2 additions & 2 deletions observability/providers/otel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class OtelProvider extends BaseProvider {
// PRIVATE PROPERTIES
// ============================================================================

private isEnabled = env.public.otelEnabled;
private isEnabled = env.public.otelTracingEnabled;
private circuitBreakerOpen = false;
private exportErrorCount = 0;
private readonly MAX_ERRORS = 5;
Expand Down Expand Up @@ -140,7 +140,7 @@ export class OtelProvider extends BaseProvider {

private logDisabledStatus(): void {
console.log('📊 OpenTelemetry is disabled or endpoint not configured');
console.log('📊 OTEL_ENABLED:', env.public.otelEnabled);
console.log('📊 OTEL_ENABLED:', env.public.otelMetricsEnabled);
console.log('📊 OTEL_EXPORTER_OTLP_ENDPOINT:', env.server.otelExporterEndpoint);
}

Expand Down
Loading