Skip to content

Commit

Permalink
Fixing Linting Issues as per the review comments
Browse files Browse the repository at this point in the history
Signed-off-by: C, Chandru <[email protected]>
  • Loading branch information
the-chandru committed Jul 23, 2024
1 parent de1ebc5 commit 311d679
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
LoggingInstrumentor,
)
from opentelemetry.test.test_base import TestBase
from opentelemetry.trace import ProxyTracer, get_tracer, NoOpTracerProvider
from opentelemetry.trace import NoOpTracerProvider, ProxyTracer, get_tracer


class FakeTracerProvider:
Expand Down Expand Up @@ -209,16 +209,16 @@ def test_uninstrumented(self):
self.assertFalse(hasattr(record, "otelTraceSampled"))

def test_no_op_tracer_provider(self):
LoggingInstrumentor().uninstrument()
LoggingInstrumentor().instrument(tracer_provider=NoOpTracerProvider())
with self.caplog.at_level(level=logging.INFO):
logger = logging.getLogger("test logger")
logger.info("hello")
self.assertEqual(len(self.caplog.records), 1)
record = self.caplog.records[0]
self.assertEqual(record.otelSpanID, "0")
self.assertEqual(record.otelTraceID, "0")
self.assertEqual(record.otelServiceName, "")
self.assertEqual(record.otelTraceSampled, False)
LoggingInstrumentor().uninstrument()
LoggingInstrumentor().instrument(tracer_provider=NoOpTracerProvider())

with self.caplog.at_level(level=logging.INFO):
logger = logging.getLogger("test logger")
logger.info("hello")

self.assertEqual(len(self.caplog.records), 1)
record = self.caplog.records[0]
self.assertEqual(record.otelSpanID, "0")
self.assertEqual(record.otelTraceID, "0")
self.assertEqual(record.otelServiceName, "")
self.assertEqual(record.otelTraceSampled, False)

0 comments on commit 311d679

Please sign in to comment.