opentelemetry-js
opentelemetry-js copied to clipboard
Feature add applyCustomAttributesOnMetric on HTTP Instrumentation
trafficstars
Which problem is this PR solving?
Fixes #4317
add applyCustomAttributesOnMetric to hook metrics attributes.
Short description of the changes
interface HttpCustomMetricAttributeFunction {
(span: Span, spanKind: SpanKind, metricAttributes: MetricAttributes): void;
}
Not same as origin issue:
export interface HttpCustomAttributeFunction {
(
span: Span,
metricAttributes: Attributes,
request: ClientRequest | IncomingMessage,
response: IncomingMessage | ServerResponse
): void;
}
This is because _closeHttpSpan has only these arguments (Span and SpanKind).
If we really needed the request, more codebase need to change and verify.
Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [x] Verify error callback won'y break the code
Checklist:
- [x] Followed the style guidelines of this project
- [x] Unit tests have been added
- [x] Documentation has been updated