Instrumentation
Once you have added the AWS Account Integration, you will need to enable instrumentation on each AWS Lambda function to enable metric, log, trace, span, and events collection in Serverless Console.
Currently Instrumentation is supported for the Node.js 12+ and Python 3.8+ runtimes only; however, other runtime support is coming soon.
Enabling instrumentation for a function
To enable instrumentation go to Settings > Integrations and select the AWS Integration, and click Edit.
On the integration settings page you'll have the option to set the Instrumentation Mode to None, Dev, or Prod.
Instrumentation Mode: Prod
When the Instrumentation Mode is set to Prod, then metrics, logs, traces, spans, and events are collected and made available on Metrics and Explorer in Serverless Console. This mode is optimized for production use, as it adds virtually no latency to the Lambda function.
To help you reduce costs, Serverless Console provides Trace Sampling to limit the number of ingested traces when Instrumentation Mode is set to Prod.
Instrumentation Mode: Dev
When the Instrumentation Mode is set to Dev, then all the same data is collected on the function as Prod; however, additionally this provides real-time logging, trace, span, and event collection in DevMode on Serverless Console. This mode is intended for development workloads only as it adds some latency to the AWS Lambda function.
Unlike Prod Instrumentation Mode, Dev Instrumentation Mode does not perform any sampling, therefore 100% of the traces will be ingested and counted as billable usage.
Instrumentation Mode: None
When the Instrumentation Mode is set to None, then no data is collected on the function.
Trace Sampling
To help you reduce costs, Serverless Console provides Trace Sampling to limit the number of ingested traces.
Trace Sampling is enabled when the Instrumentation Mode is set to Prod. No further action is needed to enable sampling. If the Instrumentation Mode is set to Dev, sampling will not be enabled and 100% of all traces will be collected by Serverless Console.
Traces are sampled at a 30% rate for successful traces only. If a trace contains
any error or warning events, including any warnings generated by the SDK (e.g.
invalid tag key on setTag()
), then the Trace will not be sampled. This ensures
that all errors and warnings will be available in the Trace Explorer.
Metrics are not subject to Sampling. All metrics generated and collected by the Instrumentation will continue to work, even if the trace was successful.
Custom Instrumentation
In addition to the automatic instrumentation of your AWS Lambda functions, you can also add custom instrumentation for setting tags, and events in your code.
Use the Node.js and Python Serverless SDK to add custom instrumentation.