Repository navigation
Conversation
bengl
marked this pull request as ready for review
November 3, 2026 19:41
Previously, the resource microtel exports held only the service name, the SDK, and the process, and there was no way to add attributes such as service.version, which backends group and filter by. Now init() takes resourceAttributes, an object of string, boolean, or finite number values, copied at init. A user value replaces microtel's value for its key. service.name and the telemetry.sdk.* keys are refused, since microtel sets them and the serviceName, sdkName, and sdkVersion options change them. Empty keys are refused too. Integers past the safe range now export as doubleValue, for span attributes as well. As intValue, which OTLP writes as a decimal string, a number like 1e21 came out as "1e+21". The resource also gains two defaults: service.instance.id, a random UUID made once per process, and host.name from os.hostname(). Both can be replaced through resourceAttributes. Signed-off-by: Bryan English <bryan@bryanenglish.com>
bengl
force-pushed
the
bengl/resource-attributes
branch
from
November 3, 2026 21:39
84294f2 to
a7db61b
Compare
trentm
approved these changes
Nov 3, 2026
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.
Backends group and filter spans by resource attributes such as
service.versionanddeployment.environment.name, and microtel had no way to set them. This adds aresourceAttributesoption:What changed. Values are strings, booleans, or finite numbers, encoded the way span attributes are. A value replaces microtel's own value for the same key, so each key appears once, and the object is copied at init.
service.name,telemetry.sdk.name, andtelemetry.sdk.versionare refused with an error naming the option that sets them,serviceName,sdkName, orsdkVersion, so each has one place to be set. The othertelemetry.sdk.*keys are refused because microtel sets them, and so are empty keys.Number encoding. Integers export as
intValue, which OTLP writes as a decimal string. Only safe integers fit that exactly, so larger ones such as1e21now export asdoubleValueinstead of a string like"1e+21"that a collector could reject. Span attributes share the encoder, so they get the same fix.New defaults. The resource gains
service.instance.id, a random UUID made once per process, as the semantic conventions suggest, andhost.namefromos.hostname(). Both can be replaced throughresourceAttributes.Not taken.
OTEL_RESOURCE_ATTRIBUTES. All configuration goes throughinit().Tests. A table in
test/test-init.jscovers each way the option can be wrong. A child process checks the exported resource: the defaults, withservice.instance.idthe same across two exports, each value type and its encoding, includingfalse,0, and integers past the safe range, user values replacinghost.nameandprocess.pid, one entry per key, and the copy at init.