-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add performance tests to AWS SDK Extension (#243)
- Loading branch information
1 parent
be463c5
commit 91bfc9a
Showing
5 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...sion-aws/tests/performance/benchmarks/trace/propagation/test_benchmark_aws_xray_format.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from requests.structures import CaseInsensitiveDict | ||
|
||
from opentelemetry.sdk.extension.aws.trace.propagation.aws_xray_format import ( | ||
TRACE_HEADER_KEY, | ||
AwsXRayFormat, | ||
) | ||
from opentelemetry.trace.propagation.textmap import DictGetter | ||
|
||
XRAY_PROPAGATOR = AwsXRayFormat() | ||
|
||
|
||
def test_extract_single_header(benchmark): | ||
benchmark( | ||
XRAY_PROPAGATOR.extract, | ||
DictGetter(), | ||
{ | ||
TRACE_HEADER_KEY: "bdb5b63237ed38aea578af665aa5aa60-00000000000000000c32d953d73ad225" | ||
}, | ||
) | ||
|
||
|
||
def test_inject_empty_context(benchmark): | ||
benchmark(XRAY_PROPAGATOR.inject, CaseInsensitiveDict.__setitem__, {}) |
25 changes: 25 additions & 0 deletions
25
...extension-aws/tests/performance/benchmarks/trace/test_benchmark_aws_xray_ids_generator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from opentelemetry.sdk.extension.aws.trace import AwsXRayIdsGenerator | ||
|
||
ids_generator = AwsXRayIdsGenerator() | ||
|
||
|
||
def test_generate_xray_trace_id(benchmark): | ||
benchmark(ids_generator.generate_trace_id) | ||
|
||
|
||
def test_generate_xray_span_id(benchmark): | ||
benchmark(ids_generator.generate_span_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters