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

Support OTEL_PYTHON_DISABLED_INSTRUMENTATIONS #294

Merged
merged 4 commits into from
Jun 15, 2023

Conversation

jeremydvoss
Copy link
Member

Using OTEL_PYTHON_DISABLED_INSTRUMENTATIONS functionality from auto instrumentation flow

@jeremydvoss jeremydvoss marked this pull request as ready for review June 14, 2023 17:20
@jeremydvoss jeremydvoss requested review from a team and lzchen as code owners June 14, 2023 17:20
@@ -10,6 +10,8 @@
([#291](https://github.com/microsoft/ApplicationInsights-Python/pull/291))
- Fixing formatting issues for azure sdk
([#292](https://github.com/microsoft/ApplicationInsights-Python/pull/292))
- Support OTEL_PYTHON_DISABLED_INSTRUMENTATIONS
([#XXX](https://github.com/microsoft/ApplicationInsights-Python/pull/XXX))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
([#XXX](https://github.com/microsoft/ApplicationInsights-Python/pull/XXX))
([#294](https://github.com/microsoft/ApplicationInsights-Python/pull/294))

Copy link
Member Author

Choose a reason for hiding this comment

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

# use pkg_resources for now until https://github.com/open-telemetry/opentelemetry-python/pull/3168 is merged
for entry_point in iter_entry_points(
"azure_monitor_opentelemetry_instrumentor"
):
lib_name = entry_point.name
if lib_name not in _SUPPORTED_INSTRUMENTED_LIBRARIES_DEPENDENCIES_MAP:
continue
if entry_point.name in disabled_instrumentations:
_logger.debug(
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should use _logger.info

Copy link
Member Author

Choose a reason for hiding this comment

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

Using debug because it matches the current use in sitecustomize.

@@ -81,6 +86,19 @@ def _default_disable_tracing(configurations):
configurations[DISABLE_TRACING_ARG] = default


def _default_disabled_instrumentations(configurations):
disabled_instrumentation = environ.get(
OTEL_PYTHON_DISABLED_INSTRUMENTATIONS, []
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 add an entry to the README for this configuration?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated readme

Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

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

Left a couple of comments.

@jeremydvoss jeremydvoss merged commit e66773b into microsoft:main Jun 15, 2023
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.

2 participants