Skip to content

Commit

Permalink
expose trace_sampled and num_processing_errors from events and discov…
Browse files Browse the repository at this point in the history
…er entities (#4368)
  • Loading branch information
barkbarkimashark committed Jun 16, 2023
1 parent 257a3d8 commit b055157
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
10 changes: 10 additions & 0 deletions snuba/datasets/configuration/discover/entities/discover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ schema:
type: UUID,
args: { schema_modifiers: [nullable] },
},
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
},
]
required_time_column: timestamp
storages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ schema:
[{ name: name, type: String }, { name: version, type: String }],
},
},
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
},
]
required_time_column: timestamp
storages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ storages:
- exception_main_thread
- modules.name
- modules.version
- trace_sampled
- num_processing_errors
subscriptables:
- mapper: SubscriptableMapper
args:
Expand Down
10 changes: 10 additions & 0 deletions snuba/datasets/configuration/events/entities/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ schema:
[{ name: name, type: String }, { name: version, type: String }],
},
},
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
},
]
required_time_column: timestamp
storages:
Expand Down
2 changes: 2 additions & 0 deletions snuba/query/snql/discover_entity_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
),
("modules", Nested([("name", String()), ("version", String())])),
("exception_main_thread", UInt(8, Modifiers(nullable=True))),
("trace_sampled", UInt(8, Modifiers(nullable=True))),
("num_processing_errors", UInt(64, Modifiers(nullable=True))),
]
)

Expand Down
23 changes: 23 additions & 0 deletions tests/test_discover_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,29 @@ def test_tagstore_sampling(self) -> None:
data = json.loads(response.data)["data"]
assert len(data) == 11

def test_trace_sample_num_processing_errors(self) -> None:
response = self.post(
json.dumps(
{
"selected_columns": ["trace_sampled", "num_processing_errors"],
"limit": 1000,
"project": [self.project_id],
"dataset": "discover",
"tenant_ids": {"referrer": "r", "organization_id": 1234},
"from_date": (self.base_time - self.skew).isoformat(),
"to_date": (self.base_time + self.skew).isoformat(),
"conditions": [["project_id", "IN", [self.project_id]]],
"consistent": False,
}
),
entity="discover",
)

assert response.status_code == 200
data = json.loads(response.data)["data"]
assert len(data) == 1
assert data == [{"trace_sampled": None, "num_processing_errors": 0}]


class TestDiscoverAPIEntitySelection(TestDiscoverApi):
"""
Expand Down

0 comments on commit b055157

Please sign in to comment.