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

Make the metric instrument constructors base off MeterProvider implementation #1182

Closed
lzchen opened this issue Sep 30, 2020 · 0 comments · Fixed by #1254
Closed

Make the metric instrument constructors base off MeterProvider implementation #1182

lzchen opened this issue Sep 30, 2020 · 0 comments · Fixed by #1254
Labels
good first issue Good first issue metrics sdk Affects the SDK package.

Comments

@lzchen
Copy link
Contributor

lzchen commented Sep 30, 2020

From this comment, the constructors of metric instruments in the SDK need to pass in the explicit type. This will make it so that the implementation of the resulting metric instrument created is dependent on the type that is passed in, not based off of what MeterProvider implementation is used (and in turn, Meter).

For example, if I want to construct a ValueRecorder, and I expect the SDK behaviour, but I do not want to break the user if they are using the api implementation (or any other implementation), I am not actually able to do this. To utilize the SDK ValueRecorder, I MUST pass in this class type to create metric in the SDK. This is bad because then the code will HAVE to take a dependency on the SDK.

The solution is to have explicit create methods for each instrument type. The original reason why we had a generic create_metric was so we did not have to duplicate this code. See java or go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good first issue metrics sdk Affects the SDK package.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant