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

refactor(sdk-metrics-base): meter shared states #2821

Merged

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Mar 8, 2022

Which problem is this PR solving?

Refactors meter states so that we can safely add more meter internal fields like async instrument callback registrations.

Also hides the public Meter.collect method in the shared state interface so that it can only be exposed through MetricReader.

This is extracted from #2785 as part of the async callback re-work.

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

  • MeterSharedState.collect

Checklist:

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

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #2821 (03fa81f) into main (0213d82) will increase coverage by 0.08%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2821      +/-   ##
==========================================
+ Coverage   93.25%   93.33%   +0.08%     
==========================================
  Files         152      165      +13     
  Lines        4904     5594     +690     
  Branches     1039     1176     +137     
==========================================
+ Hits         4573     5221     +648     
- Misses        331      373      +42     
Impacted Files Coverage Δ
...ry-sdk-metrics-base/src/state/SyncMetricStorage.ts 78.94% <0.00%> (-21.06%) ⬇️
...y-sdk-metrics-base/src/state/AsyncMetricStorage.ts 85.18% <0.00%> (-14.82%) ⬇️
...metrics-base/src/state/MeterProviderSharedState.ts 100.00% <0.00%> (ø)
packages/exporter-trace-otlp-http/src/transform.ts 88.69% <0.00%> (ø)
...exporter-metrics-otlp-http/src/transformMetrics.ts 91.37% <0.00%> (ø)
...emetry-instrumentation-xml-http-request/src/xhr.ts 97.63% <0.00%> (ø)
...mentation-xml-http-request/src/enums/EventNames.ts 100.00% <0.00%> (ø)
...metrics-otlp-http/src/OTLPMetricExporterOptions.ts 100.00% <0.00%> (ø)
packages/exporter-trace-otlp-http/src/util.ts 100.00% <0.00%> (ø)
...s/exporter-trace-otlp-http/src/OTLPExporterBase.ts 100.00% <0.00%> (ø)
... and 7 more

tsconfig.es5.json Outdated Show resolved Hide resolved
@legendecas legendecas force-pushed the metrics-ff/meter-shared-state branch from e1fd1b8 to 9dad9d0 Compare March 8, 2022 09:16
@legendecas legendecas marked this pull request as ready for review March 8, 2022 09:20
@legendecas legendecas requested a review from a team March 8, 2022 09:20
@legendecas legendecas force-pushed the metrics-ff/meter-shared-state branch from 9dad9d0 to 27ce086 Compare March 8, 2022 09:30
@legendecas legendecas reopened this Mar 23, 2022
…ared-state

# Conflicts:
#	experimental/packages/opentelemetry-sdk-metrics-base/src/Meter.ts
#	experimental/packages/opentelemetry-sdk-metrics-base/test/state/MetricCollector.test.ts
@legendecas
Copy link
Member Author

This was closed accidentally. Reopened, and rebased.

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 great! 🙂

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

This looks mostly like a "pure" refactoring to me and no new functionality right? LGTM

@legendecas legendecas requested a review from a team March 26, 2022 01:49
@legendecas
Copy link
Member Author

This looks mostly like a "pure" refactoring to me and no new functionality right?

Yeah, this PR doesn't introduce any new features.

@dyladan
Copy link
Member

dyladan commented Mar 28, 2022

@open-telemetry/javascript-approvers please take a look at this if you have time

Copy link
Contributor

@seemk seemk left a comment

Choose a reason for hiding this comment

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

My moral support 🙂

@legendecas
Copy link
Member Author

@open-telemetry/javascript-approvers this pr still needs one more review, I'd appreciate it if anyone can take a look at this :) I've updated it on top of the main branch and added a changelog entry.

@dyladan
Copy link
Member

dyladan commented Apr 6, 2022

I'll bug everyone in the SIG meeting :)

@legendecas
Copy link
Member Author

@open-telemetry/javascript-approvers merged the latest main branch and resolved conflicts. we still need one more review on this PR :)

@legendecas legendecas force-pushed the metrics-ff/meter-shared-state branch from 1ca839b to 03fa81f Compare April 11, 2022 17:08
@legendecas
Copy link
Member Author

Unexpected push... reverted to the previous version 03fa81f.

We are still waiting for another review to merge :-)

@legendecas
Copy link
Member Author

@vmarchaud thank you

@legendecas legendecas merged commit 14bd6f9 into open-telemetry:main Apr 11, 2022
@legendecas legendecas deleted the metrics-ff/meter-shared-state branch April 11, 2022 17:32
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.

5 participants