Enrich traces with Execution Tags

Execution Tags allow you to dynamically add dimensions to your Lambda function invocations so that they can be identified, searched for, and filtered in Lumigo.

They can be utilized to find specific invocations and create custom widgets, helping you simplify the complexity of monitoring distributed applications.

Skip to the Quick Bytes video for Execution Tags

Filter by Execution Tags to easily find specific invocations on the Explore page and create Custom Widgets.

27082708 27082708

Click on the Issue Details icon on the Issues page to see Execution Tags and additional information at a glance.

18041804

Execution Tags in Lambda functions

From the command line, install the lumigo tracer

pip install lumigo_tracer
npm install @lumigo/tracer --save

Adding for Auto-Traced functions
Add an execution tag to your handler’s code

from lumigo_tracer import add_execution_tag

add_execution_tag(“user_id”,user_id)
const lumigo = require('@lumigo/tracer');

lumigo.addExecutionTag('<key>', '<value>');

Adding for Manual traced functions

from lumigo_tracer import lumigo_tracer
from lumigo_tracer import add_execution_tag

@lumigo_tracer(token='YOUR-TOKEN-HERE')
def my_lambda(event, context):
    print('I can finally troubleshoot!')
    add_execution_tag(“user_id”,user_id)
const lumigo = require('@lumigo/tracer')({ token: '<your_lumigo_token>' });

lumigo.addExecutionTag('<key>', '<value>');

To find out more about Manual Tracing visit AWS Lambda Manual Tracing

Auto execution tags from the Lambda event

To configure execution tags that will be driven directly from the event, add an environment variable to the Lambda function with the name of the relevant key. We support only the python and node runtimes.

For example, to configure an auto tag from the key product_id, add the environment variable:

KeyValue
LUMIGO_AUTO_TAGproduct_id

To configure multiple auto tags, such as product_id and source, add:

KeyValue
LUMIGO_AUTO_TAGproduct_id,source

For a nested field, such as name inside the value of the key source, the syntax is:

KeyValue
LUMIGO_AUTO_TAGsource.name

Execution Tags in OpenTelemetry and Containers

Execution tags in the container tracers like the Lumigo OpenTelemetry Distros for Python and JS are created using the OpenTelemetry Span.setAttribute() API.

For example, using the Lumigo OpenTelemetry Distros JS with Typescript, this code will add the foo execution tag with value bar:

// Typescript
import { trace } from '@opentelemetry/api';

/*
 * In Node.js 14+, the '?' coalescing operator ensures that your code is
 * safe even if the tracing is not active, and `trace.getActiveSpan()` returns
 * `undefined`.
 */
trace.getActiveSpan()?.setAttribute('lumigo.execution_tags.foo','bar');

For more information on how to set execution tags with the Lumigo OpenTelemetry Distros, refer to the Lumigo OpenTelemetry Distro for JS and Lumigo OpenTelemetry Distro for Python documentation pages.

For other OpenTelemetry SDKs, the implementation of Span.setAttribute API will work, as long as you add lumigo.execution_tags. as prefix to the attribute name, and do not use other . characters in the name.

Execution Tags naming limits and requirements

  • Execution tags can be added only to a traced function
  • The maximum number of tags is 50.
  • Key length must be between 1 and 50.
  • Value length must be between 1 and 70.

Lumigo Quick Bytes - Execution Tags