Skip to content

Flush OpenTelemetry data when AppSignal stops - #278

Merged
unflxw merged 1 commit into
mainfrom
flush-opentelemetry-on-stop
Aug 27, 2026
Merged

Flush OpenTelemetry data when AppSignal stops#278
unflxw merged 1 commit into
mainfrom
flush-opentelemetry-on-stop

Conversation

@unflxw

@unflxw unflxw commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Stopping AppSignal stops the check-in scheduler and the agent, and
leaves the OpenTelemetry providers alone. They register an exit handler
that flushes them when the interpreter shuts down, which is too late in
two cases. A process killed by a signal never runs exit handlers. And
when the agent is used, it is the endpoint that OpenTelemetry data is
sent to, so the exit handler posts to a port that closed when the agent
was stopped.

The providers are now shut down before the agent, which flushes what
they hold. They are tracked as they are started, rather than read back
from the global providers: no logger provider is set when the agent is
used, an unset tracer provider is a proxy object with no shutdown
method, and a provider the application set before ours is not ours to
shut down.

Stopping AppSignal stops the check-in scheduler and the agent, and
leaves the OpenTelemetry providers alone. They register an exit handler
that flushes them when the interpreter shuts down, which is too late in
two cases. A process killed by a signal never runs exit handlers. And
when the agent is used, it is the endpoint that OpenTelemetry data is
sent to, so the exit handler posts to a port that closed when the agent
was stopped.

The providers are now shut down before the agent, which flushes what
they hold. They are tracked as they are started, rather than read back
from the global providers: no logger provider is set when the agent is
used, an unset tracer provider is a proxy object with no shutdown
method, and a provider the application set before ours is not ours to
shut down.
@backlog-helper

backlog-helper Bot commented Aug 27, 2026

Copy link
Copy Markdown

Hi @unflxw,

We've found some issues with your Pull Request.

  • This Pull Request is missing labels. Please add labels to help identify types of Pull Requests. - (More info)
  • This Pull Request is missing reviewers. Either convert this Pull Request into a draft or ignore this rule by adding [skip review] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

@unflxw
unflxw marked this pull request as ready for review August 27, 2026 16:26
@unflxw
unflxw merged commit 1351912 into main Aug 27, 2026
11 checks passed
@backlog-helper

Copy link
Copy Markdown

Hi @unflxw,

We've found new issues for this Pull Request. Please see the main comment on this issue for a list of all current warnings. This comment will not be updated to reflect resolved warnings.

  • This Pull Request is missing reviewers. Either convert this Pull Request into a draft or ignore this rule by adding [skip review] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

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