Skip to content

fix(otel): only detect otel-collector service names, as documented - #1471

Merged
stokpop merged 1 commit into
cloudfoundry:mainfrom
stokpop:fix-otel-detect-broad-name
Oct 21, 2026
Merged

stokpop merged 1 commit into
cloudfoundry:mainfrom
stokpop:fix-otel-detect-broad-name

Conversation

@stokpop

@stokpop stokpop commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Problem

The OpenTelemetry Javaagent framework is detected for any bound service whose name contains otel (case-insensitive substring match), for example:

  • a Splunk service named splunk-otel -> both the Splunk OTel agent and the generic OpenTelemetry agent are installed in the same JVM:
    Installing frameworks [..., OpenTelemetry Javaagent, Splunk OTEL]
  • an unrelated database named hotel-db -> the OpenTelemetry agent is installed

Found while reviewing #1360 (Elastic OTel agent): in a manual staging test, a Splunk binding named splunk-otel also installed the generic OpenTelemetry agent. A service named elastic-otel would trigger the same.

Why

The documentation says the bound service "MUST contain the string otel-collector", and the Ruby buildpack (v4) used /otel-collector/. The extra HasServiceByNamePattern("otel") came in with the Go rewrite (#1217) and is wider than documented.

Change

  • Drop the bare otel name pattern. Detection still works via:
    • name containing otel-collector (as documented and as in v4)
    • label otel-collector or opentelemetry
    • tag otel, otel-collector or opentelemetry
  • Unit tests: splunk-otel and hotel-db are not detected (replaces the test that expected my-otel-sidecar to be detected).
  • Integration tests: my-otel-service -> my-otel-collector; both Splunk tests assert the OpenTelemetry Javaagent is not installed.

Migration

Apps that rely on a service name containing only otel can rename the service to contain otel-collector, or add the otel tag (cf update-user-provided-service <name> -t otel).

Tests

  • Unit tests: green.
  • Integration (cflinuxfs5, Splunk OTEL + OpenTelemetry tests):
    • main + new tests: 2 failed (Splunk tests, OpenTelemetry Javaagent installed as well)
    • with fix: 4 passed

Detection matched any bound service whose name contains "otel",
e.g. "splunk-otel" (two agents in one JVM) or "hotel-db". Docs and
the Ruby buildpack only match "otel-collector"; restore that.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change preserves explicit detection options and includes appropriate regression coverage, with no unresolved findings.

No open issues 🎉

What changed in this PR

Narrows generic OpenTelemetry agent detection to documented service-name matching, preventing unintended installation alongside vendor agents or for unrelated services.

Changes:

  • Removes bare otel name matching while preserving explicit label and tag detection.
  • Adds negative regression tests for splunk-otel and hotel-db.
  • Updates integration coverage for Splunk isolation and supported collector naming.
File Description
src/​java/​frameworks/​open_telemetry_javaagent.go Restricts service-name matching to otel-collector.
src/​java/​frameworks/​open_telemetry_javaagent_test.go Covers vendor and unrelated service-name exclusions.
src/​integration/​frameworks_test.go Checks Splunk isolation and updates the collector binding name.

Review effort: Balanced

@stokpop
stokpop merged commit 2d0f9f5 into cloudfoundry:main Oct 21, 2026
1 check passed
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 participants