-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clumsy resource.New options #1690
Comments
I think this approach won't age well, as we will have users relying on these functions that would later turn out to have no effect if we were to revise which things the default detectors handle automatically. In other words, say that we later decide that we shouldn't detect the host-related details automatically. We would have users calling |
@seh what is your proposal? |
We have What I could possibly see someone griping about is not knowing all of things that are built in, but wanting to just knock one of them out—"all of them except this one that I know I don't want." It feels like a problem in want of a bitmask. |
What if we remove the three To make it convenient to add your own detector and have the builtins, we could have an exported slice of BuiltinDetectors. The New call would then look like this: resource.New(
WithDetectors(BuiltinDetectors...),
WithDetectors(MyCustomDetector),
) |
@seh I put in a PR just toying around with this. Can you take a look and see if that format would be more approachable? |
Closed with #1810 |
The
WithFromEnv
,WithHost
, andWithTelemetrySDK
options that are passed toNew
all accept aDetector
as an argument. ThisDetector
is stated to be used as an alternate to the builtinDetector
that finds the related resource attributes, or if nil will omit those resource attributes. This feels very clumsy.For instance, there is not guarantee that a
Detector
is passed toWithTelemetrySDK
that will detecttelemetry.sdk.*
attributes. It could detect whatever attributes it wants. The only meaningful effect including this option will have is that it will not include the builtin detector (nil or otherwise).Based on this behavior, it seems like these options should be changed to
Without*
versions of themselves. If a user wants to provide a custom detector to override these attributes they can use theWithDetectors
option.Proposal
WithFromEnv
withWithHost
withWithTelemetrySDK
withThe text was updated successfully, but these errors were encountered: