Skip to content

Commit 5a3437f

Browse files
authored
Merge branch 'main' into MCP-Instrumentor
2 parents de1020e + f5770d9 commit 5a3437f

File tree

15 files changed

+489
-56
lines changed

15 files changed

+489
-56
lines changed

.github/actions/artifacts_build/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ runs:
104104
uses: ./.github/actions/image_scan
105105
with:
106106
image-ref: ${{ inputs.image_uri_with_tag }}
107-
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
107+
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
108+
logout: 'true'

.github/actions/image_scan/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ inputs:
1111
severity:
1212
required: true
1313
description: "List of severities that will cause a failure"
14+
logout:
15+
required: true
16+
description: |
17+
Whether to logout of public AWS ECR. Set to 'true' for PR workflows to avoid potential call failures,
18+
'false' for daily scans which has a higher bar for passing regularly and specifically wants to sign in.
1419
1520
runs:
1621
using: "composite"
@@ -22,6 +27,7 @@ runs:
2227
# ensure we can make unauthenticated call. This is important for making the pr_build workflow run on
2328
# PRs created from forked repos.
2429
- name: Logout of public AWS ECR
30+
if: inputs.logout == 'true'
2531
shell: bash
2632
run: docker logout public.ecr.aws
2733

@@ -30,4 +36,4 @@ runs:
3036
with:
3137
image-ref: ${{ inputs.image-ref }}
3238
severity: ${{ inputs.severity }}
33-
exit-code: '1'
39+
exit-code: '1'

.github/workflows/daily_scan.yml renamed to .github/workflows/daily-scan.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
name: Daily scan
99

1010
on:
11-
schedule:
12-
- cron: '0 18 * * *' # scheduled to run at 18:00 UTC every day
11+
schedule: # scheduled to run at 14:00, 20:00, 02:00 UTC every day
12+
- cron: '0 14 * * *' # 6:00/7:00 PST/PDT (14:00 UTC)
13+
- cron: '0 20 * * *' # 12:00/13:00 PST/PDT (20:00 UTC)
14+
- cron: '0 02 * * *' # 18:00/19:00 PST/PDT (02:00 UTC)
1315
workflow_dispatch: # be able to run the workflow on demand
1416

1517
env:
@@ -77,21 +79,34 @@ jobs:
7779
if: ${{ steps.dep_scan.outcome != 'success' }}
7880
run: less dependency-check-report.html
7981

82+
- name: Configure AWS credentials for image scan
83+
uses: aws-actions/configure-aws-credentials@v4
84+
with:
85+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
86+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
87+
88+
- name: Login to Public ECR
89+
uses: docker/login-action@v3
90+
with:
91+
registry: public.ecr.aws
92+
8093
- name: Perform high image scan
8194
if: always()
8295
id: high_scan
8396
uses: ./.github/actions/image_scan
8497
with:
85-
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.10.1"
98+
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.12.0"
8699
severity: 'CRITICAL,HIGH'
100+
logout: 'false'
87101

88102
- name: Perform low image scan
89103
if: always()
90104
id: low_scan
91105
uses: ./.github/actions/image_scan
92106
with:
93-
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.10.1"
107+
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.12.0"
94108
severity: 'MEDIUM,LOW,UNKNOWN'
109+
logout: 'false'
95110

96111
- name: Configure AWS Credentials for emitting metrics
97112
if: always()

.github/workflows/main-build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,23 @@ jobs:
109109
with:
110110
staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }}
111111
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }}
112+
113+
publish-main-build-status:
114+
name: "Publish Main Build Status"
115+
needs: [ build, application-signals-e2e-test ]
116+
runs-on: ubuntu-latest
117+
if: always()
118+
steps:
119+
- name: Configure AWS Credentials for emitting metrics
120+
uses: aws-actions/configure-aws-credentials@v4
121+
with:
122+
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
123+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
124+
125+
- name: Publish main build status
126+
run: |
127+
value="${{ needs.build.result == 'success' && needs.application-signals-e2e-test.result == 'success' && '0.0' || '1.0'}}"
128+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
129+
--metric-name Failure \
130+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=main_build \
131+
--value $value

.github/workflows/post_release_version_bump.yml renamed to .github/workflows/post-release-version-bump.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ jobs:
9999
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
100100
sed -i 's/__version__ = ".*"/__version__ = "'$DEV_VERSION'"/' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py
101101
VERSION="${{ github.event.inputs.version }}"
102-
sed -i 's/python:v.*"/python:v'$VERSION'"/' .github/workflows/daily_scan.yml
102+
sed -i 's/python:v.*"/python:v'$VERSION'"/' .github/workflows/daily-scan.yml
103103
git add aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py
104-
git add .github/workflows/daily_scan.yml
104+
git add .github/workflows/daily-scan.yml
105105
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
106106
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
107107

