Skip to content

Modernize OTel semantic conventions, add diverse API endpoints, and fix trace ID uniqueness#112

Open
manojhosk wants to merge 3 commits intocisco-open:masterfrom
manojhosk:feature/dev/add_api_options
Open

Modernize OTel semantic conventions, add diverse API endpoints, and fix trace ID uniqueness#112
manojhosk wants to merge 3 commits intocisco-open:masterfrom
manojhosk:feature/dev/add_api_options

Conversation

@manojhosk
Copy link
Copy Markdown

Summary

This PR modernizes the test-telemetry-generator to align with the latest OpenTelemetry semantic conventions, adds configurable diverse API endpoint generation, fixes a trace/span ID uniqueness bug, and improves load generation configurability.

Changes

1. Update to latest OTel semantic conventions

All example definition files (simple, demo, QA, JSON) have been updated to use current stable attribute names:

HTTP attributes:

  • http.methodhttp.request.method
  • http.targeturl.path
  • http.schemeurl.scheme
  • net.host.nameserver.address
  • http.client_ipclient.address
  • Added: http.route, http.response.status_code, server.port, network.protocol.version

Database attributes:

  • db.systemdb.system.name
  • db.operationdb.operation.name
  • net.peer.ipnetwork.peer.address
  • net.peer.nameserver.address
  • Added: db.namespace, db.collection.name, network.peer.port

Messaging attributes:

  • messaging.backend.topicmessaging.destination.name

Resource attributes:

  • http.hostserver.address
  • http.portserver.port

2. Add diverse API endpoint generation via roundRobin

Expanded roundRobin lists to 20 entries across HTTP methods (GET, POST, PUT, DELETE), URL paths, routes, DB operations, and collection names. This enables realistic load testing with diverse API traffic patterns without any code changes — just edit the YAML lists.

3. Fix trace structure for inter-service calls (demo)

Restructured the demo trace definition to include proper SPAN_KIND_CLIENT / SPAN_KIND_SERVER span pairs for inter-service communication (frontend → checkout → email/currency), with url.full on client spans and url.path on server spans per OTel spec.

4. Fix trace/span ID uniqueness bug

Fixed a bug in SpansGenerator.java where Protobuf Span.Builder objects were mutated in-place, causing all copies within a payload cycle to share the same trace and span IDs. The fix clones the builder for each copy.

5. Configurable load generation rate

  • Added payloadCount, copyCount, and payloadFrequencySeconds to all example trace definitions with inline documentation explaining the formula:
    • Traces/sec = copyCount / payloadFrequencySeconds
    • Total traces = payloadCount × copyCount
    • Duration = payloadCount × payloadFrequencySeconds
  • Lowered minimum payloadFrequencySeconds from 15s to 1s in RootSpanDefinition.java
  • Default config: 5 traces every 10 seconds, 150 total traces, 5-minute run

6. Improve error messages

Extracted hardcoded threshold into a variable and fixed missing spaces and unit suffixes in validation error messages for payloadFrequencySeconds.

Files changed (9 files)

File Change
example-definitions/simple/trace-definition.yaml Updated semconv, added roundRobin entries, rate control
example-definitions/demo/trace-definition.yaml Updated semconv, restructured with CLIENT/SERVER pairs, rate control
example-definitions/qa/trace-definition.yaml Updated messaging attribute
example-definitions/simple/resource-definition.yaml Updated resource attributes
example-definitions/qa/resource-definition.yaml Updated resource attributes
example-definitions/json/trace-definition.json Mirrored demo YAML changes
example-definitions/json/resource-definition.json Updated resource attributes
src/.../traces/SpansGenerator.java Fixed span ID uniqueness via builder cloning
src/.../traces/dto/RootSpanDefinition.java Lowered min frequency, improved error messages

Test plan

  • Build passes: `./gradlew clean build fat

Manoj Hoskeri added 3 commits March 10, 2026 15:28
…and add diverse API endpoints

- Migrate all example definitions from deprecated OTel attribute names to
  current stable semantic conventions (http.method -> http.request.method,
  net.host.name -> server.address, db.system -> db.system.name, etc.)
- Restructure demo trace with proper CLIENT + SERVER span pairs for each
  inter-service call, using url.full for client spans and url.path for
  server spans per OTel spec
- Fix trace ID uniqueness bug in SpansGenerator where all copies within a
  payload shared the same trace/span IDs due to mutable protobuf builder
  reuse; each copy now gets its own IDs via clone()
- Lower minimum payloadFrequencySeconds from 15s to 1s to support higher
  throughput load testing scenarios
- Expand API endpoint variety to 20 unique routes with GET/POST/PUT/DELETE
  methods across all example definitions
- Add payloadFrequencySeconds with rate control documentation to simple
  and demo definitions, defaulting to 5 minutes runtime at 5 traces/sec
Reduce trace generation rate to 5 traces every 10 seconds (0.5 traces/sec)
for both simple and demo definitions, keeping the 5-minute total runtime.

Made-with: Cursor
Extract minimum payload frequency into a variable so the error message
reflects the actual configured threshold. Also fix missing spaces and
add unit suffixes for clarity.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant