Semantic Conventions for FaaS Metrics

Status: Experimental

This document defines how to describe an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with metrics.

The conventions described in this section are FaaS (function as a service) specific. When FaaS operations occur, metric events about those operations will be generated and reported to provide insights into the operations. By adding FaaS attributes to metric events it allows for finely tuned filtering.

Disclaimer: These are initial FaaS metric instruments and attributes but more may be added in the future.

Metric Instruments

The following metric instruments MUST be used to describe FaaS operations. They MUST be of the specified type and units.

FaaS Invocations

Below is a table of FaaS invocation metric instruments.

NameInstrument Type (*)UnitUnit (UCUM)Description
faas.invoke_durationHistogrammillisecondsmsMeasures the duration of the invocation
faas.init_durationHistogrammillisecondsmsMeasures the duration of the function’s initialization, such as a cold start
faas.coldstartsCounterdefault unit{coldstart}Number of invocation cold starts.
faas.errorsCounterdefault unit{error}Number of invocation errors.
faas.invocationsCounterdefault unit{invocation}Number of successful invocations.
faas.timeoutsCounterdefault unit{timeout}Number of invocation timeouts.

Optionally, when applicable:

NameInstrument Type (*)UnitUnit (UCUM)Description
faas.mem_usageHistogramBytesByDistribution of max memory usage per invocation
faas.cpu_usageHistogrammillisecondsmsDistribution of CPU usage per invocation
faas.net_ioHistogramBytesByDistribution of net I/O usage per invocation


Below is a table of the attributes to be included on FaaS metric events.

NameRequirement LevelNotes and examples
faas.triggerRequiredType of the trigger on which the function is invoked. SHOULD be one of: datasource, http, pubsub, timer, other
faas.invoked_nameRequiredName of the invoked function. Example: my-function
faas.invoked_providerRequiredCloud provider of the invoked function. Corresponds to the resource cloud.provider. Example: aws
faas.invoked_regionRequiredCloud provider region of invoked function. Corresponds to resource cloud.region. Example: us-east-1

More details on these attributes, the function name and the difference compared to the faas.invoked_name can be found at the related FaaS tracing specification. For incoming FaaS invocations, the function for which metrics are reported is already described by its FaaS resource attributes. Outgoing FaaS invocations are identified using the faas.invoked_* attributes above. faas.trigger SHOULD be included in all metric events while faas.invoked_* attributes apply on outgoing FaaS invocation events only.


Metric References

Below are links to documentation regarding metrics that are available with different FaaS providers. This list is not exhaustive.