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 26, 2021
1 parent 4174a55 commit 657c2b1
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 931 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
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 1.3.0 |
| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 |
| [opentelemetry-instrumentation-asyncpg](./opentelemetry-instrumentation-asyncpg) | asyncpg >= 0.12.0 |
| [opentelemetry-instrumentation-aws_lambda](./opentelemetry-instrumentation-aws_lambda) | aws_lambda |
| [opentelemetry-instrumentation-aws-lambda](./opentelemetry-instrumentation-aws-lambda) | aws_lambda |
| [opentelemetry-instrumentation-boto](./opentelemetry-instrumentation-boto) | boto~=2.0 |
| [opentelemetry-instrumentation-botocore](./opentelemetry-instrumentation-botocore) | botocore ~= 1.0 |
| [opentelemetry-instrumentation-celery](./opentelemetry-instrumentation-celery) | celery >= 4.0, < 6.0 |
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 @@ -13,13 +13,13 @@
# limitations under the License.
#
[metadata]
name = opentelemetry-instrumentation-aws_lambda
name = opentelemetry-instrumentation-aws-lambda
description = OpenTelemetry AWS Lambda instrumentation
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
author_email = cncf-opentelemetry-contributors@lists.cncf.io
url = https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aws_lambda
url = https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aws-lambda
platforms = any
license = Apache-2.0
classifiers =
Expand All @@ -39,7 +39,7 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-instrumentation == 0.25b2
opentelemetry-propagator-aws-xray == 1.0.0
opentelemetry-propagator-aws-xray == 1.0.1
opentelemetry-semantic-conventions == 0.25b2

[options.extras_require]
Expand All @@ -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 657c2b1

Please sign in to comment.