Skip to content

Commit 146af7e

Browse files
authored
Use Application Signals wherever possible (#149)
In this commit, we are changing `appsignals`, `app_signals`, `app_signals`, and `app signals` to `applicationsignals`, `application_signals`, `application-signals`, and `application signals` wherever possible. Callout `aws-application-signals-team` was created here: https://github.com/orgs/aws-observability/teams/aws-application-signals-team and has correct permissions on this repo. Remaining usages: * `aws_opentelemetry_configurator.py` - we have to support both old and new config names (e.g. `OTEL_AWS_APP_SIGNALS_ENABLED` and `OTEL_AWS_APPLICATION_SIGNALS_ENABLED`) * `application-signals-python-e2e-eks-test.yml`, `application-signals-python-e2e-ec2-test.yml`, `appsignals-python-e2e-eks-canary-test.yml`, and `appsignals-python-e2e-ec2-canary-test.yml` - various reasons: * We rely on `appsignals` referenced in other repos that need to be updated first. * We emit metrics containing `appsignals`, which we have alarms on - changing is non-trivial. * Workflow names and urls contain `appsignals` - changing would break links (including runbooks). * We are depending on github secrets that are named `appsignals` ``` > grep -ir 'app_sig' . ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py:APP_SIGNALS_ENABLED_CONFIG = "OTEL_AWS_APP_SIGNALS_ENABLED" ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py:APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG = "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT" ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py: os.environ.get(APPLICATION_SIGNALS_ENABLED_CONFIG, os.environ.get(APP_SIGNALS_ENABLED_CONFIG, "false")).lower() ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py: os.environ.get(APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG, "http://localhost:4315"), ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}" \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}" ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: -var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}" ./.github/workflows/application-signals-python-e2e-ec2-test.yml: TEST_ACCOUNT: ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }} > grep -ir 'app sig' . ./.github/workflows/appsignals-python-e2e-ec2-canary-test.yml:name: App Signals Enablement - Python E2E EC2 Canary Testing ./.github/workflows/appsignals-python-e2e-eks-canary-test.yml:name: App Signals Enablement - Python E2E EKS Canary Testing > grep -ir 'appsig' . ./.github/workflows/appsignals-python-e2e-ec2-canary-test.yml: caller-workflow-name: 'appsignals-python-e2e-ec2-canary-test' ./.github/workflows/appsignals-python-e2e-eks-canary-test.yml: caller-workflow-name: 'appsignals-python-e2e-eks-canary-test' ./.github/workflows/application-signals-python-e2e-eks-test.yml: METRIC_NAMESPACE: AppSignals ./.github/workflows/application-signals-python-e2e-eks-test.yml: LOG_GROUP_NAME: /aws/appsignals/eks ./.github/workflows/application-signals-python-e2e-eks-test.yml: command: "wget https://raw.githubusercontent.com/aws-observability/application-signals-demo/main/scripts/eks/appsignals/enable-app-signals.sh ./.github/workflows/application-signals-python-e2e-eks-test.yml: && wget https://raw.githubusercontent.com/aws-observability/application-signals-demo/main/scripts/eks/appsignals/clean-app-signals.sh" ./.github/workflows/application-signals-python-e2e-ec2-test.yml: METRIC_NAMESPACE: AppSignals ./.github/workflows/application-signals-python-e2e-ec2-test.yml: LOG_GROUP_NAME: /aws/appsignals/generic > grep -ir 'app-sig' . ./.github/workflows/application-signals-python-e2e-eks-test.yml: command: "wget https://raw.githubusercontent.com/aws-observability/application-signals-demo/main/scripts/eks/appsignals/enable-app-signals.sh ./.github/workflows/application-signals-python-e2e-eks-test.yml: && wget https://raw.githubusercontent.com/aws-observability/application-signals-demo/main/scripts/eks/appsignals/clean-app-signals.sh" ./.github/workflows/application-signals-python-e2e-eks-test.yml: cleanup: "rm -f enable-app-signals.sh && rm -f clean-app-signals.sh" ./.github/workflows/application-signals-python-e2e-eks-test.yml: post-command: "chmod +x enable-app-signals.sh && chmod +x clean-app-signals.sh" ./.github/workflows/application-signals-python-e2e-eks-test.yml: sed -i "s#$delete_log_group##g" clean-app-signals.sh ./.github/workflows/application-signals-python-e2e-eks-test.yml: "${GITHUB_WORKSPACE}/enablement-script/enable-app-signals.sh \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: "${GITHUB_WORKSPACE}/enablement-script/clean-app-signals.sh \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: ${GITHUB_WORKSPACE}/enablement-script/clean-app-signals.sh \ ./.github/workflows/application-signals-python-e2e-eks-test.yml: # Running clean-app-signal.sh removes the current cluster from the config. Update the cluster again for subsequent runs. ./.github/workflows/application-signals-python-e2e-eks-test.yml: ./clean-app-signals.sh \ ``` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 21b9d68 commit 146af7e

File tree

16 files changed

+100
-88
lines changed

16 files changed

+100
-88
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://help.github.com/en/articles/about-code-owners
33

44
# Default owners for the entire repo
5-
* @aws-observability/aws-appsignals-team
5+
* @aws-observability/aws-application-signals-team
66

77
# Owners for aws-otel-distro folder
88
/aws-otel-distro/ @zzhlogin @thpierce @srprash @AsakerMohd

.github/workflows/appsignals-python-e2e-ec2-test.yml renamed to .github/workflows/application-signals-python-e2e-ec2-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
## SPDX-License-Identifier: Apache-2.0
33

4-
# This is a reusable workflow for running the Python E2E Canary test for App Signals.
4+
# This is a reusable workflow for running the Python E2E Canary test for Application Signals.
55
# It is meant to be called from another workflow.
66
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
7-
name: App Signals Enablement E2E Testing - Python EC2 Use Case
7+
name: Application Signals Enablement E2E Testing - Python EC2 Use Case
88
on:
99
workflow_call:
1010
inputs:

.github/workflows/appsignals-python-e2e-eks-test.yml renamed to .github/workflows/application-signals-python-e2e-eks-test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
## SPDX-License-Identifier: Apache-2.0
33

4-
# This is a reusable workflow for running the E2E test for App Signals.
4+
# This is a reusable workflow for running the E2E test for Application Signals.
55
# It is meant to be called from another workflow.
66
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
7-
name: App Signals Enablement E2E Testing - Python EKS
7+
name: Application Signals Enablement E2E Testing - Python EKS
88
on:
99
workflow_call:
1010
inputs:
@@ -14,10 +14,10 @@ on:
1414
test-cluster-name:
1515
required: true
1616
type: string
17-
appsignals-adot-image:
17+
application-signals-adot-image:
1818
required: false
1919
type: string
20-
appsignals-adot-image-tag:
20+
application-signals-adot-image-tag:
2121
required: false
2222
type: string
2323
caller-workflow-name:
@@ -164,9 +164,9 @@ jobs:
164164
fi
165165
166166
# If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint
167-
# after installing App Signals. Attempts to connect will be made for up to 10 minutes
167+
# after installing Application Signals. Attempts to connect will be made for up to 10 minutes
168168
if [ $deployment_failed -eq 0 ]; then
169-
echo "Installing app signals to the sample app"
169+
echo "Installing application signals to the sample app"
170170
source ${GITHUB_WORKSPACE}/.github/workflows/util/execute_and_retry.sh
171171
execute_and_retry 2 \
172172
"${GITHUB_WORKSPACE}/enablement-script/enable-app-signals.sh \
@@ -182,7 +182,7 @@ jobs:
182182
if [ "${{ inputs.caller-workflow-name }}" == "main-build" ]; then
183183
echo "Patching staging adot image for main build:"
184184
execute_and_retry 2 "kubectl patch deploy -namazon-cloudwatch amazon-cloudwatch-observability-controller-manager --type='json' \
185-
-p='[{"op": \"replace\", \"path\": \"/spec/template/spec/containers/0/args/0\", \"value\": \"--auto-instrumentation-python-image=${{ inputs.appsignals-adot-image }}:${{ inputs.appsignals-adot-image-tag }}\"}]'"
185+
-p='[{"op": \"replace\", \"path\": \"/spec/template/spec/containers/0/args/0\", \"value\": \"--auto-instrumentation-python-image=${{ inputs.application-signals-adot-image }}:${{ inputs.application-signals-adot-image-tag }}\"}]'"
186186
execute_and_retry 2 "kubectl delete pods --all -n amazon-cloudwatch"
187187
execute_and_retry 2 "kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch"
188188
fi
@@ -210,7 +210,7 @@ jobs:
210210
# If the deployment_failed is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
211211
# resources created from terraform and try again.
212212
if [ $deployment_failed -eq 1 ]; then
213-
echo "Cleaning up App Signal"
213+
echo "Cleaning up Application Signal"
214214
${GITHUB_WORKSPACE}/enablement-script/clean-app-signals.sh \
215215
${{ inputs.test-cluster-name }} \
216216
${{ inputs.aws-region }} \
@@ -271,7 +271,7 @@ jobs:
271271
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}
272272
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/client-call
273273
274-
# Validation for app signals telemetry data
274+
# Validation for application signals telemetry data
275275
- name: Call endpoint and validate generated EMF logs
276276
id: log-validation
277277
if: steps.deploy-python-app.outcome == 'success' && !cancelled()
@@ -343,7 +343,7 @@ jobs:
343343
344344
# Clean up Procedures
345345

