Add telemetry benchamark setup - #7
Merged
Merged
Conversation
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
| export BENCHMARK_WORKLOAD="${BENCHMARK_WORKLOAD:-large-read}" | ||
| export DOCUMENTDB_IMAGE="${DOCUMENTDB_IMAGE:-ghcr.io/documentdb/documentdb/documentdb-local:trace-4fbbfcb8}" | ||
| export OTEL_COLLECTOR_CONFIG_FILE="${OTEL_COLLECTOR_CONFIG_FILE:-./otel-collector-benchmark.yaml}" | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT="${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:${OTEL_COLLECTOR_GRPC_PORT:-4317}}" |
Contributor
There was a problem hiding this comment.
benchmark.sh does not load the shared telemetry .env. up.sh applies custom ports and credentials only in its child process, while the adapter and analyzer retain defaults. Please source TELEMETRY_ENV_FILE before deriving the endpoints.
| if not child_of(gateway, application.get("spanID")): | ||
| excluded["unexpected_parent_relationship"] += 1 | ||
| continue | ||
| postgres = [ |
Contributor
There was a problem hiding this comment.
The analyzer verifies the application-to-gateway link, but then includes every postgres.execute span in the trace. Retries or multi-command operations can mix branches and skew the metrics. Please restrict these spans to descendants of the selected gateway request.
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
udsmicrosoft
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a pluggable local latency benchmark for DocumentDB
Builds on the shared gateway tracing demo (#5) to add a repeatable, driver-agnostic latency benchmark that measures client, gateway, and PostgreSQL time for the same workload — with and without tracing — and decomposes connected traces from Jaeger.
What this adds
playgrounds/benchmarks/local-latency/— shared orchestration that is not tied to any driver:benchmark.sh— runs a baseline (untraced) and a traced phase, drives the shared telemetry stack, and writes durable artifacts per experiment.analyze_jaeger.py— pulls connected traces from Jaeger, filters bybenchmark.id, validates the app →gateway.request→postgres.executeparent chain, and computes per-hop percentiles.adapters/mongoose.sh— the first driver adapter (process-invoked; no app-code imports).schemas/adapter-result.schema.json— the contract every adapter must satisfy.test_analyze_jaeger.py— unit tests for percentiles, interval-union math, and trace-completeness gating.playgrounds/mongoose/app/benchmark.js— the Mongoose-native workload (deterministic seed doc, bounded concurrency, monotonic timing, BSON-sized$inquery, client spans withbenchmark.*attributes).shared/telemetry/otel-collector-benchmark.yaml— a Collector profile without the debug exporter so high-volume runs aren't distorted;compose.yamlselects it viaOTEL_COLLECTOR_CONFIG_FILE.telemetry.jsso client spans can carry benchmark attributes.How it works
Each run measures the same operation twice and stores everything under
results/<experiment-id>/:baseline.json/traced.jsontrace-analysis.jsontrace-segments.csvsummary.mdexperiment.jsonReported hops: full client operation, client/transport outside gateway, gateway total, PostgreSQL (sum and interval union), and gateway residual. The analyzer waits until every successful operation has a complete app → gateway → PostgreSQL trace and fails rather than reporting partial statistics.
Measurement caveats (documented in the README)
client_outside_gatewayis the clock-robust combined measure (driver, pool wait, serialization, TLS, both network directions, response decoding).Usage
Defaults to the published tracing image (
ghcr.io/documentdb/documentdb/documentdb-local:trace-4fbbfcb8). Override operations, warm-up, concurrency, and query size viaBENCHMARK_*env vars. Adding another driver only requires a newadapters/<name>.shplus a driver-native workload that emits client spans and injects W3C context into the commandcomment.Testing
Notes
results/are git-ignored.