.github/workflows/pr_build.yml renamed to .github/workflows/pr-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Build Wheel and Image Files
2424
uses: ./.github/actions/artifacts_build
2525
with:
26-
image_uri_with_tag: pr_build/${{ matrix.python-version }}
26+
image_uri_with_tag: pr-build/${{ matrix.python-version }}
2727
push_image: false
2828
load_image: true
2929
python_version: ${{ matrix.python-version }}

.github/workflows/release-lambda.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ on:
1212
default: 'us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1, af-south-1, ap-east-1, ap-south-2, ap-southeast-3, ap-southeast-4, eu-central-2, eu-south-1, eu-south-2, il-central-1, me-central-1, me-south-1, ap-southeast-5, ap-southeast-7, mx-central-1, ca-west-1, cn-north-1, cn-northwest-1'
1313

1414
env:
15-
COMMERCIAL_REGIONS: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1, ap-southeast-5, ap-southeast-7, mx-central-1, ca-west-1, cn-north-1, cn-northwest-1
15+
# Legacy list of commercial regions to deploy to. New regions should NOT be added here, and instead should be added to the `aws_region` default input to the workflow.
16+
LEGACY_COMMERCIAL_REGIONS: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1
1617
LAYER_NAME: AWSOpenTelemetryDistroPython
1718

1819
permissions:
@@ -63,21 +64,21 @@ jobs:
6364
steps:
6465
- name: role arn
6566
env:
66-
COMMERCIAL_REGIONS: ${{ env.COMMERCIAL_REGIONS }}
67+
LEGACY_COMMERCIAL_REGIONS: ${{ env.LEGACY_COMMERCIAL_REGIONS }}
6768
run: |
68-
COMMERCIAL_REGIONS_ARRAY=(${COMMERCIAL_REGIONS//,/ })
69+
LEGACY_COMMERCIAL_REGIONS_ARRAY=(${LEGACY_COMMERCIAL_REGIONS//,/ })
6970
FOUND=false
70-
for REGION in "${COMMERCIAL_REGIONS_ARRAY[@]}"; do
71+
for REGION in "${LEGACY_COMMERCIAL_REGIONS_ARRAY[@]}"; do
7172
if [[ "$REGION" == "${{ matrix.aws_region }}" ]]; then
7273
FOUND=true
7374
break
7475
fi
7576
done
7677
if [ "$FOUND" = true ]; then
77-
echo "Found ${{ matrix.aws_region }} in COMMERCIAL_REGIONS"
78+
echo "Found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS"
7879
SECRET_KEY="LAMBDA_LAYER_RELEASE"
7980
else
80-
echo "Not found ${{ matrix.aws_region }} in COMMERCIAL_REGIONS"
81+
echo "Not found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS"
8182
SECRET_KEY="${{ matrix.aws_region }}_LAMBDA_LAYER_RELEASE"
8283
fi
8384
SECRET_KEY=${SECRET_KEY//-/_}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import importlib
44
import os
55
import sys
6-
from logging import Logger, getLogger
6+
from logging import ERROR, Logger, getLogger
77

88
from amazon.opentelemetry.distro._utils import get_aws_region, is_agent_observability_enabled
99
from amazon.opentelemetry.distro.aws_opentelemetry_configurator import (
@@ -22,12 +22,17 @@
2222
from opentelemetry import propagate
2323
from opentelemetry.distro import OpenTelemetryDistro
2424
from opentelemetry.environment_variables import OTEL_PROPAGATORS, OTEL_PYTHON_ID_GENERATOR
25+
from opentelemetry.instrumentation.auto_instrumentation import _load
26+
from opentelemetry.instrumentation.logging import LEVELS
27+
from opentelemetry.instrumentation.logging.environment_variables import OTEL_PYTHON_LOG_LEVEL
2528
from opentelemetry.sdk.environment_variables import (
2629
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION,
2730
OTEL_EXPORTER_OTLP_PROTOCOL,
2831
)
2932

3033
_logger: Logger = getLogger(__name__)
34+
# Suppress configurator warnings from auto-instrumentation
35+
_load._logger.setLevel(LEVELS.get(os.environ.get(OTEL_PYTHON_LOG_LEVEL, "error").lower(), ERROR))
3136

3237

3338
class AwsOpenTelemetryDistro(OpenTelemetryDistro):

0 commit comments

Comments
 (0)