Skip to content

Commit

Permalink
Remove _with_limits() from tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
owais committed May 24, 2021
1 parent f8a445a commit 96faf0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,6 @@ def __init__(
self.instrumentation_info = instrumentation_info
self._limits = None

def _with_limits(self, limits: _Limits) -> "Tracer":
self._limits = limits
return self

@contextmanager
def start_as_current_span(
self,
Expand Down Expand Up @@ -1023,15 +1019,17 @@ def get_tracer(
if not instrumenting_module_name: # Reject empty strings too.
instrumenting_module_name = ""
logger.error("get_tracer called with missing module name.")
return Tracer(
tracer = Tracer(
self.sampler,
self.resource,
self._active_span_processor,
self.id_generator,
InstrumentationInfo(
instrumenting_module_name, instrumenting_library_version
),
)._with_limits(self._limits)
)
tracer._limits = self._limits
return tracer

def add_span_processor(self, span_processor: SpanProcessor) -> None:
"""Registers a new :class:`SpanProcessor` for this `TracerProvider`.
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ def test_surplus_span_links(self):
self.assertEqual(len(root.links), max_links)

def test_surplus_span_attributes(self):
# pylint: disable=protected-access
max_attrs = trace._Limits().max_attributes
attributes = {str(idx): idx for idx in range(0, 16 + max_attrs)}
tracer = new_tracer()
Expand Down

0 comments on commit 96faf0e

Please sign in to comment.