-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee82353
commit 3a17576
Showing
5 changed files
with
39 additions
and
98 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
20 changes: 4 additions & 16 deletions
20
contract-tests/tests/test/amazon/misc/service_name_in_env_var_test.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 |
---|---|---|
@@ -1,30 +1,18 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Dict, List | ||
|
||
from mock_collector_client import ResourceScopeMetric, ResourceScopeSpan | ||
from resource_attributes_test_base import ResourceAttributesTest, _get_k8s_attributes | ||
from typing_extensions import override | ||
|
||
from resource_attributes_test_base import ResourceAttributesTest | ||
from amazon.utils.app_signals_constants import AWS_LOCAL_OPERATION, AWS_LOCAL_SERVICE, AWS_SPAN_KIND | ||
from opentelemetry.proto.common.v1.common_pb2 import AnyValue, KeyValue | ||
from opentelemetry.proto.metrics.v1.metrics_pb2 import ExponentialHistogramDataPoint, Metric | ||
from opentelemetry.proto.trace.v1.trace_pb2 import Span | ||
from opentelemetry.semconv.trace import SpanAttributes | ||
from requests import Response, request | ||
|
||
class ServiceNameInResourceAttributesTest(ResourceAttributesTest): | ||
|
||
@override | ||
def get_application_extra_environment_variables(self) -> str: | ||
return {"DJANGO_SETTINGS_MODULE": "django_server.settings"} | ||
|
||
@override | ||
# pylint: disable=no-self-use | ||
def get_application_otel_resource_attributes(self): | ||
pairlist = [] | ||
for key, value in self._get_k8s_attributes().items(): | ||
for key, value in _get_k8s_attributes().items(): | ||
pairlist.append(key + "=" + value) | ||
return ','.join(pairlist) | ||
return ",".join(pairlist) | ||
|
||
def test_service(self): | ||
self.do_misc_test_request("unknown_service") |
15 changes: 4 additions & 11 deletions
15
contract-tests/tests/test/amazon/misc/service_name_in_resource_attributes_test.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 |
---|---|---|
@@ -1,27 +1,20 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Dict, List | ||
|
||
from mock_collector_client import ResourceScopeMetric, ResourceScopeSpan | ||
from resource_attributes_test_base import ResourceAttributesTest, _get_k8s_attributes | ||
from typing_extensions import override | ||
|
||
from resource_attributes_test_base import ResourceAttributesTest | ||
from amazon.utils.app_signals_constants import AWS_LOCAL_OPERATION, AWS_LOCAL_SERVICE, AWS_SPAN_KIND | ||
from opentelemetry.proto.common.v1.common_pb2 import AnyValue, KeyValue | ||
from opentelemetry.proto.metrics.v1.metrics_pb2 import ExponentialHistogramDataPoint, Metric | ||
from opentelemetry.proto.trace.v1.trace_pb2 import Span | ||
from opentelemetry.semconv.trace import SpanAttributes | ||
from requests import Response, request | ||
|
||
class ServiceNameInResourceAttributesTest(ResourceAttributesTest): | ||
|
||
@override | ||
# pylint: disable=no-self-use | ||
def get_application_otel_resource_attributes(self): | ||
pairlist = [] | ||
for key, value in self._get_k8s_attributes().items(): | ||
for key, value in _get_k8s_attributes().items(): | ||
pairlist.append(key + "=" + value) | ||
pairlist.append("service.name=service-name") | ||
return ','.join(pairlist) | ||
return ",".join(pairlist) | ||
|
||
def test_service(self): | ||
self.do_misc_test_request("service-name") |
20 changes: 6 additions & 14 deletions
20
contract-tests/tests/test/amazon/misc/unknown_service_name_test.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 |
---|---|---|
@@ -1,31 +1,23 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Dict, List | ||
|
||
from mock_collector_client import ResourceScopeMetric, ResourceScopeSpan | ||
from resource_attributes_test_base import ResourceAttributesTest, _get_k8s_attributes | ||
from typing_extensions import override | ||
|
||
from resource_attributes_test_base import ResourceAttributesTest | ||
from amazon.utils.app_signals_constants import AWS_LOCAL_OPERATION, AWS_LOCAL_SERVICE, AWS_SPAN_KIND | ||
from opentelemetry.proto.common.v1.common_pb2 import AnyValue, KeyValue | ||
from opentelemetry.proto.metrics.v1.metrics_pb2 import ExponentialHistogramDataPoint, Metric | ||
from opentelemetry.proto.trace.v1.trace_pb2 import Span | ||
from opentelemetry.semconv.trace import SpanAttributes | ||
from requests import Response, request | ||
|
||
class ServiceNameInResourceAttributesTest(ResourceAttributesTest): | ||
|
||
@override | ||
# pylint: disable=no-self-use | ||
def get_application_extra_environment_variables(self) -> str: | ||
return {"DJANGO_SETTINGS_MODULE": "django_server.settings", | ||
"OTEL_SERVICE_NAME": "service-name-test"} | ||
return {"DJANGO_SETTINGS_MODULE": "django_server.settings", "OTEL_SERVICE_NAME": "service-name-test"} | ||
|
||
@override | ||
# pylint: disable=no-self-use | ||
def get_application_otel_resource_attributes(self): | ||
pairlist = [] | ||
for key, value in self._get_k8s_attributes().items(): | ||
for key, value in _get_k8s_attributes().items(): | ||
pairlist.append(key + "=" + value) | ||
return ','.join(pairlist) | ||
return ",".join(pairlist) | ||
|
||
def test_service(self): | ||
self.do_misc_test_request("service-name-test") |