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

Implement ExplicitBucketBoundaries advisory for Histograms #4361

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

xrmx
Copy link
Contributor

@xrmx xrmx commented Dec 17, 2024

Description

This adds basic support for the advisory attribute of Instruments and implements ExplicitBucketBoundaries advisory for Histograms.

Fixes #4140

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

  • Test A

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

@xrmx xrmx requested a review from a team as a code owner December 17, 2024 10:38
Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

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

Thanks. Any clue on the docs CI error? I would say to add to nitpick_ignore.

@xrmx
Copy link
Contributor Author

xrmx commented Dec 19, 2024

Thanks. Any clue on the docs CI error? I would say to add to nitpick_ignore.

Nope, it's really hard for me to understand where this is coming from. Tried using "AnyValue" in util/types.py but does not change anything.

@xrmx
Copy link
Contributor Author

xrmx commented Dec 19, 2024

Appear to work fine with the flask implementation after updating the create_histogram calls for HTTP_SERVER_REQUEST_DURATION:

                        {
                            "name": "http.server.request.duration",
                            "description": "Duration of HTTP server requests.",
                            "unit": "s",
                            "data": {
                                "data_points": [
                                    {
                                        "attributes": {
                                            "http.request.method": "GET",
                                            "url.scheme": "http",
                                            "network.protocol.version": "1.1",
                                            "http.response.status_code": 200,
                                            "http.route": "/rolldice"
                                        },
                                        "start_time_unix_nano": 1734623881505049269,
                                        "time_unix_nano": 1734624051781113265,
                                        "count": 9,
                                        "sum": 0.00882425531744957,
                                        "bucket_counts": [
                                            9,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0,
                                            0
                                        ],
                                        "explicit_bounds": [
                                            0.005,
                                            0.01,
                                            0.025,
                                            0.05,
                                            0.075,
                                            0.1,
                                            0.25,
                                            0.5,
                                            0.75,
                                            1,
                                            2.5,
                                            5,
                                            7.5,
                                            10
                                        ],
                                        "min": 0.0004944326356053352,
                                        "max": 0.001611161045730114,
                                        "exemplars": []
                                    }
                                ],
                                "aggregation_temporality": 2
                            }
                        }

@emdneto
Copy link
Member

emdneto commented Dec 19, 2024

Thanks. Any clue on the docs CI error? I would say to add to nitpick_ignore.

Nope, it's really hard for me to understand where this is coming from. Tried using "AnyValue" in util/types.py but does not change anything.

We can probably use a TypedDict or just add ("py:class", "AnyValue"), to nitpick_ignore and see if it works:

diff --git a/docs/conf.py b/docs/conf.py
index 965a806d..997b5784 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -96,6 +96,7 @@ nitpicky = True
 # Container supposedly were fixed, but does not work
 # https://github.com/sphinx-doc/sphinx/pull/3744
 nitpick_ignore = [
+    ("py:class", "AnyValue"),
     ("py:class", "ValueT"),
     ("py:class", "CarrierT"),
     ("py:obj", "opentelemetry.propagators.textmap.CarrierT"),

@xrmx
Copy link
Contributor Author

xrmx commented Dec 19, 2024

Thanks. Any clue on the docs CI error? I would say to add to nitpick_ignore.

Nope, it's really hard for me to understand where this is coming from. Tried using "AnyValue" in util/types.py but does not change anything.

We can probably use a TypedDict or just add ("py:class", "AnyValue"), to nitpick_ignore and see if it works:

Moved to TypedDict, thanks for the hint!

@emdneto emdneto added the Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary label Dec 19, 2024
@xrmx xrmx force-pushed the histogram-advisory branch from 3c8b98e to 181596b Compare December 23, 2024 14:25
@xrmx xrmx requested a review from emdneto December 23, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the histogram bucket advise API
2 participants