diff --git a/CODEOWNERS b/CODEOWNERS index 3e318268..936d4202 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -32,6 +32,7 @@ /topics/outcomes-billing.yaml @getsentry/owners-snuba @getsentry/revenue /topics/outcomes-billing-dlq.yaml @getsentry/owners-snuba @getsentry/revenue /topics/snuba-metrics.yaml @getsentry/owners-snuba +/topics/snuba-ourlogs.yaml @getsentry/owners-snuba /topics/snuba-generic-metrics.yaml @getsentry/owners-snuba /topics/generic-events.yaml @getsentry/owners-snuba @getsentry/issues /topics/group-attributes.yaml @getsentry/owners-snuba @getsentry/issues diff --git a/examples/snuba-ourlogs/1/maximal_log.json b/examples/snuba-ourlogs/1/maximal_log.json new file mode 100644 index 00000000..f00e9712 --- /dev/null +++ b/examples/snuba-ourlogs/1/maximal_log.json @@ -0,0 +1,27 @@ +{ + "organization_id": 69, + "project_id": 1, + "trace_id": "3c8c20d5-0a54-4a1c-ba10-f76f574d856f", + "trace_flags": 255, + "span_id": "11002233AABBCCDD", + "severity_text": "WARNING", + "severity_number": 1, + "retention_days": 90, + "timestamp_nanos": 1715868485371000, + "observed_timestamp_nanos": 1715868485371000, + "body": "hello world!", + "attributes": { + "some.user.tag": { + "string_value": "hello" + }, + "another.user.tag": { + "int_value": 10 + }, + "double.user.tag": { + "double_value": -10.59 + }, + "bool.user.tag": { + "bool_value": true + } + } +} diff --git a/examples/snuba-ourlogs/1/minimal_log.json b/examples/snuba-ourlogs/1/minimal_log.json new file mode 100644 index 00000000..57a8208b --- /dev/null +++ b/examples/snuba-ourlogs/1/minimal_log.json @@ -0,0 +1,9 @@ +{ + "organization_id": 69, + "project_id": 1, + "received": 1715868485.381, + "retention_days": 90, + "timestamp_nanos": 1715868485371000, + "observed_timestamp_nanos": 1715868485371000, + "body": "hello world!" +} diff --git a/schemas/snuba-ourlogs.v1.schema.json b/schemas/snuba-ourlogs.v1.schema.json new file mode 100644 index 00000000..1a8a6c26 --- /dev/null +++ b/schemas/snuba-ourlogs.v1.schema.json @@ -0,0 +1,108 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ourlogs_stream_message", + "$ref": "#/definitions/OurlogEvent", + "definitions": { + "OurlogEvent": { + "type": "object", + "title": "ourlog_event", + "additionalProperties": true, + "properties": { + "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." + }, + "trace_flags": { + "$ref": "#/definitions/UInt8", + "description": "Flags are sent by OTEL clients, bitmask (e.g., SAMPLED)" + }, + "timestamp_nanos": { + "$ref": "#/definitions/UInt", + "description": "The timestamp of the log in nanoseconds since epoch." + }, + "retention_days": { + "$ref": "#/definitions/UInt16", + "description": "The minimum time we should store this log until it's deleted" + }, + "observed_timestamp_nanos": { + "$ref": "#/definitions/UInt", + "description": "Unix timestamp (in nanoseconds) when the log was received by Sentry." + }, + "body": { + "type": "string", + "description": "The body of the log." + }, + "severity_text": { + "type": "string", + "description": "The name of the severity level (e.g., WARNING)" + }, + "severity_number": { + "$ref": "#/definitions/UInt8", + "description": "Numerical value of the severity (1-24 in otel)" + }, + "attributes": { + "type": "object", + "description": "key-value tag pairs on this log", + "additionalProperties": { + "type": "object", + "properties": { + "string_value": { + "type": "string" + }, + "int_value": { + "type": "integer" + }, + "double_value": { + "type": "number" + }, + "bool_value": { + "type": "boolean" + } + }, + "additionalProperties": false, + "minProperties": 1, + "maxProperties": 1 + } + } + }, + "required": [ + "project_id", + "organization_id", + "observed_timestamp_nanos", + "retention_days", + "timestamp_nanos", + "body" + ] + }, + "UUID": { + "type": "string", + "minLength": 32, + "maxLength": 36 + }, + "SpanID": { + "type": "string", + "minLength": 16, + "maxLength": 16 + }, + "UInt": { + "type": "integer", + "minimum": 0 + }, + "UInt8": { + "type": "integer", + "minimum": 0, + "maximum": 255 + }, + "UInt16": { + "type": "integer", + "minimum": 0, + "maximum": 65535 + } + } +} diff --git a/topics/snuba-ourlogs.yaml b/topics/snuba-ourlogs.yaml new file mode 100644 index 00000000..fb2cf8fb --- /dev/null +++ b/topics/snuba-ourlogs.yaml @@ -0,0 +1,18 @@ +description: User-sent logs to us for our logging product, 'ourlogs' +services: + producers: + - getsentry/relay + consumers: + - getsentry/snuba +schemas: + - version: 1 + compatibility_mode: none + type: json + resource: snuba-ourlogs.v1.schema.json + examples: + - snuba-ourlogs/1/ +topic_creation_config: + compression.type: lz4 + retention.ms: "86400000" + max.message.bytes: "10000000" + message.timestamp.type: LogAppendTime