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

ref: Kafka topic configuration #3282

Merged
merged 10 commits into from Mar 20, 2024
Merged

ref: Kafka topic configuration #3282

merged 10 commits into from Mar 20, 2024

Conversation

lynnagara
Copy link
Member

As part of the kafka control plane project, Kafka config for all Sentry services should be automatically generated from a single source of truth in the ops/sentry-kafka-schemas repos.

The system knows about the default topic name + any override value per environment if relevant, but is not aware of the Relay specific values like "events" and "metrics".

This is aligned with the configuration format of Sentry, Snuba and super-big-consumers.

As part of the kafka control plane project, Kafka config for all Sentry services
should be automatically generated from a single source of truth in ops/sentry-kafka-schemas.

The system knows about the default topic name + override value per environment,
but is not aware of the Relay specific values like "events" and "metrics".

This is aligned with the configuration format of Sentry, Snuba and super-big-consumers.
@lynnagara lynnagara requested a review from a team as a code owner March 18, 2024 18:50
pub struct TopicAssignments {
/// Simple events topic name.
#[serde(alias = "ingest-events")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alias is supposed to be temporary, while we cut over config in ops. Later this should change to rename

@@ -156,8 +167,7 @@ impl Default for TopicAssignments {
outcomes: "outcomes".to_owned().into(),
outcomes_billing: None,
sessions: "ingest-sessions".to_owned().into(),
metrics: "ingest-metrics".to_owned().into(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this because I think it's confusing / error prone. There shouldn't be a metrics default. Only 2 completely separate topics for either release health metrics and generic metrics.

@@ -156,8 +167,7 @@ impl Default for TopicAssignments {
outcomes: "outcomes".to_owned().into(),
outcomes_billing: None,
sessions: "ingest-sessions".to_owned().into(),
metrics: "ingest-metrics".to_owned().into(),
metrics_sessions: None,
metrics_sessions: "ingest-metrics".to_owned().into(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now there is duplication here between in default and the "alias" values, which I would like to avoid. Not sure the best way to tackle this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine.

relay-kafka/src/config.rs Outdated Show resolved Hide resolved
relay-kafka/src/config.rs Outdated Show resolved Hide resolved
/// Topic name for metrics extracted from sessions. Defaults to the assignment of `metrics`.
pub metrics_sessions: Option<TopicAssignment>,
/// Topic name for metrics extracted from sessions, aka release health.
#[serde(alias = "metrics")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky, if both metrics and ingest-metrics are defined the precedence isn't clear (it was before). That being sad, I do like the change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to be very temporary just while we cut things over in production. After the migration I think we should be very strict and only support the actual topic names

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, that if someone currently has both topics configured the precedence has now changed, which is a breaking change and this might affect us as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked ST and prod -- we don't use both in any of the environments we control at least.

@@ -156,8 +167,7 @@ impl Default for TopicAssignments {
outcomes: "outcomes".to_owned().into(),
outcomes_billing: None,
sessions: "ingest-sessions".to_owned().into(),
metrics: "ingest-metrics".to_owned().into(),
metrics_sessions: None,
metrics_sessions: "ingest-metrics".to_owned().into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine.

relay-kafka/src/config.rs Show resolved Hide resolved
CHANGELOG.md Outdated
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Kafka topic config supports default topic names as keys ([#3282](https://github.com/getsentry/relay/pull/3282))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Kafka topic config supports default topic names as keys ([#3282](https://github.com/getsentry/relay/pull/3282))
- Kafka topic config supports default topic names as keys. ([#3282](https://github.com/getsentry/relay/pull/3282))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is this normally generated by hand?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, usually done by hand, but many PRs without impact have no changelog entry (this one should)

/// Topic name for metrics extracted from sessions. Defaults to the assignment of `metrics`.
pub metrics_sessions: Option<TopicAssignment>,
/// Topic name for metrics extracted from sessions, aka release health.
#[serde(alias = "metrics")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, that if someone currently has both topics configured the precedence has now changed, which is a breaking change and this might affect us as well.

pub transactions: TopicAssignment,
/// Outcomes topic name.
#[serde(alias = "outcomes")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field is already called outcomes.

Comment on lines 112 to 113
#[serde(alias = "metrics_transactions")]
#[serde(alias = "ingest-generic-metrics")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[serde(alias = "metrics_transactions")]
#[serde(alias = "ingest-generic-metrics")]
#[serde(alias = "metrics_transactions", alias = "ingest-generic-metrics")]

CHANGELOG.md Outdated
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Kafka topic config supports default topic names as keys ([#3282](https://github.com/getsentry/relay/pull/3282))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to the Internal section.

@lynnagara lynnagara merged commit 4cb86c9 into master Mar 20, 2024
20 checks passed
@lynnagara lynnagara deleted the kafka-topic-config branch March 20, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants