-
Notifications
You must be signed in to change notification settings - Fork 858
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
For SpanProcessor/SpanExporter/MetricProducer/MetricExporter use Config #996
Comments
My only concern is we lose the rich semantics of the naming in the builder methods. Perhaps we have specific Config extension classes to provide the naming? |
I would suggest like this: class BatchSpansProcessor {
BatchSpansProcessor create(Config config);
// Immutable
public static Config {
boolean getReportOnlySampled();
long getScheduleDelayMillis();
long getExporterTimeoutMillis();
int getMaxQueueSize();
int getMaxExportBatchSize();
public static Config fromEnv();
public static Config getDefault();
// Looks for the same env variables but in the given map not in the env variables.
// Can be used by the auto-config framework.
// Not sure if this helps, but it is an idea on how we can extend this.
public static Config fromConfigMap(Map<String, String> configMap);
public static Builder {
// Setters for all the properties.
}
}
} |
I like this suggestion quite a bit. I think it'll tighten up our config story a lot. 👍 |
I'm fine with this 👍 |
+1 on the proposal and It's great to see this landing in OTEL. The configuration property names should be defined at the spec level to make consistent across SDKs. There is one missing feature in the API, sometimes it is useful to change the configuration after it is created from the environment. Maybe |
I would add |
@bogdandrutu on your proposal, how would it work if you want most of your configs to come from a default or env, but override one or two of the settings? Perhaps better to have those methods return a builder that can be modified before constructing the immutable config? (Duplicating those methods on the builder would also be acceptable. |
Also, how do people feel about accepting config via system properties in addition to env vars? |
I'd strongly vow for supporting system properties too. |
For prior art: in the SpecialAgent, we first get env vars, and then proceed to look for them as system properties, in which case the values get overridden. |
This is a nice pattern to support both, quite tersely: |
Thanks @bogdandrutu, this sounds great from an auto-instrumentation perspective! We need to give auto-instrumentation users some way to configure the SDK, and it would be really nice if we can just delegate this configuration to the SDK itself. Also, I'm a fan of env vars as the most basic means of external configuration since those tend to be supported in the widest number of compute environments (and I have no objection to also having system properties support). |
+1 This is already what Jaeger exporter configuration does https://github.com/open-telemetry/opentelemetry-java/blob/master/exporters/jaeger/src/main/java/io/opentelemetry/exporters/jaeger/JaegerGrpcSpanExporter.java#L240 |
Note that this also calls getenv when the system property is found. AFAIK, getenv is very cheap at least on OpenJDK/Oracle based JVMs though. |
@bogdandrutu I can take this! |
@thisthat please pick one (I propose BatchSpanProcessor) and start a PR where we can discuss the overall design. Then we can apply the same changes to others. Does it make sense? |
@bogdandrutu yes, it totally makes sense! :) |
I am very confused about this task. PR #1080 added new What is the "official" way now to configure span processor from system properties/env variables? @bogdandrutu @thisthat |
The task was proposing a way to configure from system and environment variables different parts of the SDK. Since the classes have already a builder, we introduce such functionality there without increasing the API surface. |
So it is expected now that every configuration source (env/sysprops) should be consulted manually by whoever creates a processor/exporter? By calling |
Exactly |
This is a proposal to use a Config object instead of Builders for all the implementations of these classes. This will allow us to have a "getFromEnv" on all these Configs, probably a "getDefault" as well.
This will be easier to initialize compared with Builders in auto-instrumentation as well as when dealing with initializing a pipeline like SpanProcessor -> SpanExporter.
/cc @trask @tylerbenson - what do you think about this from the auto-instrumentation perspective.
The text was updated successfully, but these errors were encountered: