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(eap): Update interface of eap mutations #335

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

untitaker
Copy link
Member

@untitaker untitaker commented Sep 25, 2024

@untitaker untitaker requested review from a team as code owners September 25, 2024 10:22
@untitaker untitaker changed the title eap interface cleanup ref(eap): Update interface of eap mutations Sep 25, 2024
Copy link

github-actions bot commented Sep 25, 2024

versions in use:

The following repositories use one of the schemas you are editing. It is recommended to roll out schema changes in small PRs, meaning that if those used versions lag behind the latest, it is probably best to update those services before rolling out your change.

  • getsentry/sentry: pip:sentry-kafka-schemas==0.1.111 (upgrade)
  • getsentry/snuba: pip:sentry-kafka-schemas==0.1.113
  • getsentry/snuba: rust:sentry-kafka-schemas==0.1.113

latest version: 0.1.113

changes considered breaking

schemas/snuba-eap-mutations.v1.schema.json

  • Removed a property _sort_timestamp from .filter, so it is no longer accepted. Maybe use additionalProperties?

    {"path": ".filter", "change": {"PropertyRemove": {"lhs_additional_properties": false, "removed": "_sort_timestamp"}}}
    
benign changes

schemas/snuba-eap-mutations.v1.schema.json

  • Added a new property.

    {"path": ".filter", "change": {"PropertyAdd": {"lhs_additional_properties": false, "added": "start_timestamp"}}}
    

⚠️ This PR contains breaking changes. Normally you should avoid that and make
your consumer backwards-compatible (meaning that updated consumers can still
accept old messages). There are a few exceptions:

  • If consumers already require these invariants in practice, and you're
    just adjusting the JSON schema to reality, ignore this warning.

  • If you know what you are doing, this change could potentially be rolled out
    to producers first, but that's not a flow we support.

@@ -1,7 +1,7 @@
{
"filter": {
"organization_id": 1500,
"_sort_timestamp": 150,
Copy link
Member

Choose a reason for hiding this comment

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

Curious why we had to make this 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.

not strictly necessary, but now there is just one place that computes _sort_timestamp (the snuba consumers), instead of whichever users of the mutations platform we have. _sort_timestamp is an attribute derived from start_timestamp_ms and IMO should've never been exposed outside of snuba in the first place

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

makes sense

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 we need to be a little careful here: _sort_timestamp exists so to abstract which timestamp values we use to sort the data. So it might not always be start timestamp.

Copy link
Member Author

Choose a reason for hiding this comment

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

@evanh I think we have to either expose _sort_timestamp or start_timestamp_ms to users of the mutation interface. But there's no rush to make this interface change.

Copy link
Contributor

@phacops phacops Sep 26, 2024

Choose a reason for hiding this comment

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

We should only expose start_timestamp to users of the mutation interface and note that it's meant to be a microsecond precision timestamp, not milliseconds. And then, we can round it in the consumer to whatever the _sort_timestamp rounds it to (right now it rounding to the second precision).

We do this to be able to sort spans by start_timestamp and have the appropriate order since some spans can be started in fast succession during the same milliseconds. That's also why we store it in ClickHouse as a DateTime64.

Also, we use a float64 in the span, as a timestamp in seconds with microsecond precision, why not keep that? ClickHouse supports ingestion of this timestamp into a DateTime64.

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 how start timestamp is represented in a span on kafka: https://github.com/getsentry/snuba/blob/a612e70b017a95969a6f6f21332952cf5d386b21/rust_snuba/src/processors/eap_spans.rs#L300

intended to match that

what is the interface supposed to be for EAP then?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to be a little careful here: _sort_timestamp exists so to abstract which timestamp values we use to sort the data. So it might not always be start timestamp.

While it's true, I think there's a higher chance we move towards sending incomplete spans from the SDKs and having to update end_timestamp, which makes it not viable for the primary key.

@@ -1,7 +1,7 @@
{
"filter": {
"organization_id": 1500,
"_sort_timestamp": 150,
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 we need to be a little careful here: _sort_timestamp exists so to abstract which timestamp values we use to sort the data. So it might not always be start timestamp.

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.

4 participants