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

feat(measurements): Add experimental set_measurement api on transaction #1359

Merged
merged 11 commits into from
May 6, 2022

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Mar 4, 2022

I went with set_measurement(name, value, unit) (singular) instead of set_measurements as in JS since I think this is more convenient for the end user. Otherwise they need to build the name -> unit/value dict themselves.

This should be merged once develop is synced and the changes in relay have been made to support units for measurements.

@sl0thentr0py sl0thentr0py marked this pull request as draft March 4, 2022 14:32
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

I like this better then the plural version. Very clean interface. This way one can set and update values.

sentry_sdk/tracing.py Show resolved Hide resolved

events = capture_events()

transaction = start_transaction(name="measuring stuff")

Choose a reason for hiding this comment

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

if I do:

child = transaction.start_child(x)

can I do child.set_measurement(x, y) too?

Or start_child would return a different interface that does not provide set_measurement? since measurements are only available at the transaction level.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently they are just on transaction and not span, start_child returns a span so you can't add measurements there. From what I understood of the requirements, we only want to expose this api on the transaction but this is a design decision and we can also change it.

Open decision is also if we want to expose this on the hub/top-level api as well where it'll just fetch the current hub/scope/transaction and set it there.

Choose a reason for hiding this comment

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

I agree that we should not leak this API to the Child level as well, but a few SDKs return the very same interface for start_transaction and start_child, so unless we change that, the public API will leak.
cc @bruno-garcia

@github-actions
Copy link

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@sl0thentr0py sl0thentr0py force-pushed the neel/WEBBACKEND-108-measurements-api branch 2 times, most recently from 3036ecb to 28662c0 Compare May 5, 2022 11:58
@sl0thentr0py sl0thentr0py force-pushed the neel/WEBBACKEND-108-measurements-api branch from 62a0ac6 to 822ad0f Compare May 5, 2022 12:32
@sl0thentr0py
Copy link
Member Author

@sl0thentr0py
Copy link
Member Author

sl0thentr0py commented May 5, 2022

tested graceful error handling (unit name too long)

image

@sl0thentr0py sl0thentr0py marked this pull request as ready for review May 5, 2022 13:07
@sl0thentr0py sl0thentr0py enabled auto-merge (squash) May 6, 2022 08:45
@sl0thentr0py sl0thentr0py merged commit 7a3b0e5 into master May 6, 2022
@sl0thentr0py sl0thentr0py deleted the neel/WEBBACKEND-108-measurements-api branch May 6, 2022 09:16
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.

3 participants