-
Notifications
You must be signed in to change notification settings - Fork 663
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
PeriodicExportingMetricsReader with value = infinity to support explicit metric collection #3059
Conversation
to support metrics report that does not rely on intervals. Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
Signed-off-by: howardyoo <howardyoo@gmail.com>
opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py
Outdated
Show resolved
Hide resolved
Hey folks, thanks for discussing this PR with me. |
I still think the |
2. modified Existing PeriodicExportingMetricReader to support zero interval 3. added a test case Signed-off-by: Howard Yoo <howardyoo@gmail.com>
Hi all, thank you for all your interest in this PR. |
Change looks good. Could you add a working example docs folder under |
Also as a addition to a followup conversation I had with @srikanthccv, we don't want to set a precedence of advising users normally to use |
Yes, I believe I can do that, so will include this in the example. Thank you! |
and also entries in README, and added an entry in CHANGELOG Signed-off-by: Howard Yoo <howardyoo@gmail.com>
Signed-off-by: Howard Yoo <howardyoo@gmail.com>
Actually after discussion it in our Python SIG, we've decided that it's better to treat this functionality as an internal implementation, rather than an actual feature, so it would be preferred to not have an explicit example for it. Apologies for the back and forth. |
Thanks for the PR @howardyoo. I have a concern with the magic value being zero. My expectation with a zero interval would be that metrics are constantly exported. I probably wouldn't recommend users doing that, but I can imagine someone opening an issue with this request, e.g. they only have asynchronous instruments and want to scrape as quickly as possible. In the case of zero interval, you could also avoid creating a background thread as there is no waiting needed between calls. |
Ok, I'm good with that. Updated commit by removing the examples and mention of it in the README. |
I see, |
…ssion. Signed-off-by: Howard Yoo <howardyoo@gmail.com>
…rt/__init__.py LGTM Co-authored-by: Aaron Abbott <aaronabbott@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through this PR! One nit, otherwise LGTM
opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py
Outdated
Show resolved
Hide resolved
…rt/__init__.py yup, make sense. Thanks! Co-authored-by: Aaron Abbott <aaronabbott@google.com>
opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Howard Yoo <howardyoo@gmail.com>
opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py
Show resolved
Hide resolved
for later checks. Signed-off-by: Howard Yoo <howardyoo@gmail.com>
Hey! Just wanted to say thanks to @srikanthccv , @lzchen , @ocelotl , and @aabmass for all the thoughtful comment and reviews, approvals to make this go through. Really appreciated your support and feedbacks! |
There was a lot of back and forth from us, and thanks for being patient all along. |
when will the next release be? |
probably next week |
Hey 👋 Stumbled upon this while trying to send a gauge from a short-lived CLI command. That gauge should be sent when you run I thought this would be a perfect, even if unofficial, solution, but when I try to set the Edit: looking at the code, the error message is a bit misleading, as math.inf works. nvm :) |
Hi, I believe we had some means to do what you want to do, and I think we made the changes. Let me check to see whether that has been done.HowardSent from my iPhoneOn Mar 9, 2024, at 9:53 AM, Dominik Guhr ***@***.***> wrote:
Hey 👋 Stumbled upon this while trying to add a gauge to a CLI that is sent when you run mycli test --export --format=opentelemetry - I thought this would be a perfect, even if unofficial, solution, but when I try to set the export_interval_millis to zero, I get an error that it is not allowed to be used with zero nor infinity with the current api/sdk. So, it'd be great if anyone could tell me if the manual triggering still works or not.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
An update:This was done about a year ago, so spent some time going back threads to read the history. So just to explain, setting the interval to zero was suggested originally but met a better suggestion of instead of setting to math.inf. If the math.inf was set as an interval, the periodic metric exporter should not get triggered periodically, and thus would need to be exported manually.Hope this helps!Sent from my iPhoneOn Mar 9, 2024, at 9:53 AM, Dominik Guhr ***@***.***> wrote:
Hey 👋 Stumbled upon this while trying to add a gauge to a CLI that is sent when you run mycli test --export --format=opentelemetry - I thought this would be a perfect, even if unofficial, solution, but when I try to set the export_interval_millis to zero, I get an error that it is not allowed to be used with zero nor infinity with the current api/sdk. So, it'd be great if anyone could tell me if the manual triggering still works or not.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks for the clarification @howardyoo - yes, I figured it out by looking at the code for the Periodic metrics exporter. It was just that I trusted the attribute errors message too much after 0 didn't work- as written above, it states that math.inf also wouldn't work, so I expected to get the very same error using it. |
I actually went back and checked, and found out the error message stated: |
Description
In this PR, I would like to introduce a new feature in PeriodicExportingMetricsReader. Basically, it will have an additional feature which will allow the reader to receive zero interval (explicitly set by user). When the interval is set to zero, the PeriodicExportingMetricReader will not be automatically triggered to collect metrics in intervals, but rather rely on user to explicitly invoke collect to do so. The purpose is to support cases where user would rely on external triggering mechanism to perform collection.
Fixes # (issue)
#3055
Type of change
Please delete options that are not relevant.
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
Does This PR Require a Contrib Repo Change?
Answer the following question based on these examples of changes that would require a Contrib Repo Change:
The OTel specification has changed which prompted this PR to update the method interfaces of
opentelemetry-api/
oropentelemetry-sdk/
The method interfaces of
test/util
have changedScripts in
scripts/
that were copied over to the Contrib repo have changedConfiguration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in
pyproject.toml
isort.cfg
.flake8
When a new
.github/CODEOWNER
is addedMajor changes to project information, such as in:
README.md
CONTRIBUTING.md
Yes. - Link to PR:
No.
Checklist: