Skip to content

fix(agent): make telemetry explicitly opt-in#894

Merged
jbachorik merged 6 commits into
developfrom
agent/issue-873-telemetry
Jul 13, 2026
Merged

fix(agent): make telemetry explicitly opt-in#894
jbachorik merged 6 commits into
developfrom
agent/issue-873-telemetry

Conversation

@jbachorik

@jbachorik jbachorik commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • disable agent telemetry unless the operator explicitly opts in
  • add the telemetry=true|false agent argument with agent-argument precedence over the legacy target-JVM property
  • add a transport seam proving the default path creates no telemetry work and opt-in attempts exactly one event
  • document the endpoint, event fields, privacy boundary, timeouts, and failure behavior

Why

The agent previously treated telemetry as enabled when btrace.telemetry was absent, so normal startup created daemon threads and could perform DNS and HTTP work from inside the target JVM without operator consent. That default is inappropriate for production diagnostics and contradicts the security policy established by #872.

Consent is now evaluated before payload construction or thread creation. Only a literal boolean true from the agent argument, an explicit packaged agent default, or the legacy system property enables telemetry. An explicit agent-level false wins over the property.

User impact

Default agent startup performs no telemetry-related DNS or network operation. Operators who opt in get one attempted agent_start event; endpoint or thread-start failures remain isolated from agent startup. The event continues to use a fresh random identifier and does not add stable host identity or application data.

Validation

  • GRADLE_USER_HOME=$(pwd)/.gradle-user ./gradlew :btrace-agent:test --tests 'io.btrace.agent.TelemetryTest'
  • GRADLE_USER_HOME=$(pwd)/.gradle-user ./gradlew :btrace-agent:test
  • GRADLE_USER_HOME=$(pwd)/.gradle-user ./gradlew spotlessCheck
  • git diff --check
  • adversarial review of consent precedence, default thread/transport behavior, endpoint failure, timeout claims, and test isolation

The focused tests and full agent suite passed with a temporary, uncommitted restoration of btrace-agent's JUnit pin to 5.14.4. Current develop commit f8cdc5de accidentally pins JUnit 6.1.2 while compiling tests with JDK 8, so the unmodified baseline cannot resolve testCompileClasspath. This PR intentionally does not mix that unrelated build regression into the telemetry diff.

Stack

Closes #873


This change is Reviewable

Base automatically changed from agent/issue-872-policy to develop July 13, 2026 20:41
@jbachorik jbachorik marked this pull request as ready for review July 13, 2026 20:42
@jbachorik

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in fdb292e.

@jbachorik jbachorik merged commit 1ab2f04 into develop Jul 13, 2026
15 checks passed
@jbachorik jbachorik deleted the agent/issue-873-telemetry branch July 13, 2026 20:58
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.

[3.0] Make agent telemetry explicitly opt-in

2 participants