346-
- name: Clean Up App Signals
346+
- name: Clean Up Application Signals
347347
if: always()
348348
continue-on-error: true
349349
working-directory: enablement-script

.github/workflows/appsignals-python-e2e-ec2-canary-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## SPDX-License-Identifier: Apache-2.0
33

44
## This workflow aims to run the Application Signals Python end-to-end tests as a canary to
5-
## test the artifacts for App Signals enablement. It will deploy a sample app and remote
5+
## test the artifacts for Application Signals enablement. It will deploy a sample app and remote
66
## service on two EC2 instances, call the APIs, and validate the generated telemetry,
77
## including logs, metrics, and traces.
88
name: App Signals Enablement - Python E2E EC2 Canary Testing
@@ -24,7 +24,7 @@ jobs:
2424
'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
2525
'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
2626
'us-east-1','us-east-2', 'us-west-1', 'us-west-2']
27-
uses: ./.github/workflows/appsignals-python-e2e-ec2-test.yml
27+
uses: ./.github/workflows/application-signals-python-e2e-ec2-test.yml
2828
secrets: inherit
2929
with:
3030
aws-region: ${{ matrix.aws-region }}

.github/workflows/appsignals-python-e2e-eks-canary-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## SPDX-License-Identifier: Apache-2.0
33

