Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jul 19, 2024
1 parent ef122ec commit fe33e97
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def custom_event_context_extractor(lambda_event):
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
from opentelemetry.instrumentation.utils import unwrap
from opentelemetry.metrics import MeterProvider, get_meter_provider
from opentelemetry.propagate import get_global_textmap
from opentelemetry.propagate import extract, get_global_textmap
from opentelemetry.semconv.resource import ResourceAttributes
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import (
Expand All @@ -94,7 +94,6 @@ def custom_event_context_extractor(lambda_event):
)
from opentelemetry.trace.propagation import get_current_span
from opentelemetry.trace.status import Status, StatusCode
from opentelemetry.propagate import extract

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


def handler(event, context):
# The purpose of this function is to be used as the call_wrapped function
# of _instrumented_lambda_handler_call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
from requests.structures import CaseInsensitiveDict

from opentelemetry.context import get_current
from opentelemetry.instrumentation.aws_lambda import _X_AMZN_TRACE_ID
from opentelemetry.propagators.aws.aws_xray_propagator import (
TRACE_HEADER_KEY,
AwsXrayLambdaPropagator,
AwsXRayPropagator,
)
from opentelemetry.instrumentation.aws_lambda import _X_AMZN_TRACE_ID
from opentelemetry.propagators.textmap import DefaultGetter
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.trace import (
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_add_link_from_environment_variable(self):
"Parent=1234567890123456;"
"Sampled=1"
),
}
},
)
def test_equivalent_extraction(self):

Expand All @@ -189,18 +189,12 @@ def check_context(context) -> str:

self.assertEqual(
hex(span_context.trace_id),
"0x12345678123456789012345678901234"
"0x12345678123456789012345678901234",
)

self.assertEqual(
hex(span_context.span_id),
"0x1234567890123456"
)
self.assertEqual(hex(span_context.span_id), "0x1234567890123456")

self.assertEqual(
hex(span_context.trace_flags),
"0x1"
)
self.assertEqual(hex(span_context.trace_flags), "0x1")

return context_key

Expand All @@ -210,5 +204,5 @@ def check_context(context) -> str:
{TRACE_HEADER_KEY: environ.get(_X_AMZN_TRACE_ID)}
)
),
check_context(AwsXrayLambdaPropagator().extract({}))
check_context(AwsXrayLambdaPropagator().extract({})),
)

0 comments on commit fe33e97

Please sign in to comment.