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

feat: export unit block when unit is set in metric descriptor #3041

Merged
merged 9 commits into from
Jul 29, 2022

Conversation

weyert
Copy link
Contributor

@weyert weyert commented Jun 16, 2022

Which problem is this PR solving?

Updated the PrometheusSerializer so that it exports the # UNIT block of the Prometheus format when the unit field of a metric descriptor is set

Fixes #3015 (issue)

Short description of the changes

Added support for exporting the # UNIT metadata of a metric

Type of change

  • New feature (non-breaking change which adds functionality)

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

  • Ensured the # UNIT-line is exported for a metric that has unit set

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@weyert weyert requested a review from a team June 16, 2022 00:03
@codecov
Copy link

codecov bot commented Jun 16, 2022

Codecov Report

Merging #3041 (355fc6a) into main (df58fac) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3041      +/-   ##
==========================================
- Coverage   93.07%   93.06%   -0.01%     
==========================================
  Files         195      162      -33     
  Lines        6384     4428    -1956     
  Branches     1347      886     -461     
==========================================
- Hits         5942     4121    -1821     
+ Misses        442      307     -135     
Impacted Files Coverage Δ
...ry-exporter-prometheus/src/PrometheusSerializer.ts
...ental/packages/otlp-grpc-exporter-base/src/util.ts
...ges/opentelemetry-instrumentation-http/src/http.ts
...orter-metrics-otlp-proto/src/OTLPMetricExporter.ts
...imental/packages/opentelemetry-sdk-node/src/sdk.ts
.../packages/otlp-transformer/src/metrics/internal.ts
...ry-instrumentation-grpc/src/grpc-js/serverUtils.ts
...es/opentelemetry-instrumentation-grpc/src/utils.ts
...y-instrumentation-http/src/enums/AttributeNames.ts
...tal/packages/otlp-transformer/src/metrics/index.ts
... and 23 more

@dyladan dyladan added this to the Metrics GA milestone Jun 16, 2022
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work on this! Overall LGTM % a suggestion on tests.

@dyladan
Copy link
Member

dyladan commented Jun 28, 2022

@weyert any update on the comments and conflict?

@dyladan dyladan added the spec-feature This is a request to implement a new feature which is already specified by the OTel specification label Jun 30, 2022
@weyert
Copy link
Contributor Author

weyert commented Jul 12, 2022

Picking this up, been busy switching to latest otel-js at work. Going to have a look at this again. Should have it stashed away somewhere

@dyladan dyladan removed this from the Metrics GA milestone Jul 13, 2022
@dyladan
Copy link
Member

dyladan commented Jul 18, 2022

Friendly ping :)

@weyert
Copy link
Contributor Author

weyert commented Jul 28, 2022

@open-telemetry/javascript-maintainers I have updated the PR based on the feedback :)

@dyladan dyladan merged commit 492a3e8 into open-telemetry:main Jul 29, 2022
@weyert weyert deleted the prometheus-serialiser branch July 29, 2022 20:44
@weyert weyert restored the prometheus-serialiser branch July 29, 2022 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec-feature This is a request to implement a new feature which is already specified by the OTel specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export units in Prometheus exporter
4 participants