mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
Minor refactoring (#1169)
* Minor refactoring across multiple instrumentation libraries * Reformat using black * Put span_kind back in aws_lambda Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
This commit is contained in:
@ -287,9 +287,12 @@ def _instrument(
|
||||
|
||||
span_kind = None
|
||||
try:
|
||||
if lambda_event["Records"][0]["eventSource"] in set(
|
||||
["aws:sqs", "aws:s3", "aws:sns", "aws:dynamodb"]
|
||||
):
|
||||
if lambda_event["Records"][0]["eventSource"] in {
|
||||
"aws:sqs",
|
||||
"aws:s3",
|
||||
"aws:sns",
|
||||
"aws:dynamodb",
|
||||
}:
|
||||
# See more:
|
||||
# https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
|
||||
# https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html
|
||||
|
@ -178,8 +178,6 @@ class BotoInstrumentor(BaseInstrumentor):
|
||||
)
|
||||
|
||||
def _patched_auth_request(self, original_func, instance, args, kwargs):
|
||||
operation_name = None
|
||||
|
||||
frame = currentframe().f_back
|
||||
operation_name = None
|
||||
while frame:
|
||||
|
@ -130,7 +130,7 @@ class ElasticsearchInstrumentor(BaseInstrumentor):
|
||||
|
||||
def _instrument(self, **kwargs):
|
||||
"""
|
||||
Instruments elasticsearch module
|
||||
Instruments Elasticsearch module
|
||||
"""
|
||||
tracer_provider = kwargs.get("tracer_provider")
|
||||
tracer = get_tracer(__name__, __version__, tracer_provider)
|
||||
|
@ -266,7 +266,6 @@ _excluded_urls_from_env = get_excluded_urls("FLASK")
|
||||
|
||||
|
||||
def get_default_span_name():
|
||||
span_name = ""
|
||||
try:
|
||||
span_name = flask.request.url_rule.rule
|
||||
except AttributeError:
|
||||
|
@ -194,7 +194,7 @@ class CommandTracer(monitoring.CommandListener):
|
||||
|
||||
def _get_span_dict_key(event):
|
||||
if event.connection_id is not None:
|
||||
return (event.request_id, event.connection_id)
|
||||
return event.request_id, event.connection_id
|
||||
return event.request_id
|
||||
|
||||
|
||||
|
@ -142,7 +142,6 @@ def _instrument(
|
||||
):
|
||||
def _traced_execute_command(func, instance, args, kwargs):
|
||||
query = _format_command_args(args)
|
||||
name = ""
|
||||
if len(args) > 0 and args[0]:
|
||||
name = args[0]
|
||||
else:
|
||||
|
@ -78,7 +78,7 @@ from typing import Collection, Dict, Iterable, List, Optional
|
||||
|
||||
import psutil
|
||||
|
||||
# FIXME Remove this pyling disabling line when Github issue is cleared
|
||||
# FIXME Remove this pylint disabling line when Github issue is cleared
|
||||
# pylint: disable=no-name-in-module
|
||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||
from opentelemetry.instrumentation.system_metrics.package import _instruments
|
||||
|
Reference in New Issue
Block a user