Skip to content

Add a temporary seeded scenario generator receiver - #24

Merged
zzylol merged 1 commit into
mainfrom
feat/scenario-generator
Oct 19, 2026
Merged

zzylol merged 1 commit into
mainfrom
feat/scenario-generator

Conversation

@zzylol

@zzylol zzylol commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Part 2 of the telemetry-functions stack.

The official OpenTelemetry traffic generator cannot yet shape attribute cardinality, key popularity or value distributions, or change them over time: synthetic mode uses fixed value pools, and semantic_conventions mode sends every metric value as 1.0 (its TODO: "add configurable value range, distribution"). These options are planned upstream. Until then, this receiver stands in, with a config shaped like the upstream proposal so it can be swapped out.

What it does

urn:asap:receiver:scenario_generator sends Gauge points at signals_per_second, in max_batch_size batches spread evenly over each second, with the official generator's control handling.

config:
  seed: 1
  signals_per_second: 20000
  metric_name: http.server.request.duration
  attributes:
    - {key: http.route, cardinality: 200, zipf: 1.1}
    - {key: user.id, unique: true}
    - {key: k8s.pod.name, cardinality: 50, growth_per_minute: 0.05}
  value: {lognormal: {median: 50.0, sigma: 0.6}}
  changes:
    - {after_seconds: 600, attribute: http.route, equals: http.route-3,
       value: {lognormal: {median: 150.0, sigma: 0.6}}}
    - {after_seconds: 600, attribute: http.route, inject: /new/hot-route, share: 0.15}

Values are seeded, so a seed and config reproduce the same stream. Unique values include the seed, so two sources never share them.

The points depend only on scenario time. Batch i of the n batches of second s after the scenario start is sent at s + i/n seconds, stamped with that time, and drawn from an RNG seeded by (seed, s, i). The start is the Unix second in ASAP_SCENARIO_START (the next whole second when unset), and changes count from it. Generators with the same config and start therefore send identical points even if they start a little apart; a generator that falls behind skips batches rather than shifting later ones. This is what lets #25 feed three separate pipelines the same input.

Validation

Unit tests cover cardinality (fixed and unique), Zipf skew, changes after their time, reproducibility, and that a batch depends only on its second and index. cargo fmt --check, cargo clippy --all-targets --features otap-engine,stream-benchmark -- -D warnings and cargo test --features otap-engine,stream-benchmark pass at this PR's head.

@zzylol
zzylol force-pushed the feat/scenario-generator branch from 2059d27 to dac5fa3 Compare October 13, 2026 00:20
@zzylol
zzylol force-pushed the refactor/asapv1-only branch from 2bd3e0c to 974b425 Compare October 13, 2026 00:20
@zzylol
zzylol force-pushed the feat/scenario-generator branch from dac5fa3 to c5ff0ac Compare October 19, 2026 14:57
@zzylol
zzylol force-pushed the refactor/asapv1-only branch from 974b425 to ddfc22e Compare October 19, 2026 17:33
@zzylol
zzylol force-pushed the feat/scenario-generator branch from c5ff0ac to 454ac55 Compare October 19, 2026 17:33
@zzylol
zzylol force-pushed the refactor/asapv1-only branch from ddfc22e to cff741c Compare October 19, 2026 20:15
@zzylol
zzylol force-pushed the feat/scenario-generator branch 2 times, most recently from 0a710be to 994214d Compare October 19, 2026 20:16
@zzylol
zzylol force-pushed the refactor/asapv1-only branch from cff741c to 143d4a5 Compare October 19, 2026 20:16
urn:asap:receiver:scenario_generator sends Gauge points whose attribute
cardinality (fixed, unique per source, growing), key popularity (uniform or
Zipf) and value distribution follow a config, with changes at set times: a
drifting series or a new heavy key. It stands in until the official OTAP
traffic generator gains these options.

The points depend only on scenario time: batch i of second s is sent at
s + i/n seconds, stamped with that time, from an RNG seeded by (seed, s, i).
Generators with the same config and start (ASAP_SCENARIO_START) send
identical data, so several pipelines can be fed the same input.
@zzylol
zzylol force-pushed the feat/scenario-generator branch from 994214d to 46f7092 Compare October 19, 2026 20:16
@zzylol
zzylol changed the base branch from refactor/asapv1-only to main October 19, 2026 20:16
@zzylol
zzylol merged commit b5a9d26 into main Oct 19, 2026
@zzylol
zzylol deleted the feat/scenario-generator branch October 19, 2026 20:20
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