Skip to content

Commit

Permalink
Add AWS Lambda package metadata files
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanielRN committed Oct 25, 2021
1 parent 6a32d72 commit 05a8c46
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 926 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

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

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,6 @@ Installation
pip install opentelemetry-instrumentation-aws-lambda


Usage
-----

.. code:: python
# Copy this snippet into an AWS Lambda function
import boto3
from opentelemetry.instrumentation.botocore import AwsBotocoreInstrumentor
from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor
# Enable instrumentation
AwsBotocoreInstrumentor().instrument()
AwsLambdaInstrumentor().instrument()
# Lambda function
def lambda_handler(event, context):
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
print(bucket.name)
return "200 OK"
Using a custom `event_context_extractor` to parent traces with a Trace Context
found in the Lambda Event.

.. code:: python
from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor
def custom_event_context_extractor(lambda_event):
# If the `TraceContextTextMapPropagator` is the global propagator, we
# can use it to parse out the context from the HTTP Headers.
return get_global_textmap().extract(lambda_event["foo"]["headers"])
AwsLambdaInstrumentor().instrument(
event_context_extractor=custom_event_context_extractor
)
References
----------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,3 @@ where = src
# current AWS Lambda implementation reloads a fresh import of the user's Lambda
# handler. Auto Instrumentation runs _before_ and if it instruments the handler
# that patching will be lost.
#
# opentelemetry_instrumentor =
# aws_lambda = opentelemetry.instrumentation.aws_lambda:AwsLambdaInstrumentor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020, 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.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@
# 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.


def handler(event, context):
return "200 ok"

This file was deleted.

This file was deleted.

Loading

0 comments on commit 05a8c46

Please sign in to comment.