Thundra APM

Tagging in Node.js SDK

With Thundra's Node.js agent, you can add custom tags to your invocations or your applications, which will help you better filter the data. Invocation tags are added only to the Invocation data type; application tags are global and are automatically added to Invocation, Metric, Trace, Span, and Log data.‌

Adding Invocation Tags

You can add custom tags or errors to your invocation by the following methods exported over the main module. The functions that can be used in the module are shown below:
static setTag(key: string, value: any): void
static getTag(key: string): any
static removeTag(key: string): void
static setTags(keyValuePairs: {[key: string]: any }): void
static removeTags(): void
static setError(exception: any): void
The example below shows how to tag a Lambda invocation(e.g., Lambda Handler):
Setting an invocation tag
const thundra = require("@thundra/core");
exports.handler = thundra()((event, context,callback) => {
thundra.setTag('userName', 'foo');
callback(null, 'Hello Thundra!');

Adding Application Tags

You can add application tags via environment variables. All application tags which start with thundra_agent_lambda_application_tag_ are parsed by Thundra's Node.js agent. The text after the thundra_agent_lambda_application_tag_ prefix is used as the key of the tag, and the value of the environment variable becomes the value of the tag. For example, thundra_agent_lambda_application_tag_floatField with the value 12.123 will add an application tag to all data with the key floatField and the value 12.123.‌
The example below shows how to add application tags with various data types to a Lambda invocation:
Setting application tags through the Lambda console