Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

SIGNALFX_ENVIRONMENT env variable tag #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ To learn more, see:
SIGNALFX_TRACING_URL=tracing endpoint [ default: https://ingest.signalfx.com/v1/trace ]


4. (Optional) Set environment variable to set `environment` root span tag

.. code:: bash
SIGNALFX_ENVIRONMENT=production
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do other signalfx libraries also have a SIGNALFX_ENVIRONMENT env var option? I've generally seen other libraries take a comma separated list of arbitary tags and expect users to supply environment as part of that.


Step 4: Wrap a function
--------------------------

Expand Down Expand Up @@ -292,6 +297,9 @@ The tracing wrapper creates a span for the wrapper handler. This span contains t
| component | The literal value of |
| | ‘python-lambda-wrapper’ |
+----------------------------------+----------------------------------+
| environment | Environment name defined by |
| | SIGNALFX_ENVIRONMENT |
+----------------------------------+----------------------------------+



Expand Down
5 changes: 5 additions & 0 deletions signalfx_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def call(*args, **kwargs):
span_tags['component'] = 'python-lambda-wrapper'
span_tags[ext_tags.SPAN_KIND] = ext_tags.SPAN_KIND_RPC_SERVER

environment = os.getenv('SIGNALFX_ENVIRONMENT')

if environment:
span_tags['environment'] = environment

span_prefix = os.getenv('SIGNALFX_SPAN_PREFIX', 'lambda_python_')

try:
Expand Down