Skip to content

Add server-wide tags from plugins/trace/config.yml; 0.3.0 - #4

Merged
dmccoystephenson merged 1 commit into
mainfrom
feat/server-wide-tags
Sep 28, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feat/server-wide-tags

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

A tags: block is added to the server-wide switch file plugins/trace/config.yml. Every event any plugin on the server reports gets those tags merged in, so an automated test server can mark its events with ci=true and the trace server leaves them out of real-installation figures (ci is one of the public view's excluded tags).

enabled: true
tags:
  ci: "true"
  • tags: at column 0, then indented key: value lines; values double-quoted, single-quoted or bare; blank and # lines skipped; the block ends at the next unindented non-blank line or EOF. Lines indented differently from the first entry are ignored, and an enabled: entry inside the block is a tag, not the switch.
  • An event's own tag always wins on a key conflict (version/name are never overwritten).
  • Validation mirrors MetricDto: keys must match [A-Za-z0-9][A-Za-z0-9_.-]*, keys and values are at most 255 characters, at most 32 server-wide tags are read, and server-wide tags stop being added once the event carries 32 in total. Invalid entries are dropped one at a time; malformed content (including non-UTF-8 bytes) never throws and never disables reporting.
  • Tags are read once in build(), at the same moment as enabled:; enabled: false still wins.
  • SERVER_WIDE_CONFIG_CONTENT gains a commented-out example after enabled: true, so a freshly created file adds no tags.
  • Version 0.3.0: header comment, new VERSION constant (used for the User-Agent), pom.xml, README JitPack snippet. The README documents the block under a new "Server-wide tags" section. Single file, no new dependencies, Java 8 source level.

Tests

13 new tests in TraceClientTest (loopback HttpServer, injectable environment): merge into the JSON body, event tag wins, quoted/bare values, comments/blank lines, block termination, invalid keys/overlong values dropped, the MAX_TAGS cap, enabled: false still disabling, no file / no tags, fresh file has no active tags, malformed and non-UTF-8 files. Two existing tests were updated for the longer created-file content.

mvn -B verify passes locally on JDK 17, 21 and 11 (42 tests, 0 failures); JDK 8 is covered by CI. Mutation probes (event-wins, cap, value length, block termination) each fail a test.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

A `tags:` block in the server-wide config is merged into every event
every plugin on the server reports, so a test or CI server can mark
itself with `ci: "true"`. The event's own tag wins on a conflict;
entries the trace server would reject are dropped and the merge is
capped at MAX_TAGS; malformed content never throws or disables
reporting. Read once at build(), alongside `enabled:`, which still
wins. A freshly created file carries the example commented out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Qot8ZBn7NPiiqmjAWpGY5
@dmccoystephenson
dmccoystephenson merged commit a7fe367 into main Sep 28, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feat/server-wide-tags branch September 28, 2026 00:52
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