-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gunicorn with multiple workers breaks metrics #3885
Comments
I see that this issue was referenced previously in this closed issue: #93 |
@abstractOwl appending the |
@ocelotl I'd prefer a solution where we didn't have to add an extra filter to all of our queries - it breaks many of the default metrics views/generated dashboards that are offered by observability vendors and is overall an inconvenience. |
Any thoughts on adding aggregation capabilities in the Prometheus exportor in the OTEL Collector? I observed that as long as each forked process has its own resource specified, the "debug" exporter actually prints out the correct metrics generated per resource (I.e. per process). It seems to be theoretically possible to aggregate among all the resources in the Prometheus exporter. I think the issue is that the Prometheus exporter is ignoring the resource and is not doing any aggregation. |
Had a discussion internally about this and given this excerpt from note [1] from https://opentelemetry.io/docs/specs/semconv/attributes-registry/service/:
Shouldn't we add a way to set a sensible Other sdks:
|
Describe your environment
Python 3.8.5
opentelemetry-distro[otlp]==0.44b.0
Gunicorn 22.0.0
Steps to reproduce
What is the expected behavior?
Counter will increase monotonically for each visit to the route
What is the actual behavior?
Counter metric jumps between values from each worker because meter state is not synced between workers.
Example from console exporter (the
worker.id
resource attribute is set differently for each worker):Additional context
This issue is caused by the way each Gunicorn worker needs to be instrumented separately due to the fork process model. I think most developers would expect that multiple workers on the same host be treated as the same instance when it comes to metrics.
A hacky workaround for this would be to use
[hostname]:[pid]
asservice.instance.id
and then aggregate on a separate service hostname resource attribute in your metrics portal, but that doesn't seem like a great solution.The text was updated successfully, but these errors were encountered: