diff --git a/CODEOWNERS b/CODEOWNERS index cd6dd994..7935cf58 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -25,6 +25,9 @@ /topics/snuba-spans.yaml @getsentry/owners-snuba @getsentry/profiling /topics/snuba-metrics-summaries.yaml @getsentry/owners-snuba @getsentry/profiling +# Topics produced by Sentry +/topics/buffered-segments.yaml @getsentry/owners-snuba @getsentry/performance + # DLQs for Snuba topics /topics/snuba-dead-letter-metrics.yaml @getsentry/owners-snuba /topics/snuba-dead-letter-generic-metrics.yaml @getsentry/owners-snuba @@ -50,6 +53,7 @@ /schemas/profile-functions.v1.schema.json @getsentry/owners-snuba @getsentry/profiling /schemas/group-attributes.v1.schema.json @getsentry/owners-snuba @getsentry/issues /schemas/snuba-spans.v1.schema.json @getsentry/owners-snuba @getsentry/profiling +/schemas/buffered-segments.v1.schema.json @getsentry/owners-snuba @getsentry/performance /schemas/snuba-metrics-summaries.v1.schema.json @getsentry/owners-snuba @getsentry/profiling # Examples @@ -61,6 +65,7 @@ /examples/profile-functions/ @getsentry/owners-snuba @getsentry/profiling /examples/group-attributes/ @getsentry/owners-snuba @getsentry/issues /examples/snuba-spans/ @getsentry/owners-snuba @getsentry/profiling +/examples/buffered-segments/ @getsentry/owners-snuba @getsentry/performance /examples/snuba-metrics-summaries/ @getsentry/owners-snuba @getsentry/profiling # Internal Snuba topics diff --git a/examples/buffered-segments/1/basic_buffered_segment.json b/examples/buffered-segments/1/basic_buffered_segment.json new file mode 100644 index 00000000..3168e596 --- /dev/null +++ b/examples/buffered-segments/1/basic_buffered_segment.json @@ -0,0 +1,52 @@ +{ + "spans": [ + { + "duration_ms": 0, + "event_id": "72fcea47d44a444fb132f8d462eeb0b4", + "exclusive_time_ms": 0.006, + "is_segment": true, + "parent_span_id": "93f0e87ad9cc709e", + "profile_id": "7ce060d7ea62432b8355bc9e612676e4", + "project_id": 1, + "received": 1706734067.029479, + "retention_days": 90, + "segment_id": "ace31e54d65652aa", + "sentry_tags": { + "environment": "development", + "op": "relay_fetch_org_options", + "release": "backend@24.2.0.dev0+df7615f2ff7dc3c8802f806477f920bb934bd198", + "transaction": "/api/0/relays/projectconfigs/", + "transaction.method": "POST", + "transaction.op": "http.server", + "user": "ip:127.0.0.1" + }, + "span_id": "95acbe6d30a66717", + "start_timestamp_ms": 1706734066840, + "trace_id": "8e6f22e6169545cc963255d0f29cb76b" + }, + { + "duration_ms": 0, + "event_id": "72fcea47d44a444fb132f8d462eeb0b4", + "exclusive_time_ms": 0.006, + "is_segment": false, + "parent_span_id": "93f0e87ad9cc709e", + "profile_id": "7ce060d7ea62432b8355bc9e612676e4", + "project_id": 1, + "received": 1706734067.029479, + "retention_days": 90, + "segment_id": "ace31e54d65652aa", + "sentry_tags": { + "environment": "development", + "op": "relay_fetch_org_options", + "release": "backend@24.2.0.dev0+df7615f2ff7dc3c8802f806477f920bb934bd198", + "transaction": "/api/0/relays/projectconfigs/", + "transaction.method": "POST", + "transaction.op": "http.server", + "user": "ip:127.0.0.1" + }, + "span_id": "95acbe6d30a66717", + "start_timestamp_ms": 1706734066840, + "trace_id": "8e6f22e6169545cc963255d0f29cb76b" + } + ] +} diff --git a/schemas/buffered-segments.v1.schema.json b/schemas/buffered-segments.v1.schema.json new file mode 100644 index 00000000..135a4ef6 --- /dev/null +++ b/schemas/buffered-segments.v1.schema.json @@ -0,0 +1,239 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "buffered_segment", + "type": "object", + "additionalProperties": true, + "properties": { + "spans": { + "$ref": "#/definitions/Spans" + } + }, + "required": ["spans"], + "definitions": { + "Spans": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/Span" + } + }, + "Span": { + "type": "object", + "additionalProperties": true, + "properties": { + "event_id": { + "$ref": "#/definitions/UUID" + }, + "organization_id": { + "$ref": "#/definitions/UInt" + }, + "project_id": { + "$ref": "#/definitions/UInt" + }, + "trace_id": { + "$ref": "#/definitions/UUID", + "description": "The trace ID is a unique identifier for a trace. It is a 16 byte hexadecimal string." + }, + "span_id": { + "type": "string", + "description": "The span ID is a unique identifier for a span within a trace. It is an 8 byte hexadecimal string." + }, + "parent_span_id": { + "type": "string", + "description": "The parent span ID is the ID of the span that caused this span. It is an 8 byte hexadecimal string." + }, + "segment_id": { + "type": "string", + "description": "The segment ID is a unique identifier for a segment within a trace. It is an 8 byte hexadecimal string." + }, + "profile_id": { + "$ref": "#/definitions/UUID", + "description": "The profile ID. It is an 16 byte hexadecimal string." + }, + "is_segment": { + "type": "boolean", + "description": "Whether this span is a segment or not." + }, + "start_timestamp_ms": { + "$ref": "#/definitions/UInt", + "description": "The start timestamp of the span in milliseconds since epoch." + }, + "duration_ms": { + "$ref": "#/definitions/UInt32", + "description": "The duration of the span in milliseconds." + }, + "exclusive_time_ms": { + "$ref": "#/definitions/PositiveFloat", + "description": "The exclusive time of the span in milliseconds." + }, + "retention_days": { + "$ref": "#/definitions/UInt16" + }, + "received": { + "$ref": "#/definitions/PositiveFloat", + "description": "Unix timestamp when the span was received by Sentry." + }, + "description": { + "type": "string" + }, + "tags": { + "description": " Manual key/value tag pairs.", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/TagValue" + } + }, + { + "type": "null" + } + ] + }, + "sentry_tags": { + "$ref": "#/definitions/SentryExtractedTags" + }, + "measurements": { + "$ref": "#/definitions/Measurements" + }, + "_metrics_summary": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MetricsSummary" + } + } + }, + "required": [ + "duration_ms", + "exclusive_time_ms", + "is_segment", + "project_id", + "received", + "retention_days", + "span_id", + "start_timestamp_ms", + "trace_id" + ] + }, + "SentryExtractedTags": { + "description": "Tags extracted by sentry. These are kept separate from customer tags", + "anyOf": [ + { + "type": "object", + "properties": { + "http.method": { + "type": "string" + }, + "action": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "module": { + "type": "string" + }, + "group": { + "type": "string" + }, + "system": { + "type": "string" + }, + "status": { + "type": "string" + }, + "status_code": { + "type": "string" + }, + "transaction": { + "type": "string" + }, + "transaction.op": { + "type": "string" + }, + "op": { + "type": "string" + }, + "transaction.method": { + "type": "string" + } + }, + "additionalProperties": true + } + ] + }, + "TagValue": { + "type": "string" + }, + "UUID": { + "type": "string", + "minLength": 32, + "maxLength": 36 + }, + "UInt16": { + "type": "integer", + "minimum": 0, + "maximum": 65535 + }, + "UInt32": { + "type": "integer", + "minimum": 0, + "maximum": 4294967295 + }, + "UInt": { + "type": "integer", + "minimum": 0 + }, + "PositiveFloat": { + "type": "number", + "minimum": 0 + }, + "Measurements": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MeasurementValue" + } + }, + "MeasurementValue": { + "type": "object", + "properties": { + "value": { + "type": "number" + }, + "unit": { + "type": "string" + } + }, + "required": ["value"] + }, + "MetricsSummary": { + "type": "array", + "items": { + "$ref": "#/definitions/MetricSummaryValue" + } + }, + "MetricSummaryValue": { + "type": "object", + "properties": { + "min": { + "type": "number" + }, + "max": { + "type": "number" + }, + "sum": { + "type": "number" + }, + "count": { + "type": "number" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } +} diff --git a/topics/buffered-segments.yaml b/topics/buffered-segments.yaml new file mode 100644 index 00000000..ef466c2e --- /dev/null +++ b/topics/buffered-segments.yaml @@ -0,0 +1,16 @@ +topic: buffered-segments +description: List of buffered spans for a segment +services: + producers: + - getsentry/sentry + consumers: + - getsentry/sentry +schemas: + - version: 1 + compatibility_mode: none + type: json + resource: buffered-segments.v1.schema.json + examples: + - buffered-segments/1/ +topic_creation_config: + compression.type: lz4