Skip to content
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

Hook support for adding custom dynamic metric attributes/ dimensions #2387

Closed
alexa-gt opened this issue Aug 19, 2024 · 1 comment
Closed

Comments

@alexa-gt
Copy link

alexa-gt commented Aug 19, 2024

Is your feature request related to a problem? Please describe

I am currently looking at implementing the following but running into an issue of not being able to add custom attributes/dimension, namely peer.service to the http.server.duration/ http.server.request.duration metric.

Describe the solution you'd like to see

The ability to add custom attributes and dimensions as a hook to the http.server.duration/ http.server.request.duration metric emitted by @opentelemetry/instrumentation-http, with something of the following signature:

export interface HttpRequestCustomMetricAttributeFunction {
    (request: ClientRequest, response: ServerResponse, incomingMessage: IncomingMessage): Attributes;
}

Describe alternatives you've considered

  • Stick strictly to the semconv metric
    • allows no deviation or possibility of deviation without completely ditching the autoinstrumentation library, or writing a custom middleware.
  • spanmetrics connector in the OTEL connector with the selected dimension
    • this is not possible for my use case as I am unable to deploy otel-col in my architecture in the near term. It has to be an app-solution.
  • this hack that embeds additional info in http.route.
    • seems very strange to build an app's routing system around a workaround

Additional context

None.

@alexa-gt alexa-gt changed the title Hook support for adding dynamic metric attributes/ dimensions Hook support for adding custom dynamic metric attributes/ dimensions Aug 20, 2024
@alexa-gt
Copy link
Author

Closed in favour of open-telemetry/opentelemetry-js#4943 as that's where @opentelemetry/instrumentation-http currently is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant