feat(metrics): Add artifact_type tag to processing duration metric#577
Merged
NicoHinderling merged 3 commits intomainfrom Mar 9, 2026
Merged
feat(metrics): Add artifact_type tag to processing duration metric#577NicoHinderling merged 3 commits intomainfrom
NicoHinderling merged 3 commits intomainfrom
Conversation
Replace statsd.timed context manager with manual statsd.timing call so artifact_type can be included in the metric tags. The artifact type is only known after parsing inside process_artifact, which happens after the timing context manager was set up. Extract _get_artifact_type to module level so both process_artifact and _prepare_update_data can use it. process_artifact now returns the artifact type string, captured in process_message for the metric. Uses time.monotonic() to match statsd.timed internal behavior. Co-Authored-By: Claude <noreply@anthropic.com>
…e tag ArtifactType enum members have integer values (0, 1, 2), so .value produces tags like artifact_type:0. Use .name.lower() to get human-readable tags like artifact_type:xcarchive. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Sentry Build Distribution
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
DogStatsd is instantiated with use_ms=False (default), so timed() sent elapsed time in seconds. The * 1000 conversion to milliseconds would inflate metric values 1000x, breaking existing dashboards. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Sentry Build Distribution
|
trevor-e
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
artifact_typetag to theartifact.processing.durationstatsd metric so we can break down processing time by artifact type (xcarchive, apk, aab) in Datadog dashboards.The artifact type isn't available when timing starts — it's determined later inside
process_artifactafter download and parsing. To solve this, thestatsd.timedcontext manager is replaced with a manualstatsd.timing()call emitted in afinallyblock where the artifact type is known. Both emit the same timer metric type in Datadog, so existing dashboards are unaffected.Changes:
_get_artifact_typefrom nested function in_prepare_update_datato module-level so bothprocess_artifactand_prepare_update_datacan use itprocess_artifactnow returns the artifact type stringprocess_messagecaptures the return value and emitsstatsd.timing()with the newartifact_typetag in afinallyblocktime.monotonic()to matchstatsd.timedinternal behavior, started at the same position in the ExitStack