Skip to content

Commit

Permalink
Add pre and post instrument entrypoints (#1983)
Browse files Browse the repository at this point in the history
* Add pre and post instrument entry points

Fixes #1982


Co-authored-by: Owais Lone <[email protected]>
  • Loading branch information
ocelotl and owais authored Sep 9, 2021
1 parent c1e8a51 commit 08392c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26


- Add pre and post instrumentation entry points
([#1983](https://github.com/open-telemetry/opentelemetry-python/pull/1983))
- Fix documentation on well known exporters and variable OTEL_TRACES_EXPORTER which were misnamed
([#2023](https://github.com/open-telemetry/opentelemetry-python/pull/2023))
- `opentelemetry-sdk` `get_aggregated_resource()` returns default resource and service name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def _load_instrumentors(distro):
# to handle users entering "requests , flask" or "requests, flask" with spaces
package_to_exclude = [x.strip() for x in package_to_exclude]

for entry_point in iter_entry_points("opentelemetry_pre_instrument"):
entry_point.load()()

for entry_point in iter_entry_points("opentelemetry_instrumentor"):
if entry_point.name in package_to_exclude:
logger.debug(
Expand All @@ -84,6 +87,9 @@ def _load_instrumentors(distro):
logger.exception("Instrumenting of %s failed", entry_point.name)
raise exc

for entry_point in iter_entry_points("opentelemetry_post_instrument"):
entry_point.load()()


def _load_configurators():
configured = None
Expand Down

0 comments on commit 08392c8

Please sign in to comment.