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: Ensure compression.type is specified on all topics #234

Merged
merged 4 commits into from Mar 12, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 4 additions & 7 deletions python/tests/test_sentry_kafka_schemas.py
Expand Up @@ -3,15 +3,12 @@


def test_get_topic() -> None:
# Topic with creation config
topic_name = "snuba-queries"
topic_data = get_topic(topic_name)
assert topic_data["topic_creation_config"] == {"max.message.bytes": "2000000"}

# Topic without creation config
topic_name_no_config = "outcomes"
topic_data = get_topic(topic_name_no_config)
assert topic_data["topic_creation_config"] == {}
assert topic_data["topic_creation_config"] == {
"compression.type": "lz4",
"max.message.bytes": "2000000",
}


def test_get_schema() -> None:
Expand Down
7 changes: 7 additions & 0 deletions python/tests/test_valid_topic_data.py
Expand Up @@ -98,6 +98,13 @@ def test_all_topics() -> None:
# Check description provided for topic
assert topic_data["description"]

# Check every topic has an explicit, valid compression type
# Today we use lz4 everywhere, this list can be extended if needed
valid_types = ["lz4"]
assert (
topic_data["topic_creation_config"]["compression.type"] in valid_types
)

# Check valid schema versions
topic_schemas = topic_data["schemas"]
for i, schema_raw in enumerate(topic_schemas):
Expand Down
2 changes: 2 additions & 0 deletions topics/events-subscription-results.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: subscription-results.v1.schema.json
examples:
- subscription-results/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/events.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- events/1/
topic_creation_config:
compression.type: lz4
max.message.bytes: "25000000"
message.timestamp.type: LogAppendTime
1 change: 1 addition & 0 deletions topics/generic-events.yaml
Expand Up @@ -14,4 +14,5 @@ schemas:
examples:
- generic-events/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
2 changes: 2 additions & 0 deletions topics/generic-metrics-subscription-results.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: subscription-results.v1.schema.json
examples:
- subscription-results/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/group-attributes.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- group-attributes/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
1 change: 1 addition & 0 deletions topics/ingest-events-dlq.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/ingest-events.yaml
Expand Up @@ -14,4 +14,5 @@ schemas:
examples:
- ingest-events/1/
topic_creation_config:
compression.type: lz4
max.message.bytes: "10000000"
1 change: 1 addition & 0 deletions topics/ingest-generic-metrics-dlq.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/ingest-metrics-dlq.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
2 changes: 2 additions & 0 deletions topics/ingest-metrics.yaml
Expand Up @@ -14,3 +14,5 @@ schemas:
resource: ingest-metrics.v1.schema.json
examples:
- ingest-metrics/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/ingest-performance-metrics.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: ingest-metrics.v1.schema.json
examples:
- ingest-metrics/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/ingest-replay-events.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- ingest-replay-events/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
max.message.bytes: "15000000"
2 changes: 2 additions & 0 deletions topics/ingest-replay-recordings.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: ingest-replay-recordings.v1.schema.json
examples:
- ingest-replay-recordings/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/metrics-subscription-results.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: subscription-results.v1.schema.json
examples:
- subscription-results/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/outcomes-billing.yaml
Expand Up @@ -16,3 +16,5 @@ schemas:
resource: outcomes.v1.schema.json
examples:
- outcomes/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/outcomes.yaml
Expand Up @@ -16,3 +16,5 @@ schemas:
resource: outcomes.v1.schema.json
examples:
- outcomes/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/processed-profiles.yaml
Expand Up @@ -14,4 +14,5 @@ schemas:
examples:
- profile-metadata/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
2 changes: 2 additions & 0 deletions topics/profiles-call-tree.yaml
Expand Up @@ -14,3 +14,5 @@ schemas:
resource: profile-functions.v1.schema.json
examples:
- profile-functions/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/sessions-subscription-results.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: subscription-results.v1.schema.json
examples:
- subscription-results/1/
topic_creation_config:
compression.type: lz4
2 changes: 2 additions & 0 deletions topics/shared-resources-usage.yaml
Expand Up @@ -12,3 +12,5 @@ schemas:
resource: shared-resources-usage.v1.schema.json
examples:
- shared-resources-usage/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/snuba-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
1 change: 1 addition & 0 deletions topics/snuba-dead-letter-generic-metrics.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/snuba-dead-letter-group-attributes.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/snuba-dead-letter-metrics.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/snuba-dead-letter-querylog.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/snuba-dead-letter-replays.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- any/
topic_creation_config:
compression.type: lz4
log.retention.minutes: "10080"
1 change: 1 addition & 0 deletions topics/snuba-generic-events-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
1 change: 1 addition & 0 deletions topics/snuba-generic-metrics-counters-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
1 change: 1 addition & 0 deletions topics/snuba-generic-metrics-sets-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
1 change: 1 addition & 0 deletions topics/snuba-generic-metrics.yaml
Expand Up @@ -14,4 +14,5 @@ schemas:
examples:
- snuba-generic-metrics/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
1 change: 1 addition & 0 deletions topics/snuba-metrics-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
2 changes: 2 additions & 0 deletions topics/snuba-metrics-summaries.yaml
Expand Up @@ -12,3 +12,5 @@ schemas:
resource: snuba-metrics-summaries.v1.schema.json
examples:
- snuba-metrics-summaries/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/snuba-metrics.yaml
Expand Up @@ -14,4 +14,5 @@ schemas:
examples:
- snuba-metrics/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
1 change: 1 addition & 0 deletions topics/snuba-queries.yaml
Expand Up @@ -13,4 +13,5 @@ schemas:
examples:
- snuba-queries/1/
topic_creation_config:
compression.type: lz4
max.message.bytes: "2000000"
2 changes: 2 additions & 0 deletions topics/snuba-spans.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: snuba-spans.v1.schema.json
examples:
- snuba-spans/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/snuba-transactions-commit-log.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- snuba-commit-log/1/
topic_creation_config:
compression.type: lz4
cleanup.policy: compact,delete
min.compaction.lag.ms: "3600000"
2 changes: 2 additions & 0 deletions topics/transactions-subscription-results.yaml
Expand Up @@ -13,3 +13,5 @@ schemas:
resource: subscription-results.v1.schema.json
examples:
- subscription-results/1/
topic_creation_config:
compression.type: lz4
1 change: 1 addition & 0 deletions topics/transactions.yaml
Expand Up @@ -15,5 +15,6 @@ schemas:
examples:
- transactions/1/
topic_creation_config:
compression.type: lz4
max.message.bytes: "25000000"
message.timestamp.type: LogAppendTime