Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/5272.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-sdk`: remove unnecessary `copy` in Span creation
11 changes: 11 additions & 0 deletions opentelemetry-sdk/benchmarks/trace/test_benchmark_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ def benchmark_start_span():
benchmark(benchmark_start_span)


@pytest.mark.parametrize("num_attrs", [0, 1, 10, 50, 128])
def test_start_span_with_attributes(benchmark, num_attrs):
attrs = {f"key{i}": f"value{i}" for i in range(num_attrs)}

def benchmark_start_span():
span = tracer.start_span("benchmarkedSpan", attributes=attrs)
span.end()

benchmark(benchmark_start_span)


# pylint: disable=protected-access,redefined-outer-name
def test_simple_start_span_with_tracer_configurator_rules(
benchmark, num_tracer_configurator_rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ def start_span( # pylint: disable=too-many-locals
parent=parent_span_context,
sampler=self.sampler,
resource=self.resource,
attributes=sampling_result.attributes.copy(),
attributes=sampling_result.attributes,
span_processor=self.span_processor,
kind=kind,
links=links,
Expand Down
Loading