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

Improve usability of Metrics SDK #750

Closed
lzchen opened this issue May 29, 2020 · 3 comments
Closed

Improve usability of Metrics SDK #750

lzchen opened this issue May 29, 2020 · 3 comments
Labels
metrics sdk Affects the SDK package.

Comments

@lzchen
Copy link
Contributor

lzchen commented May 29, 2020

The steps to setup and initialize the components needed even BEFORE recording metrics seems to be quite a lot.

metrics.set_meter_provider(MeterProvider(batcher_mode == "stateful"))
meter = metrics.get_meter(__name__)
exporter = ConsoleMetricsExporter()
controller = PushController(meter=meter, exporter=exporter, interval=5)

The division of responsibilities is also not clear. Why does the user need to define the PushController? There is not a clearly defined way of configuring (what exporter I want to use, what controller I want to use, whether it is stateful, the export interval, etc) metrics collection and export properties.

Despite there not being a well-defined metrics SDK spec, I'm creating this issue here to track discussion for the Python implementation specifically (as well as any insight received from the metrics SIG when SDK discussion resumes). As well, small PRs and adjustments to the SDK that are language specific that we feel will lead to a good implementation can be tracked here. Any suggestions are welcome.

@aabmass
Copy link
Member

aabmass commented May 29, 2020

Going through the "Getting Started" doc a few days ago, I was definitely confused by the PushController.

In #751 you mentioned putting all the configuration including the collection interval into MeterProvider. I think that would prevent the user from having metrics with different collection intervals. Is there a potential use case where a user might want metrics on different collection intervals?

@lzchen
Copy link
Contributor Author

lzchen commented May 29, 2020

Yes there are definitely uses cases where the user wants different collection intervals. For example, on Azure side, we have the regular custom metrics you can record and export, and we have live metrics, which export system related metrics automatically very frequently. Users would probably not want to export regular metrics with such high frequency.

With that being said, you are correct about the limitations of configuration in this way. It's quite a difficult problem, where as on one hand we want to have a "global" MeterProvider, but on the other hand be able to create instances of "something" that will allow us to configure things like export interval and stateful per pipeline. Perhaps we can have MeterProvider have a "createPipeline" which takes in configuration elements, and a meter?

@lzchen
Copy link
Contributor Author

lzchen commented Jun 9, 2020

Also another consideration, should exporter be on the MeterProvider or Meter level? That is, would it be likely for a user to need to export to different backends depending on Meter?

@lzchen lzchen closed this as completed Jun 9, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this issue Nov 1, 2020
…n-telemetry#750)

* chore: rename provider in examples and getting started

* chore: update examples, bench, and getting started for api

* chore: update examples for latest changes

* chore: lint examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metrics sdk Affects the SDK package.
Projects
None yet
Development

No branches or pull requests

2 participants