Skip to content

Commit c0804bc

Browse files
committed
Fixes and enable rust for all e2e tests
1 parent c816406 commit c0804bc

18 files changed

Lines changed: 37 additions & 12 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
env:
104104
DOCKER_DEFAULT_PLATFORM: linux/amd64
105105
TUSK_CLI_VERSION: ${{ steps.tusk-version.outputs.version }}
106+
TUSK_USE_RUST_CORE: "1"
106107
run: |
107108
chmod +x ./drift/instrumentation/${{ matrix.library }}/e2e-tests/run.sh
108109
cd ./drift/instrumentation/${{ matrix.library }}/e2e-tests && ./run.sh 8000
@@ -180,6 +181,7 @@ jobs:
180181
env:
181182
DOCKER_DEFAULT_PLATFORM: linux/amd64
182183
TUSK_CLI_VERSION: ${{ steps.tusk-version.outputs.version }}
184+
TUSK_USE_RUST_CORE: "1"
183185
run: |
184186
chmod +x ./drift/stack-tests/${{ matrix.test }}/run.sh
185187
cd ./drift/stack-tests/${{ matrix.test }} && ./run.sh 8000

drift/core/json_schema_helper.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,23 @@ def generate_schema_and_hash(data: Any, schema_merges: SchemaMerges | None = Non
160160

161161
decoded = JsonSchemaHelper._decode_with_merges(normalized, schema_merges)
162162
rust_decoded_hash = deterministic_hash_jsonable(decoded)
163-
decoded_value_hash = rust_decoded_hash or JsonSchemaHelper.generate_deterministic_hash(decoded)
163+
if rust_decoded_hash is not None:
164+
decoded_value_hash = rust_decoded_hash
165+
else:
166+
sorted_decoded = JsonSchemaHelper._sort_object_keys(decoded)
167+
payload = json.dumps(sorted_decoded, ensure_ascii=False, separators=(",", ":"))
168+
decoded_value_hash = hashlib.sha256(payload.encode("utf-8")).hexdigest()
164169

165170
schema = JsonSchemaHelper.generate_schema(decoded, schema_merges)
166171

167172
schema_primitive = schema.to_primitive()
168173
rust_schema_hash = deterministic_hash_jsonable(schema_primitive)
169-
decoded_schema_hash = rust_schema_hash or JsonSchemaHelper.generate_deterministic_hash(schema_primitive)
174+
if rust_schema_hash is not None:
175+
decoded_schema_hash = rust_schema_hash
176+
else:
177+
sorted_schema = JsonSchemaHelper._sort_object_keys(schema_primitive)
178+
payload = json.dumps(sorted_schema, ensure_ascii=False, separators=(",", ":"))
179+
decoded_schema_hash = hashlib.sha256(payload.encode("utf-8")).hexdigest()
170180
return SchemaComputationResult(
171181
schema=schema,
172182
decoded_value_hash=decoded_value_hash,

drift/core/span_serialization.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from collections.abc import Mapping
56
from datetime import datetime, timedelta, timezone
67
from typing import Any
78

@@ -178,4 +179,7 @@ def _metadata_to_dict(metadata: Any) -> dict[str, Any]:
178179
if metadata is None:
179180
return {}
180181

182+
if isinstance(metadata, Mapping):
183+
return {str(key): value for key, value in metadata.items() if value is not None}
184+
181185
return {key: value for key, value in metadata.__dict__.items() if value is not None}

drift/core/tracing/otel_converter.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -455,16 +455,11 @@ def otel_span_to_clean_span_data(
455455
output_value_proto_struct_bytes=output_proto_bytes,
456456
)
457457

458-
# Avoid expensive schema object tree conversion when we already have prebuilt
459-
# full Span bytes from Rust; those schema objects would not be used on hot path.
460-
from ..json_schema_helper import JsonSchema
461-
462-
if span_proto_bytes is not None:
463-
input_schema_obj = JsonSchema()
464-
output_schema_obj = JsonSchema()
465-
else:
466-
input_schema_obj = dict_to_json_schema(input_schema)
467-
output_schema_obj = dict_to_json_schema(output_schema)
458+
# Keep schema objects populated for all export paths (API + filesystem).
459+
# Even when Rust prebuilds Span bytes for API export, other sinks still
460+
# serialize from `CleanSpanData` fields.
461+
input_schema_obj = dict_to_json_schema(input_schema)
462+
output_schema_obj = dict_to_json_schema(output_schema)
468463

469464
# Build CleanSpanData (note: no input_schema_merges or output_schema_merges fields)
470465
return CleanSpanData(

drift/instrumentation/aiohttp/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
- PORT=8000
1010
- TUSK_ANALYTICS_DISABLED=1
1111
- PYTHONUNBUFFERED=1
12+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
1213
- BENCHMARKS=${BENCHMARKS:-}
1314
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
1415
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

drift/instrumentation/grpc/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
- PORT=8000
1010
- TUSK_ANALYTICS_DISABLED=1
1111
- PYTHONUNBUFFERED=1
12+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
1213
- BENCHMARKS=${BENCHMARKS:-}
1314
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
1415
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

drift/instrumentation/httpx/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
- PORT=8000
1010
- TUSK_ANALYTICS_DISABLED=1
1111
- PYTHONUNBUFFERED=1
12+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
1213
- BENCHMARKS=${BENCHMARKS:-}
1314
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
1415
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

drift/instrumentation/psycopg/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ services:
2929
- POSTGRES_PASSWORD=testpass
3030
- TUSK_ANALYTICS_DISABLED=1
3131
- PYTHONUNBUFFERED=1
32+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
3233
- BENCHMARKS=${BENCHMARKS:-}
3334
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
3435
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

drift/instrumentation/psycopg2/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ services:
2929
- POSTGRES_PASSWORD=testpass
3030
- TUSK_ANALYTICS_DISABLED=1
3131
- PYTHONUNBUFFERED=1
32+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
3233
- BENCHMARKS=${BENCHMARKS:-}
3334
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
3435
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

drift/instrumentation/redis/e2e-tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ services:
2222
- REDIS_PORT=6379
2323
- TUSK_ANALYTICS_DISABLED=1
2424
- PYTHONUNBUFFERED=1
25+
- TUSK_USE_RUST_CORE=${TUSK_USE_RUST_CORE:-0}
2526
- BENCHMARKS=${BENCHMARKS:-}
2627
- BENCHMARK_DURATION=${BENCHMARK_DURATION:-10}
2728
- BENCHMARK_WARMUP=${BENCHMARK_WARMUP:-3}

0 commit comments

Comments
 (0)