From bbad360307711b4e2840615d46760d9b1adc6a5e Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Fri, 6 Oct 2023 12:39:27 -0400 Subject: [PATCH 1/2] fix(spans): Fix snuba-spans example --- examples/snuba-spans/1/basic_span.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/snuba-spans/1/basic_span.json b/examples/snuba-spans/1/basic_span.json index 5338e41f..6c7ba9db 100644 --- a/examples/snuba-spans/1/basic_span.json +++ b/examples/snuba-spans/1/basic_span.json @@ -7,7 +7,7 @@ "parent_span_id": "deadbeefdeadbeef", "segment_id": "deadbeefdeadbeef", "group_raw": "b640a0ce465fa2a4", - "profile_id": "deadbeefdeadbeef", + "profile_id": "deadbeefdeadbeefdeadbeefdeadbeef", "is_segment": false, "start_timestamp_ms": 1691105878720, "duration_ms": 1000, From f0d6c7d0dfc2f31d83761736cb86cf9369f7b73b Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Fri, 6 Oct 2023 12:59:01 -0400 Subject: [PATCH 2/2] Add a length check for UUID fields --- examples/ingest-spans/1/valid_span.json | 2 +- schemas/ingest-spans.v1.schema.json | 11 +++++-- schemas/snuba-spans.v1.schema.json | 38 ++++++++++++++----------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/examples/ingest-spans/1/valid_span.json b/examples/ingest-spans/1/valid_span.json index b2f0d748..eb3ecc83 100644 --- a/examples/ingest-spans/1/valid_span.json +++ b/examples/ingest-spans/1/valid_span.json @@ -7,7 +7,7 @@ "exclusive_time": 1000.1, "is_segment": false, "parent_span_id": "deadbeefdeadbeef", - "profile_id": "deadbeefdeadbeef", + "profile_id": "deadbeefdeadbeefdeadbeefdeadbeef", "segment_id": "deadbeefdeadbeef", "sentry_tags": { "action": "GET", diff --git a/schemas/ingest-spans.v1.schema.json b/schemas/ingest-spans.v1.schema.json index 74b2c82a..6c04a580 100644 --- a/schemas/ingest-spans.v1.schema.json +++ b/schemas/ingest-spans.v1.schema.json @@ -4,7 +4,7 @@ "title": "ingest_span_message", "properties": { "event_id": { - "type": "string" + "$ref": "#/definitions/UUID" }, "organization_id": { "type": "integer" @@ -42,7 +42,7 @@ "type": "string" }, "profile_id": { - "type": "string" + "$ref": "#/definitions/UUID" }, "segment_id": { "type": "string" @@ -72,10 +72,15 @@ "type": "number" }, "trace_id": { - "type": "string" + "$ref": "#/definitions/UUID" } }, "required": ["start_timestamp", "timestamp", "trace_id"] + }, + "UUID": { + "type": "string", + "minLength": 32, + "maxLength": 36 } } } diff --git a/schemas/snuba-spans.v1.schema.json b/schemas/snuba-spans.v1.schema.json index e14b7f6e..2202e0f8 100644 --- a/schemas/snuba-spans.v1.schema.json +++ b/schemas/snuba-spans.v1.schema.json @@ -9,7 +9,7 @@ "additionalProperties": true, "properties": { "event_id": { - "type": "string" + "$ref": "#/definitions/UUID" }, "organization_id": { "type": "integer" @@ -18,7 +18,7 @@ "type": "integer" }, "trace_id": { - "type": "string", + "$ref": "#/definitions/UUID", "description": "The trace ID is a unique identifier for a trace. It is a 16 byte hexadecimal string." }, "span_id": { @@ -38,7 +38,7 @@ "description": "The raw group ID has from the root transaction. It is an 8 byte hexadecimal string." }, "profile_id": { - "type": "string", + "$ref": "#/definitions/UUID", "description": "The profile ID. It is an 8 byte hexadecimal string." }, "is_segment": { @@ -99,41 +99,40 @@ "type": "object", "properties": { "http.method": { - "type": ["string"] + "type": "string" }, "action": { - "type": ["string"] + "type": "string" }, "domain": { - "type": ["string"] + "type": "string" }, "module": { - "type": ["string"] + "type": "string" }, "group": { - "type": ["string"], - "description": "8 byte hexadecimal string" + "type": "string" }, "system": { - "type": ["string"] + "type": "string" }, "status": { - "type": ["string"] + "type": "string" }, "status_code": { - "type": ["string"] + "type": "string" }, "transaction": { - "type": ["string"] + "type": "string" }, "transaction.op": { - "type": ["string"] + "type": "string" }, "op": { - "type": ["string"] + "type": "string" }, "transaction.method": { - "type": ["string"] + "type": "string" } }, "additionalProperties": true @@ -141,7 +140,12 @@ ] }, "TagValue": { - "type": ["string"] + "type": "string" + }, + "UUID": { + "type": "string", + "minLength": 32, + "maxLength": 36 } } }