getsentry / getsentry/sentry

Span Property Math

Open
#109,948 4 comments 0 reactions 0 assignees View on GitHub
Feature Product Area: Performance
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 10m
Merged PRs (30d)
635

Description

### Problem Statement

We occasionally have span properties that we would like to perform some metric math on in the context of a single span, rather than across spans.

For example, if I have a span that has both "points" and "factor" properties, it would be great to be able to perform the math `sum(span.points * span.factor)`

The current workaround is to use something like `sum(span.points) * avg(span.factor)`, but this of course produces significantly different results from executing the math on each span before combining.

Ex. with 5 spans that have the following values:
| points | factor |
|--------|--------|
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| 100 | 5 |

`sum(span.points * span.factor)` produces 504, while `sum(span.points) * avg(span.factor)` produces 187.2

### Solution Brainstorm

_No response_

### Product Area

Unknown

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are identified in the issue. Start by locating the span-property aggregation and metric-math implementation, then determine how per-span multiplication could be represented; done means supporting expressions such as sum(span.points * span.factor) with results matching the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.