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

fix(validation): EntityContainsColumnValidator wasn't actually enabled #4399

Merged
merged 24 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0ead0dd
it actually is applied
rahul-kumar-saini Jun 22, 2023
eac64e3
time column on all entity
rahul-kumar-saini Jun 27, 2023
9adef3a
reset sentry dsn
rahul-kumar-saini Jun 27, 2023
eb5d942
dupilcate column
rahul-kumar-saini Jun 28, 2023
7426a9a
events
rahul-kumar-saini Jun 28, 2023
d10e2a9
undo unecessary ones
rahul-kumar-saini Jun 28, 2023
c56c8e5
defaultnone
rahul-kumar-saini Jun 29, 2023
bc12932
remove print
rahul-kumar-saini Jun 29, 2023
5cfa46f
add more mappers
rahul-kumar-saini Jun 29, 2023
a8b2e06
duplicate column again
rahul-kumar-saini Jun 29, 2023
73d3441
update tests
rahul-kumar-saini Jun 30, 2023
c64597d
Merge remote-tracking branch 'origin/master' into rahul/fix/entity-co…
enochtangg Nov 17, 2023
b983fd2
add use_case_id and granularity to generic_metrics entity and fix test
enochtangg Nov 17, 2023
e2afa7a
fix test query tests with real column names
enochtangg Nov 17, 2023
24f6f5a
fix test_format_expressions
enochtangg Nov 19, 2023
7010606
fix more tests
enochtangg Nov 19, 2023
0ce7baa
fix tests and add granularity and use_case_id to metrics entities
enochtangg Nov 19, 2023
d8833e6
fix more tests
enochtangg Nov 19, 2023
21fde10
fix tests
enochtangg Nov 20, 2023
ad6a3ba
Merge remote-tracking branch 'origin/master' into rahul/fix/entity-co…
enochtangg Nov 20, 2023
88faeef
add missing roup_raw to spans storage and entity
enochtangg Nov 20, 2023
2890b00
fix test for clickhouse v23
enochtangg Nov 20, 2023
035bede
override entity column validator in tests
enochtangg Nov 20, 2023
7207c2d
add typing
enochtangg Nov 20, 2023
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
13 changes: 5 additions & 8 deletions snuba/datasets/configuration/discover/entities/discover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ kind: entity
name: discover
schema:
[
{ name: event_id, type: FixedString, args: { length: 32 }},
{ name: event_id, type: FixedString, args: { length: 32 } },
{ name: project_id, type: UInt, args: { size: 64 } },
{ name: type, type: String, args: { schema_modifiers: [nullable] } },
{ name: timestamp, type: DateTime },
{ name: time, type: DateTime },
{ name: platform, type: String, args: { schema_modifiers: [nullable] } },
{ name: environment, type: String, args: { schema_modifiers: [nullable] } },
{ name: release, type: String, args: { schema_modifiers: [nullable] } },
Expand Down Expand Up @@ -254,11 +255,7 @@ schema:
type: String,
args: { schema_modifiers: [nullable] },
},
{
name: profile_id,
type: UUID,
args: { schema_modifiers: [nullable] },
},
{ name: profile_id, type: UUID, args: { schema_modifiers: [nullable] } },
{
name: replay_id,
type: UUID,
Expand All @@ -267,12 +264,12 @@ schema:
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
args: { schema_modifiers: [nullable], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
args: { schema_modifiers: [nullable], size: 64 },
},
]
required_time_column: timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ schema:
[
{ name: project_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: time, type: DateTime },
{ name: rtime, type: DateTime },
{ name: event_id, type: UUID },
{ name: platform, type: String },
{ name: environment, type: String, args: { schema_modifiers: [nullable] } },
Expand Down Expand Up @@ -195,12 +197,12 @@ schema:
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
args: { schema_modifiers: [nullable], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
args: { schema_modifiers: [nullable], size: 64 },
},
{ name: replay_id, type: UUID, args: { schema_modifiers: [nullable] } },
]
Expand Down Expand Up @@ -538,7 +540,6 @@ subscription_validators:
- orderby
required_time_column: timestamp


join_relationships:
grouped:
rhs_entity: groupedmessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ schema:
{ name: title, type: String, args: { schema_modifiers: [readonly] } },
{ name: transaction_source, type: String },
{ name: timestamp, type: DateTime, args: { schema_modifiers: [readonly] } },
{ name: time, type: DateTime, args: { schema_modifiers: [readonly] } },
{
name: group_ids,
type: Array,
args: { inner_type: { type: UInt, args: { size: 64 } } },
},
{ name: app_start_type, type: String },
{ name: profile_id, type: UUID, args: {schema_modifiers: [nullable]}},
{ name: replay_id, type: UUID, args: {schema_modifiers: [nullable]}}
{ name: profile_id, type: UUID, args: { schema_modifiers: [nullable] } },
{ name: replay_id, type: UUID, args: { schema_modifiers: [nullable] } }
]
required_time_column: finish_ts
storages:
Expand Down Expand Up @@ -354,7 +355,7 @@ subscription_validators:
{
max_allowed_aggregations: 1,
disallowed_aggregations: [groupby, having, orderby],
required_time_column: finish_ts
required_time_column: finish_ts,
},
},
]
8 changes: 5 additions & 3 deletions snuba/datasets/configuration/entity_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,13 @@
return relationships


