Skip to content

feat(telemetry): measure how long survivors are hunted - #318

Open
TheMeinerLP wants to merge 4 commits into
feat/telemetry-tick-metricsfrom
feat/telemetry-hunt-duration
Open

TheMeinerLP wants to merge 4 commits into
feat/telemetry-tick-metricsfrom
feat/telemetry-hunt-duration

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Proposed changes

Measures how long survivors are hunted by the creek: a span per hunt and a histogram/counter by outcome and map.

Depends on #310 and #317. This branch is based on #317 (tick metrics, which in turn is based on #316) with feat/creek-hunted-tab (#310) merged in, for the hunted/huntEnded hooks. Merge #316, #317 and #310 first, then rebase this onto main.

Change.

  • Span cygnus.action.creek.hunt, child of the current phase, from hunt start to end: cygnus.player.uuid, cygnus.player.role, start position, cygnus.map, cygnus.creek.hunt.outcome (caught|timeout|gone|escaped|round_end) and cygnus.creek.hunt.duration_ms.
  • Histogram cygnus.creek.hunt.duration (ms, like the tick metrics) and counter cygnus.creek.hunts, attributes cygnus.creek.hunt.outcome and cygnus.map only; no player on metrics.
  • The outcome comes from the creek instead of being guessed: new HuntEnd enum, HuntState.end() records catch/timeout/gone, and Creek reports CreekWitness.huntEnded(UUID, HuntEnd) (a default method that falls back to huntEnded(UUID), so existing witnesses are unchanged). SENT_AWAY maps to escaped, REMOVED to round_end. HuntedTabWitness and TracingCreekWitness forward the new method. The catch callback fires just before the hunt ends, which is why the reason is read from the state, not paired up from two callbacks.
  • Hunts still open when a round ends are closed as round_end by a new RoundTracer.onRoundEnding hook, before the phase span closes. A hunt with no round running has no span but is counted.
  • Durations use an injected Clock. The creek reports hunts by survivor only, so two creeks on one survivor give two spans that close oldest first (documented).
  • docs/telemetry.md: hunts section.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Test plan.

  • HuntTracerTest: span outcome and duration for every end path, attributes and parent phase, histogram with outcome and map, no player on metrics, round end closes open hunts before the phase, two hunts on one survivor, cached attributes.
  • HuntStateEndTest: caught, timeout, gone and running.
  • CreekIntegrationTest: Creek reports the right HuntEnd for catch, timeout, gone, removed and sent away.
  • ./gradlew :game:test :common:test is green.

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