feat: add end-to-end observability (metrics, health, mobile RUM, dashboards, alerts) #32

Manually merged
Ichitux merged 8 commits from feat/observability-metrics-monitoring into main 2026-07-14 11:44:36 +00:00
Showing only changes of commit 1318243841 - Show all commits
+6 -5
View File
@@ -14,20 +14,21 @@ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentation
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc';
import * as resources from '@opentelemetry/resources';
import { ATTR_SERVICE_NAME, ATTR_SERVICE_NAMESPACE } from '@opentelemetry/semantic-conventions';
import { PinoInstrumentation } from '@opentelemetry/instrumentation-pino';
const serviceName = process.env.OTEL_SERVICE_NAME || 'farmaclic-backend';
const otlpEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317';
// Use plain string attribute keys (not the semantic-conventions named exports)
// so we don't depend on a specific @opentelemetry/semantic-conventions version.
const resource = typeof resources.resourceFromAttributes === 'function'
? resources.resourceFromAttributes({
[ATTR_SERVICE_NAME]: serviceName,
[ATTR_SERVICE_NAMESPACE]: 'farmaclic',
'service.name': serviceName,
'service.namespace': 'farmaclic',
})
: new resources.Resource({
[ATTR_SERVICE_NAME]: serviceName,
[ATTR_SERVICE_NAMESPACE]: 'farmaclic',
'service.name': serviceName,
'service.namespace': 'farmaclic',
});
// Metrics → OTLP → Alloy → Prometheus remote_write. The PeriodicExportingMetricReader