Skip to content

Add agent/collector mode toggle to test setups - #368

Merged
unflxw merged 9 commits into
mainfrom
collector-mode-toggle
Jul 3, 2026
Merged

Add agent/collector mode toggle to test setups#368
unflxw merged 9 commits into
mainfrom
collector-mode-toggle

Conversation

@unflxw

@unflxw unflxw commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Part of appsignal/appsignal-ruby#1515.

AppSignal integrations are gaining a "collector mode", in which the
integration sets up OpenTelemetry itself and ships data to AppSignal
through a local AppSignal collector. Rather than copying each setup with
a suffix, this makes a single setup toggle-able between "agent mode" (the
default) and "collector mode" with a mode= parameter.

It wires up the toggle, converts a representative subset to prove it out,
removes the now-redundant -integration-collector setup, renames the
manual-OpenTelemetry -collector setups to -opentelemetry to avoid
ambiguity, and then rolls the toggle out to the rest of the Ruby 3.1+ and
Python agent setups.

Add agent/collector mode toggle to rake tasks

Test setups can now be run in either "agent mode" (the native
integration, the default) or "collector mode" (the integration sends
data to AppSignal through a local AppSignal collector over
OpenTelemetry), selected with a mode= parameter.

A setup supports collector mode when it ships a
docker-compose.collector.yml; asking for an unsupported mode errors,
and the chosen mode is printed at the start of the command output. The
shared AppSignal collector service lives in support/collector so per-app
collector files can include it.

Also fix the README bot-app detection, which matched an inline service
that is now pulled in via an include, so regeneration is faithful again.

Add collector mode to a representative set of setups

Convert ruby/grape, ruby/rack, ruby/rails7-postgres, ruby/rails8-sidekiq
and python/django5-celery to the agent/collector toggle. Each is split
into a shared compose file plus per-mode files: the agent file keeps the
existing app name, the collector file adds the AppSignal collector,
points the integration at it, and reports under a -collector app name
so the two modes stay separate in AppSignal.

The Ruby apps gain the optional OpenTelemetry gems collector mode needs;
they are only loaded when collector mode is active.

Remove redundant django5-celery-integration-collector

The django5-celery setup now supports collector mode through the mode
toggle, so the separate integration-collector setup is no longer needed.
Its only app-level difference, a /logs endpoint that emits log messages,
is folded into django5-celery.

Rename -collector setups to -opentelemetry

These setups wire up an OpenTelemetry stack by hand to send data to
AppSignal through the collector. Now that integrations can do this
themselves in collector mode, "-collector" is ambiguous: rename them to
"-opentelemetry" to distinguish the manual setups from the integration's
collector mode.

Renames the directories and updates the app names, image names and test
labels. The collector service and its host name are unchanged.

Add collector mode to Ruby 3.1+ agent setups

Roll the agent/collector toggle out to the remaining Ruby 3.1+ agent
setups, following the pattern already used for the initial subset: a
shared compose file per app, included by the agent and collector files,
with a mode-aware app name and the OpenTelemetry gems needed for
collector mode.

Add collector mode to Python agent setups

Apply the same agent/collector toggle to the remaining Python agent
setups. Python needs no dependency changes; collector mode is enabled
purely by the collector compose file and the mode-aware app name.

unflxw added 6 commits June 12, 2026 15:42
Test setups can now be run in either "agent mode" (the native
integration, the default) or "collector mode" (the integration sends
data to AppSignal through a local AppSignal collector over
OpenTelemetry), selected with a `mode=` parameter.

A setup supports collector mode when it ships a
`docker-compose.collector.yml`; asking for an unsupported mode errors,
and the chosen mode is printed at the start of the command output. The
shared AppSignal collector service lives in support/collector so per-app
collector files can include it.

Also fix the README bot-app detection, which matched an inline service
that is now pulled in via an include, so regeneration is faithful again.
Convert ruby/grape, ruby/rack, ruby/rails7-postgres, ruby/rails8-sidekiq
and python/django5-celery to the agent/collector toggle. Each is split
into a shared compose file plus per-mode files: the agent file keeps the
existing app name, the collector file adds the AppSignal collector,
points the integration at it, and reports under a `-collector` app name
so the two modes stay separate in AppSignal.

The Ruby apps gain the optional OpenTelemetry gems collector mode needs;
they are only loaded when collector mode is active.

This is the first batch; the remaining Ruby 3.1+ and Python agent setups
can adopt the same pattern later.
The django5-celery setup now supports collector mode through the mode
toggle, so the separate integration-collector setup is no longer needed.
Its only app-level difference, a /logs endpoint that emits log messages,
is folded into django5-celery.
These setups wire up an OpenTelemetry stack by hand to send data to
AppSignal through the collector. Now that integrations can do this
themselves in collector mode, "-collector" is ambiguous: rename them to
"-opentelemetry" to distinguish the manual setups from the integration's
collector mode.

Renames the directories and updates the app names, image names and test
labels. The collector service and its host name are unchanged.
Roll the agent/collector toggle out to the remaining Ruby 3.1+ agent
setups, following the pattern already used for the initial subset: a
shared compose file per app, included by the agent and collector files,
with a mode-aware app name and the OpenTelemetry gems needed for
collector mode.
Apply the same agent/collector toggle to the remaining Python agent
setups. Python needs no dependency changes; collector mode is enabled
purely by the collector compose file and the mode-aware app name.
@backlog-helper

backlog-helper Bot commented Jun 12, 2026

Copy link
Copy Markdown

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

The rename of the manual-OpenTelemetry setups missed the hardcoded app
matrix in the CI workflow, leaving it pointed at directories that no
longer exist. Point the 13 entries at their new -opentelemetry paths so
they are tested again.
@unflxw
unflxw marked this pull request as draft June 12, 2026 15:15
The shared-file compose layout includes a per-app shared file and then
overrides the app service in the agent/collector files. The Docker
Compose bundled with the ubuntu-22.04 runner rejects this with
"services.app conflicts with imported resource"; newer Compose accepts
it. Install a current Compose in each test job so the toggle works in CI.
@unflxw
unflxw requested a review from Copilot June 12, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@unflxw
unflxw requested review from lipskis and tombruijn June 12, 2026 19:33
@tombruijn tombruijn added the chore A small task that takes a day or two at the most. label Jun 15, 2026
A mode is now any docker-compose.<mode>.yml file, instead of a
hard-coded agent/collector pair. A plain docker-compose.yml (or
docker-compose.default.yml) is the "default" mode; with no mode= the
default is used, falling back to agent, else an error listing the
available modes. The shared file is reserved and never selectable.

Dual-mode setups have their docker-compose.yml renamed to
docker-compose.agent.yml so they resolve to agent implicitly. The
exec-based tasks (bash, console, diagnose, etc.) now pass -f, since
those setups no longer have a plain compose file to auto-discover.
@unflxw
unflxw marked this pull request as ready for review June 18, 2026 06:59
@backlog-helper

This comment has been minimized.

11 similar comments
@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

backlog-helper Bot commented Jul 3, 2026

Copy link
Copy Markdown

This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@unflxw
unflxw merged commit 8e428b7 into main Jul 3, 2026
147 of 148 checks passed
@unflxw
unflxw deleted the collector-mode-toggle branch July 3, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore A small task that takes a day or two at the most.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants