Conversation
|
鉁旓笍 All good! |
unflxw
force-pushed
the
refresh-resource-after-fork
branch
2 times, most recently
from
September 30, 2026 13:24
d43ef2d to
6998ae0
Compare
The OpenTelemetry providers are built once, and their resource carries the `process.pid` of the process that built them. A process forked after that, such as a Puma worker under `preload_app!`, exports its data with its parent's resource, so the collector computes the deltas of every worker's up-down counters as one series. The resource now also carries a `service.instance.id`, a UUIDv4 generated once per process, as the Python SDK does. A `Process._fork` hook replaces it and `process.pid` on each provider's resource in the child. The providers have no resource setter, so the hook writes `@resource`, reads the resource back, and logs a warning when the provider did not keep it.
unflxw
force-pushed
the
refresh-resource-after-fork
branch
from
September 30, 2026 14:02
6998ae0 to
623d67b
Compare
unflxw
marked this pull request as ready for review
October 2, 2026 08:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another monkey-patch to the OpenTelemetry SDK. Mostly taken from open-telemetry/opentelemetry-ruby#1425, with additional guards to try our best to not accidentally break things if
#resourceor@resourcesuddenly become something else. We can't just reinitialize the providers because the tracers, meters and loggers that have already been created hold references to their old providers.The fix described on the changeset is dependent on appsignal/appsignal-collector#449, which keys the collector's cumulative metric state by resource.
The OpenTelemetry providers are built once, and their resource carries
the
process.pidof the process that built them. A process forkedafter that, such as a Puma worker under
preload_app!, exports itsdata with its parent's resource, so the collector computes the deltas
of every worker's up-down counters as one series.
The resource now also carries a
service.instance.id, a UUIDv4generated once per process, as the Python SDK does. A
Process._forkhook replaces it and
process.pidon each provider's resource in thechild. The providers have no resource setter, so the hook writes
@resource, reads the resource back, and logs a warning when theprovider did not keep it.