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

Ability to add custom metric attributes to http_client_duration and http_server_duration #4317

Open
jurabek opened this issue Nov 22, 2023 Discussed in #4313 · 7 comments · May be fixed by #4884
Open

Ability to add custom metric attributes to http_client_duration and http_server_duration #4317

jurabek opened this issue Nov 22, 2023 Discussed in #4313 · 7 comments · May be fixed by #4884

Comments

@jurabek
Copy link

jurabek commented Nov 22, 2023

Discussed in #4313

Originally posted by jurabek November 21, 2023
The current version of opentelemetry-instrumentation-http has a limitation where it removes attributes from outgoing-request and incoming-request metrics due to high cardinality issues. However, it would be useful to have the capability of adding other attributes to the HTTP metrics according to the user's requirements. For instance, if I want to filter and monitor specific downstream requests, adding http_target to the outgoing-request metric does not create high cardinality issues for me or other attributes e.g http_status_family: 2xx

Options would be by passing metricAttributes into applyCustomAttributesOnSpan

export interface HttpCustomAttributeFunction {
  (
    span: Span,
    metricAttributes: Attributes,
    request: ClientRequest | IncomingMessage,
    response: IncomingMessage | ServerResponse
  ): void;
}

cc: @hectorhdzg @legendecas for opinions and feedback 😊
Thank you 🙏

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 22, 2024
@jurabek
Copy link
Author

jurabek commented Feb 29, 2024

remove stale label

@jurabek
Copy link
Author

jurabek commented Feb 29, 2024

keep it live please 🙏

@github-actions github-actions bot removed the stale label Mar 4, 2024
Copy link

github-actions bot commented May 6, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label May 6, 2024
@mbrevda
Copy link

mbrevda commented Jun 18, 2024

no

@github-actions github-actions bot removed the stale label Jul 1, 2024
@hwo411
Copy link

hwo411 commented Jul 10, 2024

Up, we also want to have this.

Our primary case is that we want to set http.route to be able to differentiate by different endpoints. Currently the only way of doing so for us is to patch the library using patch-package. Would be great to have a proper way of doing such changes.

@evan361425
Copy link

evan361425 commented Jul 29, 2024

Added the PR #4884 for it.

Notice that interface didn't have request nor response.

This is because _closeHttpSpan has only these arguments (Span and SpanKind).

If we really needed the request, more codebase need to change and verify.

However, response is undefined when request failed, which means it is not always present.

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

Successfully merging a pull request may close this issue.

4 participants