44
## This workflow aims to run the Application Signals Python end-to-end tests as a canary to
5-
## test the artifacts for App Signals enablement. It will deploy a sample app and remote
5+
## test the artifacts for Application Signals enablement. It will deploy a sample app and remote
66
## service onto an EKS cluster, call the APIs, and validate the generated telemetry,
77
## including logs, metrics, and traces.
88
name: App Signals Enablement - Python E2E EKS Canary Testing
@@ -29,9 +29,9 @@ jobs:
2929
'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
3030
'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
3131
'us-east-1','us-east-2', 'us-west-1', 'us-west-2']
32-
uses: ./.github/workflows/appsignals-python-e2e-eks-test.yml
32+
uses: ./.github/workflows/application-signals-python-e2e-eks-test.yml
3333
secrets: inherit
3434
with:
3535
aws-region: ${{ matrix.aws-region }}
3636
test-cluster-name: 'e2e-python-canary-test'
37-
caller-workflow-name: 'appsignals-python-e2e-eks-canary-test'
37+
caller-workflow-name: 'appsignals-python-e2e-eks-canary-test'

.github/workflows/main_build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,22 @@ jobs:
8686
pip install pytest
8787
pytest contract-tests/tests
8888
89-
# AppSignals specific e2e eks tests
90-
appsignals-python-e2e-eks-test:
89+
# Application Signals specific e2e eks tests
90+
application-signals-python-e2e-eks-test:
9191
needs: [build]
92-
uses: ./.github/workflows/appsignals-python-e2e-eks-test.yml
92+
uses: ./.github/workflows/application-signals-python-e2e-eks-test.yml
9393
secrets: inherit
9494
with:
9595
aws-region: ${{ needs.build.outputs.aws_default_region }}
9696
test-cluster-name: e2e-python-adot-test
9797
caller-workflow-name: 'main-build'
98-
appsignals-adot-image: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging
99-
appsignals-adot-image-tag: ${{ needs.build.outputs.python_image_tag }}
98+
application-signals-adot-image: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging
99+
application-signals-adot-image-tag: ${{ needs.build.outputs.python_image_tag }}
100100

