Skip to content
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

Auto instrumentation parameters #3864

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

jeremydvoss
Copy link
Contributor

@jeremydvoss jeremydvoss commented Apr 18, 2024

Description

Currently, the only way for custom Configurators to configure is through setting or defaulting environment variables. While it makes sense for customers to configure autoinstrumentation with env vars, there is no reason Configurators should not be able to directly configure start up (exporters, samplers...etc). Exposing autoinstrumentation configuration of otel via env var defaults is invasive, confusing, and easy for users to mess up. For instance, even a blank env var or a left-over setting from previous run could interfere with a distro starting up.

In this approach, configurators can pass kwargs to _initialize_components to easily configure autoinstrumentation which currently only considers env vars.

Precedence of params over env vars

Params would be preferred over (or merged with) env vars. This follows the approach towards env vars elsewhere in OTel Python. And doing so would be necessary for custom distros to guarantee certain behavior.

In this approach, exporters given by params would be ADDED to those from env vars. Resource attributes would be merged with those from env vars and resource detectors. Since there's only 1 sampler, param would take precedence. Same for logging_enabled.

@jeremydvoss jeremydvoss requested a review from a team as a code owner April 18, 2024 23:17
@jeremydvoss jeremydvoss changed the title Auto instrumentation parameter proposal DO NOT MERGE: Auto instrumentation parameter proposal Apr 18, 2024
@jeremydvoss jeremydvoss changed the title DO NOT MERGE: Auto instrumentation parameter proposal Auto instrumentation parameter proposal May 23, 2024
@jeremydvoss jeremydvoss changed the title Auto instrumentation parameter proposal Auto instrumentation parameters May 23, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, posted one idea. Thanks for presenting this at multiple sig meetings.

.codespellrc Outdated Show resolved Hide resolved
_get_exporter_names("logs"),
def _initialize_components(
auto_instrumentation_version: Optional[str] = None,
span_exporter_names: Optional[List[str]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we stick with trace_exporter_names instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine either way. But the object seems to be called SpanExporter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocelotl Any thoughts? We use both "span_exporter" and "trace_exporter" naming conventions in internal variables, but the object is called SpanExporter. I am open to either but want to make sure to get broad input on this since it is an api change that we cannot change without breaking.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We call them "trace_exporter" because user is configuring what exporter they want under the "trace" flag. As well, the entry points are using opentelemetry_traces_exporter.

@jeremydvoss jeremydvoss force-pushed the auto-params branch 2 times, most recently from 36fab8c to c6980b5 Compare May 28, 2024 20:42
Comment on lines +702 to +706
},
)
@patch.dict(
environ,
{
Copy link
Contributor

@xrmx xrmx May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
},
)
@patch.dict(
environ,
{

What about patching the environ dict once?

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.

None yet

4 participants