Skip to content

Commit fd55389

Browse files
authored
feat: add schemas for ourlogs (#367)
* feat: add schemas for ourlogs * make it more otely * Add a topic * change topic * fix flags * CODEOWNERS * otel-style attributes
1 parent 614026b commit fd55389

File tree

5 files changed

+163
-0
lines changed

5 files changed

+163
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
/topics/outcomes-billing.yaml @getsentry/owners-snuba @getsentry/revenue
3333
/topics/outcomes-billing-dlq.yaml @getsentry/owners-snuba @getsentry/revenue
3434
/topics/snuba-metrics.yaml @getsentry/owners-snuba
35+
/topics/snuba-ourlogs.yaml @getsentry/owners-snuba
3536
/topics/snuba-generic-metrics.yaml @getsentry/owners-snuba
3637
/topics/generic-events.yaml @getsentry/owners-snuba @getsentry/issues
3738
/topics/group-attributes.yaml @getsentry/owners-snuba @getsentry/issues
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"organization_id": 69,
3+
"project_id": 1,
4+
"trace_id": "3c8c20d5-0a54-4a1c-ba10-f76f574d856f",
5+
"trace_flags": 255,
6+
"span_id": "11002233AABBCCDD",
7+
"severity_text": "WARNING",
8+
"severity_number": 1,
9+
"retention_days": 90,
10+
"timestamp_nanos": 1715868485371000,
11+
"observed_timestamp_nanos": 1715868485371000,
12+
"body": "hello world!",
13+
"attributes": {
14+
"some.user.tag": {
15+
"string_value": "hello"
16+
},
17+
"another.user.tag": {
18+
"int_value": 10
19+
},
20+
"double.user.tag": {
21+
"double_value": -10.59
22+
},
23+
"bool.user.tag": {
24+
"bool_value": true
25+
}
26+
}
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"organization_id": 69,
3+
"project_id": 1,
4+
"received": 1715868485.381,
5+
"retention_days": 90,
6+
"timestamp_nanos": 1715868485371000,
7+
"observed_timestamp_nanos": 1715868485371000,
8+
"body": "hello world!"
9+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "ourlogs_stream_message",
4+
"$ref": "#/definitions/OurlogEvent",
5+
"definitions": {
6+
"OurlogEvent": {
7+
"type": "object",
8+
"title": "ourlog_event",
9+
"additionalProperties": true,
10+
"properties": {
11+
"organization_id": {
12+
"$ref": "#/definitions/UInt"
13+
},
14+
"project_id": {
15+
"$ref": "#/definitions/UInt"
16+
},
17+
"trace_id": {
18+
"$ref": "#/definitions/UUID",
19+
"description": "The trace ID is a unique identifier for a trace."
20+
},
21+
"trace_flags": {
22+
"$ref": "#/definitions/UInt8",
23+
"description": "Flags are sent by OTEL clients, bitmask (e.g., SAMPLED)"
24+
},
25+
"timestamp_nanos": {
26+
"$ref": "#/definitions/UInt",
27+
"description": "The timestamp of the log in nanoseconds since epoch."
28+
},
29+
"retention_days": {
30+
"$ref": "#/definitions/UInt16",
31+
"description": "The minimum time we should store this log until it's deleted"
32+
},
33+
"observed_timestamp_nanos": {
34+
"$ref": "#/definitions/UInt",
35+
"description": "Unix timestamp (in nanoseconds) when the log was received by Sentry."
36+
},
37+
"body": {
38+
"type": "string",
39+
"description": "The body of the log."
40+
},
41+
"severity_text": {
42+
"type": "string",
43+
"description": "The name of the severity level (e.g., WARNING)"
44+
},
45+
"severity_number": {
46+
"$ref": "#/definitions/UInt8",
47+
"description": "Numerical value of the severity (1-24 in otel)"
48+
},
49+
"attributes": {
50+
"type": "object",
51+
"description": "key-value tag pairs on this log",
52+
"additionalProperties": {
53+
"type": "object",
54+
"properties": {
55+
"string_value": {
56+
"type": "string"
57+
},
58+
"int_value": {
59+
"type": "integer"
60+
},
61+
"double_value": {
62+
"type": "number"
63+
},
64+
"bool_value": {
65+
"type": "boolean"
66+
}
67+
},
68+
"additionalProperties": false,
69+
"minProperties": 1,
70+
"maxProperties": 1
71+
}
72+
}
73+
},
74+
"required": [
75+
"project_id",
76+
"organization_id",
77+
"observed_timestamp_nanos",
78+
"retention_days",
79+
"timestamp_nanos",
80+
"body"
81+
]
82+
},
83+
"UUID": {
84+
"type": "string",
85+
"minLength": 32,
86+
"maxLength": 36
87+
},
88+
"SpanID": {
89+
"type": "string",
90+
"minLength": 16,
91+
"maxLength": 16
92+
},
93+
"UInt": {
94+
"type": "integer",
95+
"minimum": 0
96+
},
97+
"UInt8": {
98+
"type": "integer",
99+
"minimum": 0,
100+
"maximum": 255
101+
},
102+
"UInt16": {
103+
"type": "integer",
104+
"minimum": 0,
105+
"maximum": 65535
106+
}
107+
}
108+
}

topics/snuba-ourlogs.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
description: User-sent logs to us for our logging product, 'ourlogs'
2+
services:
3+
producers:
4+
- getsentry/relay
5+
consumers:
6+
- getsentry/snuba
7+
schemas:
8+
- version: 1
9+
compatibility_mode: none
10+
type: json
11+
resource: snuba-ourlogs.v1.schema.json
12+
examples:
13+
- snuba-ourlogs/1/
14+
topic_creation_config:
15+
compression.type: lz4
16+
retention.ms: "86400000"
17+
max.message.bytes: "10000000"
18+
message.timestamp.type: LogAppendTime

0 commit comments

Comments
 (0)