101-
# AppSignals specific e2e tests for ec2
102-
appsignals-python-e2e-ec2-test:
101+
# Application Signals specific e2e tests for ec2
102+
application-signals-python-e2e-ec2-test:
103103
needs: [ build ]
104-
uses: ./.github/workflows/appsignals-python-e2e-ec2-test.yml
104+
uses: ./.github/workflows/application-signals-python-e2e-ec2-test.yml
105105
secrets: inherit
106106
with:
107107
aws-region: ${{ needs.build.outputs.aws_default_region }}

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@
5757
from opentelemetry.semconv.resource import ResourceAttributes
5858
from opentelemetry.trace import set_tracer_provider
5959

60-
OTEL_AWS_APP_SIGNALS_ENABLED = "OTEL_AWS_APP_SIGNALS_ENABLED"
61-
OTEL_METRIC_EXPORT_INTERVAL = "OTEL_METRIC_EXPORT_INTERVAL"
62-
OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT = "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT"
60+
APP_SIGNALS_ENABLED_CONFIG = "OTEL_AWS_APP_SIGNALS_ENABLED"
61+
APPLICATION_SIGNALS_ENABLED_CONFIG = "OTEL_AWS_APPLICATION_SIGNALS_ENABLED"
62+
APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG = "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT"
63+
APPLICATION_SIGNALS_EXPORTER_ENDPOINT_CONFIG = "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT"
64+
METRIC_EXPORT_INTERVAL_CONFIG = "OTEL_METRIC_EXPORT_INTERVAL"
6365
DEFAULT_METRIC_EXPORT_INTERVAL = 60000.0
6466

