Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 05a8c46

Browse files
committedOct 25, 2021
Add AWS Lambda package metadata files
1 parent 6a32d72 commit 05a8c46

File tree

15 files changed

+14
-926
lines changed

15 files changed

+14
-926
lines changed
 

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.6.2-0.25b2...HEAD)
9-
- `opentelemetry-instrumentation-aws_lambda` Add Instrumentation for AWS Lambda package
9+
- `opentelemetry-instrumentation-aws_lambda` Add instrumentation for AWS Lambda Service - pkg metadata files (Part 1/2)
1010
([#739](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/739))
1111

1212
### Fixed

‎instrumentation/opentelemetry-instrumentation-aws_lambda/README.rst ‎instrumentation/opentelemetry-instrumentation-aws-lambda/README.rst

-40
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,6 @@ Installation
2121
pip install opentelemetry-instrumentation-aws-lambda
2222

2323

24-
Usage
25-
-----
26-
27-
.. code:: python
28-
29-
# Copy this snippet into an AWS Lambda function
30-
31-
import boto3
32-
from opentelemetry.instrumentation.botocore import AwsBotocoreInstrumentor
33-
from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor
34-
35-
36-
# Enable instrumentation
37-
AwsBotocoreInstrumentor().instrument()
38-
AwsLambdaInstrumentor().instrument()
39-
40-
# Lambda function
41-
def lambda_handler(event, context):
42-
s3 = boto3.resource('s3')
43-
for bucket in s3.buckets.all():
44-
print(bucket.name)
45-
46-
return "200 OK"
47-
48-
Using a custom `event_context_extractor` to parent traces with a Trace Context
49-
found in the Lambda Event.
50-
51-
.. code:: python
52-
53-
from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor
54-
55-
def custom_event_context_extractor(lambda_event):
56-
# If the `TraceContextTextMapPropagator` is the global propagator, we
57-
# can use it to parse out the context from the HTTP Headers.
58-
return get_global_textmap().extract(lambda_event["foo"]["headers"])
59-
60-
AwsLambdaInstrumentor().instrument(
61-
event_context_extractor=custom_event_context_extractor
62-
)
63-
6424
References
6525
----------
6626

‎instrumentation/opentelemetry-instrumentation-aws_lambda/setup.cfg ‎instrumentation/opentelemetry-instrumentation-aws-lambda/setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,3 @@ where = src
5454
# current AWS Lambda implementation reloads a fresh import of the user's Lambda
5555
# handler. Auto Instrumentation runs _before_ and if it instruments the handler
5656
# that patching will be lost.
57-
#
58-
# opentelemetry_instrumentor =
59-
# aws_lambda = opentelemetry.instrumentation.aws_lambda:AwsLambdaInstrumentor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2020, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

‎instrumentation/opentelemetry-instrumentation-aws_lambda/tests/mocks/lambda_function.py ‎instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation.py

-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
16-
def handler(event, context):
17-
return "200 ok"

‎instrumentation/opentelemetry-instrumentation-aws_lambda/scripts/otel-instrument

-166
This file was deleted.

‎instrumentation/opentelemetry-instrumentation-aws_lambda/scripts/otel_wrapper.py

-66
This file was deleted.

0 commit comments

Comments
 (0)