Support push-based metrics export (OTLP) for serverless/Cloud Run deployments #3366
akshat-kumar-singhal
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
GoFr currently exposes metrics via a
/metricsendpoint for Prometheus scraping. This works well on Kubernetes where the Prometheus operator handles service discovery, but falls short on serverless platforms like Cloud Run, Lambda, or Knative where:Proposal
Since GoFr already uses OpenTelemetry for metrics internally (and supports OTLP for traces via
TRACE_EXPORTER=otlp), extend the same pattern to metrics:The commented-out
otlpmetrichttpexporter inpkg/gofr/metrics/exporters/exporter.gosuggests this was already considered.Why OTLP push (not Prometheus PushGateway)
PeriodicReaderhandles batching and graceful shutdown flush out of the boxgo.opentelemetry.io/otel— no new dependencies needed beyondotlpmetrichttporotlpmetricgrpcAlternatives considered
Design decisions
METRICS_EXPORTERpicks one mode (prometheusorotlp), not both simultaneously. Keeps the exporter pipeline simple and avoids double-counting concerns.TRACER_URL, even when they point to the same collector. This avoids coupling and makes it clear which config controls what.Open questions
otlpmetrichttp) or gRPC (otlpmetricgrpc)? HTTP is simpler to deploy behind load balancers and Cloud Run; gRPC is more efficient for high-volume push.METRICS_OTLP_ENDPOINTandMETRICS_OTLP_INTERVALvs reusing the standardOTEL_EXPORTER_OTLP_METRICS_ENDPOINT?All reactions