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: add ConsoleMetricExporter #3120

Merged
merged 17 commits into from
Aug 8, 2022

Conversation

weyert
Copy link
Contributor

@weyert weyert commented Jul 28, 2022

Which problem is this PR solving?

Adds a new metric exporter ConsoleMetricExporter to export or log the metrics to the console

Fixes #3036

Short description of the changes

Adds ConsoleMetricExporter

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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

  • Add unit test has been added to verify the metrics are getting exporter to the console

Checklist:

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

Allow to export metrics to the console

refs open-telemetry#3036
@weyert weyert requested a review from a team July 28, 2022 15:14
@codecov
Copy link

codecov bot commented Jul 28, 2022

Codecov Report

Merging #3120 (76d933f) into main (0c13343) will increase coverage by 0.08%.
The diff coverage is 80.95%.

@@            Coverage Diff             @@
##             main    #3120      +/-   ##
==========================================
+ Coverage   93.13%   93.21%   +0.08%     
==========================================
  Files         196      196              
  Lines        6406     6414       +8     
  Branches     1350     1350              
==========================================
+ Hits         5966     5979      +13     
+ Misses        440      435       -5     
Impacted Files Coverage Δ
...k-metrics-base/src/export/ConsoleMetricExporter.ts 80.95% <80.95%> (ø)
...-trace-base/src/platform/node/RandomIdGenerator.ts 87.50% <0.00%> (-6.25%) ⬇️
...etry-sdk-metrics-base/src/export/MetricExporter.ts

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.

You may need to remove the incomplete one defined in experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricExporter.ts and export the new one in experimental/packages/opentelemetry-sdk-metrics-base/src/index.ts.

@weyert
Copy link
Contributor Author

weyert commented Jul 29, 2022

You may need to remove the incomplete one defined in experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricExporter.ts and export the new one in experimental/packages/opentelemetry-sdk-metrics-base/src/index.ts.

Thank you! I have made your requested changes

@vmarchaud vmarchaud requested a review from dyladan August 2, 2022 20:00
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a few nits and comments. 🙂
Thank you for working on this! 🙂

@weyert
Copy link
Contributor Author

weyert commented Aug 4, 2022

@hectorhdzg @pichlermarc I think I have accommodated both your feedback on the PR :)

Copy link
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

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

LGTM

export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void {
if (this._shutdown) {
// If the exporter is shutting down, by spec, we need to return FAILED as export result
setImmediate(resultCallback, { code: ExportResultCode.FAILED });
Copy link
Member

Choose a reason for hiding this comment

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

Probably good to include a reason

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for addressing the comments. 🙂

@legendecas legendecas merged commit d995b80 into open-telemetry:main Aug 8, 2022
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 this pull request may close these issues.

Implement ConsoleMetricsExporter
6 participants