6567
_logger: Logger = getLogger(__name__)
@@ -74,8 +76,8 @@ class AwsOpenTelemetryConfigurator(_OTelSDKConfigurator):
7476
- Add AttributePropagatingSpanProcessor to propagate span attributes from parent to child spans.
7577
- Add AwsMetricAttributesSpanExporter to add more attributes to all spans.
7678
77-
You can control when these customizations are applied using the environment variable OTEL_AWS_APP_SIGNALS_ENABLED.
78-
This flag is disabled by default.
79+
You can control when these customizations are applied using the environment variable
80+
OTEL_AWS_APPLICATION_SIGNALS_ENABLED. This flag is disabled by default.
7981
"""
8082

8183
# pylint: disable=no-self-use
@@ -210,38 +212,38 @@ def _custom_import_sampler(sampler_name: str, resource: Resource) -> Sampler:
210212

211213

212214
def _customize_sampler(sampler: Sampler) -> Sampler:
213-
if not _is_app_signals_enabled():
215+
if not _is_application_signals_enabled():
214216
return sampler
215217
return AlwaysRecordSampler(sampler)
216218

217219

218220
def _customize_exporter(span_exporter: SpanExporter, resource: Resource) -> SpanExporter:
219-
if not _is_app_signals_enabled():
221+
if not _is_application_signals_enabled():
220222
return span_exporter
221223
return AwsMetricAttributesSpanExporterBuilder(span_exporter, resource).build()
222224

223225

224226
def _customize_span_processors(provider: TracerProvider, resource: Resource) -> None:
225-
if not _is_app_signals_enabled():
227+
if not _is_application_signals_enabled():
226228
return
227229

228230
# Construct and set local and remote attributes span processor
229231
provider.add_span_processor(AttributePropagatingSpanProcessorBuilder().build())
230232

231233
# Construct meterProvider
232-
_logger.info("AWS AppSignals enabled")
233-
otel_metric_exporter = AppSignalsExporterProvider().create_exporter()
234-
export_interval_millis = float(os.environ.get(OTEL_METRIC_EXPORT_INTERVAL, DEFAULT_METRIC_EXPORT_INTERVAL))
234+
_logger.info("AWS Application Signals enabled")
235+
otel_metric_exporter = ApplicationSignalsExporterProvider().create_exporter()
236+
export_interval_millis = float(os.environ.get(METRIC_EXPORT_INTERVAL_CONFIG, DEFAULT_METRIC_EXPORT_INTERVAL))
235237
_logger.debug("Span Metrics export interval: %s", export_interval_millis)
236238
# Cap export interval to 60 seconds. This is currently required for metrics-trace correlation to work correctly.
237239
if export_interval_millis > DEFAULT_METRIC_EXPORT_INTERVAL:
238240
export_interval_millis = DEFAULT_METRIC_EXPORT_INTERVAL
239-
_logger.info("AWS AppSignals metrics export interval capped to %s", export_interval_millis)
241+
_logger.info("AWS Application Signals metrics export interval capped to %s", export_interval_millis)
240242
periodic_exporting_metric_reader = PeriodicExportingMetricReader(
241243
exporter=otel_metric_exporter, export_interval_millis=export_interval_millis
242244
)
243245
meter_provider: MeterProvider = MeterProvider(resource=resource, metric_readers=[periodic_exporting_metric_reader])
244-
# Construct and set AppSignals metrics processor
246+
# Construct and set application signals metrics processor
245247
provider.add_span_processor(AwsSpanMetricsProcessorBuilder(meter_provider, resource).build())
246248

247249
return
@@ -254,12 +256,15 @@ def _customize_versions(auto_resource: Dict[str, any]) -> Dict[str, any]:
254256
return auto_resource
255257

256258

257-
def _is_app_signals_enabled():
258-
return os.environ.get(OTEL_AWS_APP_SIGNALS_ENABLED, "false").lower() == "true"
259+
def _is_application_signals_enabled():
260+
return (
261+
os.environ.get(APPLICATION_SIGNALS_ENABLED_CONFIG, os.environ.get(APP_SIGNALS_ENABLED_CONFIG, "false")).lower()
262+
== "true"
263+
)
259264

260265

261-
class AppSignalsExporterProvider:
262-
_instance: ClassVar["AppSignalsExporterProvider"] = None
266+
class ApplicationSignalsExporterProvider:
267+
_instance: ClassVar["ApplicationSignalsExporterProvider"] = None
263268

264269
def __new__(cls, *args, **kwargs):
265270
if cls._instance is None:
@@ -271,11 +276,14 @@ def create_exporter(self):
271276
protocol = os.environ.get(
272277
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL, os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc")
273278
)
274-
_logger.debug("AppSignals export protocol: %s", protocol)
279+
_logger.debug("AWS Application Signals export protocol: %s", protocol)
275280

276-
app_signals_endpoint = os.environ.get(OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT, "http://localhost:4315")
281+
application_signals_endpoint = os.environ.get(
282+
APPLICATION_SIGNALS_EXPORTER_ENDPOINT_CONFIG,
283+
os.environ.get(APP_SIGNALS_EXPORTER_ENDPOINT_CONFIG, "http://localhost:4315"),
284+
)
277285

278-
_logger.debug("AppSignals export endpoint: %s", app_signals_endpoint)
286+
_logger.debug("AWS Application Signals export endpoint: %s", application_signals_endpoint)
279287

280288
temporality_dict: Dict[type, AggregationTemporality] = {}
281289
for typ in [
@@ -290,8 +298,12 @@ def create_exporter(self):
290298
temporality_dict[typ] = AggregationTemporality.DELTA
291299

292300
if protocol == "http/protobuf":
293-
return OTLPHttpOTLPMetricExporter(endpoint=app_signals_endpoint, preferred_temporality=temporality_dict)
301+
return OTLPHttpOTLPMetricExporter(
302+
endpoint=application_signals_endpoint, preferred_temporality=temporality_dict
303+
)
294304
if protocol == "grpc":
295-
return OTLPGrpcOTLPMetricExporter(endpoint=app_signals_endpoint, preferred_temporality=temporality_dict)
305+
return OTLPGrpcOTLPMetricExporter(
306+
endpoint=application_signals_endpoint, preferred_temporality=temporality_dict
307+
)
296308

297-
raise RuntimeError(f"Unsupported AppSignals export protocol: {protocol} ")
309+
raise RuntimeError(f"Unsupported AWS Application Signals export protocol: {protocol} ")

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
_customize_exporter,
1515
_customize_sampler,
1616
_customize_span_processors,
17-
_is_app_signals_enabled,
17+
_is_application_signals_enabled,
1818
)
1919
from amazon.opentelemetry.distro.aws_opentelemetry_distro import AwsOpenTelemetryDistro
2020
from amazon.opentelemetry.distro.aws_span_metrics_processor import AwsSpanMetricsProcessor
@@ -202,50 +202,50 @@ def test_not_using_xray_sampler_does_not_modify_url_exclusion_env_vars(self):
202202
self.assertEqual(os.environ.get("OTEL_PYTHON_REQUESTS_EXCLUDED_URLS", None), ",,,target_A,target_B,,,")
203203
self.assertEqual(os.environ.get("OTEL_PYTHON_URLLIB3_EXCLUDED_URLS", None), "target_C,target_D")
204204

205-
def test_is_app_signals_enabled(self):
206-
os.environ.setdefault("OTEL_AWS_APP_SIGNALS_ENABLED", "True")
207-
self.assertTrue(_is_app_signals_enabled())
208-
os.environ.pop("OTEL_AWS_APP_SIGNALS_ENABLED", None)
205+
def test_is_application_signals_enabled(self):
206+
os.environ.setdefault("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "True")
207+
self.assertTrue(_is_application_signals_enabled())
208+
os.environ.pop("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", None)
209209

210-
os.environ.setdefault("OTEL_AWS_APP_SIGNALS_ENABLED", "False")
211-
self.assertFalse(_is_app_signals_enabled())
212-
os.environ.pop("OTEL_AWS_APP_SIGNALS_ENABLED", None)
213-
self.assertFalse(_is_app_signals_enabled())
210+
os.environ.setdefault("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "False")
211+
self.assertFalse(_is_application_signals_enabled())
212+
os.environ.pop("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", None)
213+
self.assertFalse(_is_application_signals_enabled())
214214

215215
def test_customize_sampler(self):
216216
mock_sampler: Sampler = MagicMock()
217217
customized_sampler: Sampler = _customize_sampler(mock_sampler)
218218
self.assertEqual(mock_sampler, customized_sampler)
219219

220-
os.environ.setdefault("OTEL_AWS_APP_SIGNALS_ENABLED", "True")
220+
os.environ.setdefault("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "True")
221221
customized_sampler = _customize_sampler(mock_sampler)
222222
self.assertNotEqual(mock_sampler, customized_sampler)
223223
self.assertIsInstance(customized_sampler, AlwaysRecordSampler)
224224
self.assertEqual(mock_sampler, customized_sampler._root_sampler)
225-
os.environ.pop("OTEL_AWS_APP_SIGNALS_ENABLED", None)
225+
os.environ.pop("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", None)
226226

227227
def test_customize_exporter(self):
228228
mock_exporter: SpanExporter = MagicMock()
229229
customized_exporter: SpanExporter = _customize_exporter(mock_exporter, Resource.get_empty())
230230
self.assertEqual(mock_exporter, customized_exporter)
231231

232-
os.environ.setdefault("OTEL_AWS_APP_SIGNALS_ENABLED", "True")
232+
os.environ.setdefault("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "True")
233233
customized_exporter = _customize_exporter(mock_exporter, Resource.get_empty())
234234
self.assertNotEqual(mock_exporter, customized_exporter)
235235
self.assertIsInstance(customized_exporter, AwsMetricAttributesSpanExporter)
236236
self.assertEqual(mock_exporter, customized_exporter._delegate)
237-
os.environ.pop("OTEL_AWS_APP_SIGNALS_ENABLED", None)
237+
os.environ.pop("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", None)
238238

239239
def test_customize_span_processors(self):
240240
mock_tracer_provider: TracerProvider = MagicMock()
241241
_customize_span_processors(mock_tracer_provider, Resource.get_empty())
242242
self.assertEqual(mock_tracer_provider.add_span_processor.call_count, 0)
243243

244-
os.environ.setdefault("OTEL_AWS_APP_SIGNALS_ENABLED", "True")
244+
os.environ.setdefault("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", "True")
245245
_customize_span_processors(mock_tracer_provider, Resource.get_empty())
246246
self.assertEqual(mock_tracer_provider.add_span_processor.call_count, 2)
247247
first_processor: SpanProcessor = mock_tracer_provider.add_span_processor.call_args_list[0].args[0]
248248
self.assertIsInstance(first_processor, AttributePropagatingSpanProcessor)
249249
second_processor: SpanProcessor = mock_tracer_provider.add_span_processor.call_args_list[1].args[0]
250250
self.assertIsInstance(second_processor, AwsSpanMetricsProcessor)
251-
os.environ.pop("OTEL_AWS_APP_SIGNALS_ENABLED", None)
251+
os.environ.pop("OTEL_AWS_APPLICATION_SIGNALS_ENABLED", None)

0 commit comments

Comments
 (0)