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

datadog-exporter: bugfix for unintentional type change #261

Merged
merged 4 commits into from
Jan 5, 2021

Commits on Dec 18, 2020

  1. Fix for unintentional type change

    Using `|=` here makes `trace_flags` into an int, rather than a
    `TraceFlags` object:
    
    ```
    >>> import opentelemetry.trace as trace
    >>> f = trace.TraceFlags()
    >>> type(f)
    <class 'opentelemetry.trace.span.TraceFlags'>
    >>> f |= trace.TraceFlags.SAMPLED
    >>> type(f)
    <class 'int'>
    ```
    
    This fix will preserve the type.
    
    You may ask, but where's the sample code to demostrate the bug?  I'm in
    the middle of trying to debug a number of odd issues with the gRPC
    client interceptor, so it's a bit convoluted, but it looks like this:
    
    ```
    Traceback (most recent call last):
      File "/home/michael/work/myapp/.venv/lib/python3.8/site-packages/grpc/_server.py", line 435, in _call_behavior
        response_or_iterator = behavior(argument, context)
      File "/home/michael/xfer/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py", line 252, in telemetry_interceptor
        with self._start_span(
      File "/home/michael/xfer/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py", line 232, in _start_span
        return self._tracer.start_as_current_span(
      File "/home/michael/xfer/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py", line 756, in start_as_current_span
        span = self.start_span(
      File "/home/michael/xfer/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py", line 807, in start_span
        sampling_result = self.sampler.should_sample(
      File "/home/michael/xfer/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py", line 273, in should_sample
        if parent_span_context.trace_flags.sampled:
    AttributeError: 'int' object has no attribute 'sampled'
    ```
    Michael Stella authored and alertedsnake committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    0582155 View commit details
    Browse the repository at this point in the history
  2. changelog

    alertedsnake committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    2de9466 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2021

  1. Configuration menu
    Copy the full SHA
    a5c75ba View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' into fix-datadog-bug

    alrex committed Jan 5, 2021
    Configuration menu
    Copy the full SHA
    bdd13f5 View commit details
    Browse the repository at this point in the history