Skip to content

Commit

Permalink
Debug more
Browse files Browse the repository at this point in the history
  • Loading branch information
tammy-baylis-swi committed May 8, 2024
1 parent 71952e7 commit 97939ab
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def _instrument(
:code:`requests.session.Session.request` (this includes
:code:`requests.get`, etc.)."""

print("!!! init.py _instrument with opt_in_mode:")
print("%s", sem_conv_opt_in_mode)

# Since
# https://github.com/psf/requests/commit/d72d1162142d1bf8b1b5711c664fbbd674f349d1
# (v0.7.0, Oct 23, 2011), get, post, etc are implemented via request which
Expand Down Expand Up @@ -381,9 +384,16 @@ def _instrument(self, **kwargs):
``excluded_urls``: A string containing a comma-delimited
list of regexes used to exclude URLs from tracking
"""
print("!!! RequestsInstrumentor _instrument with kwargs:")
print("%s", kwargs)

semconv_opt_in_mode = _OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
_OpenTelemetryStabilitySignalType.HTTP,
)

print("Then got semconv_opt_in_mode (no hyphen):")
print("%s", semconv_opt_in_mode)

schema_url = _get_schema_url(semconv_opt_in_mode)
tracer_provider = kwargs.get("tracer_provider")
tracer = get_tracer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def _initialize(cls):
# Users can pass in comma delimited string for opt-in options
# Only values for http stability are supported for now
opt_in = os.environ.get(OTEL_SEMCONV_STABILITY_OPT_IN, "")

print("!!! SemconvStability._initialize")
print("Got opt_in from env var: %s", opt_int)

opt_in_list = []
if opt_in:
opt_in_list = [s.strip() for s in opt_in.split(",")]
Expand All @@ -130,6 +134,9 @@ def _initialize(cls):
http_opt_in = _HTTPStabilityMode.HTTP_DUP
elif _HTTPStabilityMode.HTTP.value in opt_in_list:
http_opt_in = _HTTPStabilityMode.HTTP

print("Using http_opt_in %s", http_opt_in)

_OpenTelemetrySemanticConventionStability._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING[
_OpenTelemetryStabilitySignalType.HTTP
] = http_opt_in
Expand All @@ -141,6 +148,16 @@ def _get_opentelemetry_stability_opt_in_mode(
cls,
signal_type: _OpenTelemetryStabilitySignalType,
) -> _HTTPStabilityMode:
print("!!! _semconv.get_otel_stability")
print("signal_type: %s", signal_type)
print("_OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING: %s", _OpenTelemetrySemanticConventionStability._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING)
print(
"retval: %s",
_OpenTelemetrySemanticConventionStability._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING.get(
signal_type, _HTTPStabilityMode.DEFAULT
)
)

return _OpenTelemetrySemanticConventionStability._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING.get(
signal_type, _HTTPStabilityMode.DEFAULT
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def instrument(self, **kwargs):
``opentelemetry-instrument`` command does.
"""

print("!!! Starting BaseInstrumentor.instrument with kwargs:")
print("%s", kwargs)

if self._is_instrumented_by_opentelemetry:
_LOG.warning("Attempting to instrument while already instrumented")
return None
Expand All @@ -111,6 +114,8 @@ def instrument(self, **kwargs):
# initialize semantic conventions opt-in if needed
_OpenTelemetrySemanticConventionStability._initialize()

print("Base instrumentor calling self._instrument with kwargs:")
print("%s", kwargs)
result = self._instrument( # pylint: disable=assignment-from-no-return
**kwargs
)
Expand Down

0 comments on commit 97939ab

Please sign in to comment.