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: formulas in timeseries and traceitemtable endpoints #105

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions proto/sentry_protos/snuba/v1/endpoint_time_series.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ message TimeSeriesRequest {
// ex: avg(span.duration) where span.environment = 'production'
TraceItemFilter filter = 2;

// the actual aggregation to compute ex: avg(span.duration)
repeated AttributeAggregation aggregations = 3;
// deprecated, please use expressions instead
repeated AttributeAggregation aggregations = 3 [deprecated = true];

// the actual aggregation to compute ex: avg(span.duration) or avg(span.duration) / sum(span.duration)
repeated Expression expressions = 6;

// the level of detail in the timeseries graph,
// low granularity is very detailed, high is less detail.
Expand All @@ -40,6 +43,26 @@ message TimeSeriesRequest {
repeated AttributeKey group_by = 5;
}

message Expression {
oneof expression {
AttributeAggregation aggregation = 1;
BinaryFormula formula = 2;
}

message BinaryFormula {
kylemumma marked this conversation as resolved.
Show resolved Hide resolved
enum Op {
OP_UNSPECIFIED = 0;
OP_DIVIDE = 1;
OP_MULTIPLY = 2;
OP_ADD = 3;
OP_SUBTRACT = 4;
}
Op op = 1;
Expression left = 2;
Expression right = 3;
}
}

message DataPoint {
float data = 1;

Expand Down
14 changes: 14 additions & 0 deletions proto/sentry_protos/snuba/v1/endpoint_trace_item_table.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,22 @@ message Column {
oneof column {
AttributeKey key = 1;
AttributeAggregation aggregation = 2;
BinaryFormula formula = 4;
}
string label = 3;

message BinaryFormula {
enum Op {
OP_UNSPECIFIED = 0;
OP_DIVIDE = 1;
OP_MULTIPLY = 2;
OP_ADD = 3;
OP_SUBTRACT = 4;
}
Op op = 1;
Column left = 2;
Column right = 3;
}
}

message TraceItemColumnValues {
Expand Down
Loading