Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/src/otel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ RUN mkdir -p /build && \
rm -rf /build/tmp && \
mv otel_sdk/otel_wrapper.py /build/python && \
mv otel_sdk/otel-instrument /build && \
mv otel_sdk/otel-handler /build && \
chmod 755 /build/otel-instrument && \
chmod 755 /build/otel-handler && \
rm -rf /build/python/boto* && \
rm -rf /build/python/urllib3* && \
cd /build && \
zip -r opentelemetry-python-layer.zip otel-instrument python
zip -r opentelemetry-python-layer.zip otel-handler otel-instrument python

CMD cp /build/opentelemetry-python-layer.zip /out/opentelemetry-python-layer.zip
41 changes: 41 additions & 0 deletions python/src/otel/otel_sdk/otel-handler
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -ef -o pipefail

# Copyright The 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.

: <<'END_DOCUMENTATION'
`otel-handler`

This script is a wrapper around the existing `otel-instrument` script to maintain
backward compatibility while providing a more descriptive name.

It simply forwards all arguments to the `otel-instrument` script.

Usage
-----
Use this script exactly as you would use `otel-instrument`:

.. code::

AWS_LAMBDA_EXEC_WRAPPER = /opt/otel-handler

END_DOCUMENTATION

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Call the original otel-instrument script with all passed arguments
exec "${SCRIPT_DIR}/otel-instrument" "$@"
4 changes: 4 additions & 0 deletions python/src/otel/otel_sdk/otel-instrument
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ variables OpenTelemetry uses, and then initializing OpenTelemetry using the
`opentelemetry-instrument` auto instrumentation script from the
`opentelemetry-instrumentation` package.

All other runtimes use the `otel-handler` script which is the equivalent of this.
In the next major version, the contents of this script will be moved to the
`otel-handler` script.

Additionally, this configuration assumes the user is using packages conforming
to the `opentelemetry-instrumentation` and `opentelemetry-sdk` specifications.

Expand Down