Skip to content

Commit

Permalink
removed venv
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSulistio committed Jun 1, 2021
1 parent cbc0995 commit 422d67d
Show file tree
Hide file tree
Showing 133 changed files with 260 additions and 4,992 deletions.
14 changes: 12 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,22 @@ def getlistcfg(strval):
if "class_references" in mcfg:
class_references = getlistcfg(mcfg["class_references"])
for class_reference in class_references:
nitpick_ignore.append(("py:class", class_reference,))
nitpick_ignore.append(
(
"py:class",
class_reference,
)
)

if "anys" in mcfg:
anys = getlistcfg(mcfg["anys"])
for _any in anys:
nitpick_ignore.append(("any", _any,))
nitpick_ignore.append(
(
"any",
_any,
)
)

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def inject(
return
sampled = (trace.TraceFlags.SAMPLED & span.context.trace_flags) != 0
setter.set(
carrier, self.TRACE_ID_KEY, format_trace_id(span.context.trace_id),
carrier,
self.TRACE_ID_KEY,
format_trace_id(span.context.trace_id),
)
setter.set(
carrier, self.PARENT_ID_KEY, format_span_id(span.context.span_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def test_constructor_explicit(self):
"""Test the constructor passing all the options."""
agent_url = "http://localhost:8126"
exporter = datadog.DatadogSpanExporter(
agent_url=agent_url, service="explicit",
agent_url=agent_url,
service="explicit",
)

self.assertEqual(exporter.agent_url, agent_url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ async def on_request_start(
request_span_name = str(trace_config_ctx.span_name)

trace_config_ctx.span = trace_config_ctx.tracer.start_span(
request_span_name, kind=SpanKind.CLIENT,
request_span_name,
kind=SpanKind.CLIENT,
)

if trace_config_ctx.span.is_recording():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def test_status_codes(self):
(HTTPStatus.OK, StatusCode.UNSET),
(HTTPStatus.TEMPORARY_REDIRECT, StatusCode.UNSET),
(HTTPStatus.SERVICE_UNAVAILABLE, StatusCode.ERROR),
(HTTPStatus.GATEWAY_TIMEOUT, StatusCode.ERROR,),
(
HTTPStatus.GATEWAY_TIMEOUT,
StatusCode.ERROR,
),
):
with self.subTest(status_code=status_code):
host, port = self._http_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _instrument(self, **kwargs):

# pylint:disable=no-self-use
def _uninstrument(self, **kwargs):
""""Disable aiopg instrumentation"""
""" "Disable aiopg instrumentation"""
wrappers.unwrap_connect()
wrappers.unwrap_create_pool()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ async def __call__(self, scope, receive, send):

try:
with self.tracer.start_as_current_span(
span_name, kind=trace.SpanKind.SERVER,
span_name,
kind=trace.SpanKind.SERVER,
) as span:
if span.is_recording():
attributes = collect_request_attributes(scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def _common_request( # pylint: disable=too-many-locals
endpoint_name = getattr(instance, "host").split(".")[0]

with self._tracer.start_as_current_span(
"{}.command".format(endpoint_name), kind=SpanKind.CONSUMER,
"{}.command".format(endpoint_name),
kind=SpanKind.CONSUMER,
) as span:
span.set_attribute("endpoint", endpoint_name)
if args:
Expand All @@ -136,7 +137,11 @@ def _common_request( # pylint: disable=too-many-locals

if span.is_recording():
add_span_arg_tags(
span, endpoint_name, args, args_name, traced_args,
span,
endpoint_name,
args,
args_name,
traced_args,
)

# Obtaining region name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
BotocoreInstrumentor._patch_lambda_invoke(api_params)

with self._tracer.start_as_current_span(
"{}".format(service_name), kind=SpanKind.CLIENT,
"{}".format(service_name),
kind=SpanKind.CLIENT,
) as span:
if span.is_recording():
span.set_attribute("aws.operation", operation_name)
Expand Down Expand Up @@ -183,12 +184,14 @@ def _patched_api_call(self, original_func, instance, args, kwargs):

if req_id:
span.set_attribute(
"aws.request_id", req_id,
"aws.request_id",
req_id,
)

if "RetryAttempts" in metadata:
span.set_attribute(
"retry_attempts", metadata["RetryAttempts"],
"retry_attempts",
metadata["RetryAttempts"],
)

if "HTTPStatusCode" in metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def test_s3_client(self):
},
)
self.assertIs(
span.status.status_code, trace_api.StatusCode.ERROR,
span.status.status_code,
trace_api.StatusCode.ERROR,
)

# Comment test for issue 1088
Expand Down Expand Up @@ -398,11 +399,13 @@ def test_lambda_invoke_propagation(self):

self.assertIn(MockTextMapPropagator.TRACE_ID_KEY, headers)
self.assertEqual(
"0", headers[MockTextMapPropagator.TRACE_ID_KEY],
"0",
headers[MockTextMapPropagator.TRACE_ID_KEY],
)
self.assertIn(MockTextMapPropagator.SPAN_ID_KEY, headers)
self.assertEqual(
"0", headers[MockTextMapPropagator.SPAN_ID_KEY],
"0",
headers[MockTextMapPropagator.SPAN_ID_KEY],
)
finally:
set_global_textmap(previous_propagator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def _instrument(self, **kwargs):

tracer_provider = kwargs.get("tracer_provider")
tracer = get_tracer(
__name__, __version__, tracer_provider=tracer_provider,
__name__,
__version__,
tracer_provider=tracer_provider,
)

_DjangoMiddleware._tracer = tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ def test_trace_response_headers(self):

self.assertIn("traceresponse", response.headers)
self.assertEqual(
response.headers["Access-Control-Expose-Headers"], "traceresponse",
response.headers["Access-Control-Expose-Headers"],
"traceresponse",
)
self.assertEqual(
response.headers["traceresponse"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class ElasticsearchInstrumentor(BaseInstrumentor):
def __init__(self, span_name_prefix=None):
if not span_name_prefix:
span_name_prefix = environ.get(
"OTEL_PYTHON_ELASTICSEARCH_NAME_PREFIX", "Elasticsearch",
"OTEL_PYTHON_ELASTICSEARCH_NAME_PREFIX",
"Elasticsearch",
)
self._span_name_prefix = span_name_prefix.strip()
super().__init__()
Expand Down Expand Up @@ -126,7 +127,8 @@ def wrapper(wrapped, _, args, kwargs):
body = kwargs.get("body", None)

with tracer.start_as_current_span(
op_name, kind=SpanKind.CLIENT,
op_name,
kind=SpanKind.CLIENT,
) as span:
if span.is_recording():
attributes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ def _start_response(status, response_headers, *args, **kwargs):
return super().__call__(env, _start_response)
except Exception as exc:
activation.__exit__(
type(exc), exc, getattr(exc, "__traceback__", None),
type(exc),
exc,
getattr(exc, "__traceback__", None),
)
context.detach(token)
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def test_trace_response(self):

self.assertIn("traceresponse", headers)
self.assertEqual(
headers["access-control-expose-headers"], "traceresponse",
headers["access-control-expose-headers"],
"traceresponse",
)
self.assertEqual(
headers["traceresponse"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def hello():
from opentelemetry.util._time import _time_ns
from opentelemetry.util.http import get_excluded_urls


_logger = getLogger(__name__)

_ENVIRON_STARTTIME_KEY = "opentelemetry-flask.starttime_key"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ def instrumentation_dependencies(self) -> Collection[str]:
def _instrument(self, **kwargs):
for ctype in self._which_channel(kwargs):
_wrap(
"grpc", ctype, self.wrapper_fn,
"grpc",
ctype,
self.wrapper_fn,
)

def _uninstrument(self, **kwargs):
Expand All @@ -217,7 +219,8 @@ def wrapper_fn(self, original_func, instance, args, kwargs):
channel = original_func(*args, **kwargs)
tracer_provider = kwargs.get("tracer_provider")
return intercept_channel(
channel, client_interceptor(tracer_provider=tracer_provider),
channel,
client_interceptor(tracer_provider=tracer_provider),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ def intercept_stream(
Status(StatusCode.ERROR)
)
guarded_span.generated_span.set_attribute(
SpanAttributes.RPC_GRPC_STATUS_CODE, err.code().value[0],
SpanAttributes.RPC_GRPC_STATUS_CODE,
err.code().value[0],
)
raise err

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def test_error_simple(self):
self.assertEqual(len(spans), 1)
span = spans[0]
self.assertIs(
span.status.status_code, trace.StatusCode.ERROR,
span.status.status_code,
trace.StatusCode.ERROR,
)

def test_error_stream_unary(self):
Expand All @@ -225,7 +226,8 @@ def test_error_stream_unary(self):
self.assertEqual(len(spans), 1)
span = spans[0]
self.assertIs(
span.status.status_code, trace.StatusCode.ERROR,
span.status.status_code,
trace.StatusCode.ERROR,
)

def test_error_unary_stream(self):
Expand All @@ -236,7 +238,8 @@ def test_error_unary_stream(self):
self.assertEqual(len(spans), 1)
span = spans[0]
self.assertIs(
span.status.status_code, trace.StatusCode.ERROR,
span.status.status_code,
trace.StatusCode.ERROR,
)

def test_error_stream_stream(self):
Expand All @@ -247,7 +250,8 @@ def test_error_stream_stream(self):
self.assertEqual(len(spans), 1)
span = spans[0]
self.assertIs(
span.status.status_code, trace.StatusCode.ERROR,
span.status.status_code,
trace.StatusCode.ERROR,
)

def test_client_interceptor_trace_context_propagation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ class Servicer(GRPCTestServerServicer):
# pylint:disable=C0103
def SimpleMethod(self, request, context):
return Response(
server_id=request.client_id, response_data=request.request_data,
server_id=request.client_id,
response_data=request.request_data,
)

# pylint:disable=C0103
def ServerStreamingMethod(self, request, context):
for data in ("one", "two", "three"):
yield Response(
server_id=request.client_id, response_data=data,
server_id=request.client_id,
response_data=data,
)


Expand Down Expand Up @@ -349,7 +351,8 @@ def ServerStreamingMethod(self, request, context):

for data in ("one", "two", "three"):
yield Response(
server_id=request.client_id, response_data=data,
server_id=request.client_id,
response_data=data,
)

# Intercept gRPC calls...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def wrapper(wrapped, instance, args, kwargs):
def _wrap_render(tracer, wrapped, instance, args, kwargs):
"""Wrap `Template.render()` or `Template.generate()`"""
with tracer.start_as_current_span(
"jinja2.render", kind=SpanKind.INTERNAL,
"jinja2.render",
kind=SpanKind.INTERNAL,
) as span:
if span.is_recording():
template_name = instance.name or DEFAULT_TEMPLATE_NAME
Expand All @@ -86,7 +87,8 @@ def _wrap_render(tracer, wrapped, instance, args, kwargs):
@_with_tracer_wrapper
def _wrap_compile(tracer, wrapped, _, args, kwargs):
with tracer.start_as_current_span(
"jinja2.compile", kind=SpanKind.INTERNAL,
"jinja2.compile",
kind=SpanKind.INTERNAL,
) as span:
if span.is_recording():
template_name = (
Expand All @@ -101,7 +103,8 @@ def _wrap_compile(tracer, wrapped, _, args, kwargs):
@_with_tracer_wrapper
def _wrap_load_template(tracer, wrapped, _, args, kwargs):
with tracer.start_as_current_span(
"jinja2.load", kind=SpanKind.INTERNAL,
"jinja2.load",
kind=SpanKind.INTERNAL,
) as span:
if span.is_recording():
template_name = kwargs.get("name", args[0])
Expand Down
Loading

0 comments on commit 422d67d

Please sign in to comment.