Function as a Service
NOTICE Semantic Conventions are moving to a new location.
No changes to this document are allowed.
Description: A “function as a service” aka “serverless function” instance.
FaaS resource attributes
|string||The name of the single function that this runtime instance executes. ||Required|
|string||The immutable version of the function being executed. ||Recommended|
|string||The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. ||Recommended|
|int||The amount of memory available to the serverless function converted to Bytes. ||Recommended|
|string||Cloud provider-specific native identifier of the monitored cloud resource (e.g. an ARN on AWS, a fully qualified resource ID on Azure, a full resource name on GCP) ||Recommended|
: This is the name of the function as configured/deployed on the FaaS
platform and is usually different from the name of the callback
function (which may be stored in the
For some cloud providers, the above definition is ambiguous. The following definition of function name MUST be used for this attribute (and consequently the span name) for the listed cloud providers/products:
- Azure: The full name
<FUNCAPP>/<FUNC>, i.e., function app name followed by a forward slash followed by the function name (this form can also be seen in the resource JSON for the function). This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share a TracerProvider (see also the
: Depending on the cloud provider and platform, use:
- AWS Lambda: The function version (an integer represented as a decimal string).
- Google Cloud Run (Services): The revision (i.e., the function name plus the revision suffix).
- Google Cloud Functions: The value of the
- Azure Functions: Not applicable. Do not set this attribute.
: * AWS Lambda: Use the (full) log stream name.
: It’s recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable
AWS_LAMBDA_FUNCTION_MEMORY_SIZE provides this information (which must be multiplied by 1,048,576).
: On some cloud providers, it may not be possible to determine the full ID at startup,
so it may be necessary to set
cloud.resource_id as a span attribute instead.
The exact value to use for
cloud.resource_id depends on the cloud provider.
The following well-known definitions MUST be used if you set this attribute and they apply:
- AWS Lambda: The function ARN. Take care not to use the “invoked ARN” directly but replace any alias suffix with the resolved function version, as the same runtime instance may be invokable with multiple different aliases.
- GCP: The URI of the resource
- Azure: The Fully Qualified Resource ID of the invoked function,
not the function app, having the form
/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>. This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share a TracerProvider.
Note: The resource attribute
faas.instance differs from the span attribute
faas.invocation_id. For more information see the Semantic conventions for FaaS spans.
Using span attributes instead of resource attributes
There are cases where a FaaS resource attribute is better applied as a span attribute instead. See the FaaS trace conventions for more.