def _build_validation_mode(mode: str | None) -> ColumnValidationMode:
def _build_validation_mode(mode: str | None) -> ColumnValidationMode | None:
if not mode:
return ColumnValidationMode.DO_NOTHING
return None

if mode == "warn":
if mode == "do_nothing":
return ColumnValidationMode.DO_NOTHING

Check warning on line 194 in snuba/datasets/configuration/entity_builder.py

View check run for this annotation

Codecov / codecov/patch

snuba/datasets/configuration/entity_builder.py#L194

Added line #L194 was not covered by tests
elif mode == "warn":
return ColumnValidationMode.WARN
elif mode == "error":
return ColumnValidationMode.ERROR
Expand Down
7 changes: 4 additions & 3 deletions snuba/datasets/configuration/events/entities/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ schema:
[
{ name: project_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: time, type: DateTime },
{ name: rtime, type: DateTime },
{ name: event_id, type: UUID },
{ name: platform, type: String },
{ name: environment, type: String, args: { schema_modifiers: [nullable] } },
Expand Down Expand Up @@ -195,12 +197,12 @@ schema:
{
name: trace_sampled,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 8 },
args: { schema_modifiers: [nullable], size: 8 },
},
{
name: num_processing_errors,
type: UInt,
args: { schema_modifiers: [ nullable ], size: 64 },
args: { schema_modifiers: [nullable], size: 64 },
},
{ name: replay_id, type: UUID, args: { schema_modifiers: [nullable] } },
]
Expand Down Expand Up @@ -473,7 +475,6 @@ subscription_validators:
- orderby
required_time_column: timestamp


join_relationships:
grouped:
rhs_entity: groupedmessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand All @@ -23,7 +25,7 @@ schema:
{
name: value,
type: AggregateFunction,
args: { func: sum, arg_types: [ { type: Float, args: { size: 64 } } ] },
args: { func: sum, arg_types: [{ type: Float, args: { size: 64 } }] },
},
]
required_time_column: timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 32 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 32 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 32 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 8 } },
{ name: use_case_id, type: String },
]
required_time_column: timestamp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 32 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
2 changes: 2 additions & 0 deletions snuba/datasets/configuration/metrics/entities/org_sets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schema:
{ name: metric_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: bucketed_time, type: DateTime },
{ name: granularity, type: UInt, args: { size: 32 } },
{ name: use_case_id, type: String },
{
name: tags,
type: Nested,
Expand Down
40 changes: 20 additions & 20 deletions snuba/datasets/configuration/outcomes/entities/outcomes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ schema:
{ name: project_id, type: UInt, args: { size: 64 } },
{ name: key_id, type: UInt, args: { size: 64 } },
{ name: timestamp, type: DateTime },
{ name: time, type: DateTime },
{ name: outcome, type: UInt, args: { size: 8 } },
{ name: reason, type: String },
{ name: quantity, type: UInt, args: { size: 64 } },
{ name: category, type: UInt, args: { size: 8 } },
{ name: times_seen, type: UInt, args: { size: 64 } },
{ name: time, type: DateTime },
]

required_time_column: timestamp
storages:
- storage: outcomes_hourly
is_writable: false
- storage: outcomes_raw
is_writable: true
- storage: outcomes_hourly
is_writable: false
- storage: outcomes_raw
is_writable: true
storage_selector:
selector: SimpleQueryStorageSelector
args:
storage: outcomes_hourly
query_processors:
- processor: BasicFunctionsProcessor
- processor: TimeSeriesProcessor
args:
time_group_columns:
time: timestamp
time_parse_columns:
- timestamp
- processor: ReferrerRateLimiterProcessor
- processor: OrganizationRateLimiterProcessor
args:
org_column: org_id
- processor: BasicFunctionsProcessor
- processor: TimeSeriesProcessor
args:
time_group_columns:
time: timestamp
time_parse_columns:
- timestamp
- processor: ReferrerRateLimiterProcessor
- processor: OrganizationRateLimiterProcessor
args:
org_column: org_id
validators:
- validator: EntityRequiredColumnValidator
args:
required_filter_columns:
- org_id
- validator: EntityRequiredColumnValidator
args:
required_filter_columns:
- org_id
Loading
Loading