package faasconv

import "go.opentelemetry.io/otel/semconv/v1.32.0/faasconv"

Package faasconv provides types and functionality for OpenTelemetry semantic conventions in the "faas" namespace.

Index

Types

type CPUUsage

type CPUUsage struct {
	metric.Float64Histogram
}

CPUUsage is an instrument used to record metric values conforming to the "faas.cpu_usage" semantic conventions. It represents the distribution of CPU usage per invocation.

func NewCPUUsage

func NewCPUUsage(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (CPUUsage, error)

NewCPUUsage returns a new CPUUsage instrument.

func (CPUUsage) AttrTrigger

func (CPUUsage) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (CPUUsage) Description

func (CPUUsage) Description() string

Description returns the semantic convention description of the instrument

func (CPUUsage) Inst

func (m CPUUsage) Inst() metric.Float64Histogram

Inst returns the underlying metric instrument.

func (CPUUsage) Name

func (CPUUsage) Name() string

Name returns the semantic convention name of the instrument.

func (CPUUsage) Record

func (m CPUUsage) Record(
	ctx context.Context,
	val float64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (CPUUsage) Unit

func (CPUUsage) Unit() string

Unit returns the semantic convention unit of the instrument

type Coldstarts

type Coldstarts struct {
	metric.Int64Counter
}

Coldstarts is an instrument used to record metric values conforming to the "faas.coldstarts" semantic conventions. It represents the number of invocation cold starts.

func NewColdstarts

func NewColdstarts(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Coldstarts, error)

NewColdstarts returns a new Coldstarts instrument.

func (Coldstarts) Add

func (m Coldstarts) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (Coldstarts) AttrTrigger

func (Coldstarts) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (Coldstarts) Description

func (Coldstarts) Description() string

Description returns the semantic convention description of the instrument

func (Coldstarts) Inst

func (m Coldstarts) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Coldstarts) Name

func (Coldstarts) Name() string

Name returns the semantic convention name of the instrument.

func (Coldstarts) Unit

func (Coldstarts) Unit() string

Unit returns the semantic convention unit of the instrument

type Errors

type Errors struct {
	metric.Int64Counter
}

Errors is an instrument used to record metric values conforming to the "faas.errors" semantic conventions. It represents the number of invocation errors.

func NewErrors

func NewErrors(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Errors, error)

NewErrors returns a new Errors instrument.

func (Errors) Add

func (m Errors) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (Errors) AttrTrigger

func (Errors) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (Errors) Description

func (Errors) Description() string

Description returns the semantic convention description of the instrument

func (Errors) Inst

func (m Errors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Errors) Name

func (Errors) Name() string

Name returns the semantic convention name of the instrument.

func (Errors) Unit

func (Errors) Unit() string

Unit returns the semantic convention unit of the instrument

type InitDuration

type InitDuration struct {
	metric.Float64Histogram
}

InitDuration is an instrument used to record metric values conforming to the "faas.init_duration" semantic conventions. It represents the measures the duration of the function's initialization, such as a cold start.

func NewInitDuration

func NewInitDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (InitDuration, error)

NewInitDuration returns a new InitDuration instrument.

func (InitDuration) AttrTrigger

func (InitDuration) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (InitDuration) Description

func (InitDuration) Description() string

Description returns the semantic convention description of the instrument

func (InitDuration) Inst

Inst returns the underlying metric instrument.

func (InitDuration) Name

func (InitDuration) Name() string

Name returns the semantic convention name of the instrument.

func (InitDuration) Record

func (m InitDuration) Record(
	ctx context.Context,
	val float64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (InitDuration) Unit

func (InitDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type Invocations

type Invocations struct {
	metric.Int64Counter
}

Invocations is an instrument used to record metric values conforming to the "faas.invocations" semantic conventions. It represents the number of successful invocations.

func NewInvocations

func NewInvocations(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Invocations, error)

NewInvocations returns a new Invocations instrument.

func (Invocations) Add

func (m Invocations) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (Invocations) AttrTrigger

func (Invocations) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (Invocations) Description

func (Invocations) Description() string

Description returns the semantic convention description of the instrument

func (Invocations) Inst

func (m Invocations) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Invocations) Name

func (Invocations) Name() string

Name returns the semantic convention name of the instrument.

func (Invocations) Unit

func (Invocations) Unit() string

Unit returns the semantic convention unit of the instrument

type InvokeDuration

type InvokeDuration struct {
	metric.Float64Histogram
}

InvokeDuration is an instrument used to record metric values conforming to the "faas.invoke_duration" semantic conventions. It represents the measures the duration of the function's logic execution.

func NewInvokeDuration

func NewInvokeDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (InvokeDuration, error)

NewInvokeDuration returns a new InvokeDuration instrument.

func (InvokeDuration) AttrTrigger

func (InvokeDuration) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (InvokeDuration) Description

func (InvokeDuration) Description() string

Description returns the semantic convention description of the instrument

func (InvokeDuration) Inst

Inst returns the underlying metric instrument.

func (InvokeDuration) Name

func (InvokeDuration) Name() string

Name returns the semantic convention name of the instrument.

func (InvokeDuration) Record

func (m InvokeDuration) Record(
	ctx context.Context,
	val float64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (InvokeDuration) Unit

func (InvokeDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type MemUsage

type MemUsage struct {
	metric.Int64Histogram
}

MemUsage is an instrument used to record metric values conforming to the "faas.mem_usage" semantic conventions. It represents the distribution of max memory usage per invocation.

func NewMemUsage

func NewMemUsage(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (MemUsage, error)

NewMemUsage returns a new MemUsage instrument.

func (MemUsage) AttrTrigger

func (MemUsage) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (MemUsage) Description

func (MemUsage) Description() string

Description returns the semantic convention description of the instrument

func (MemUsage) Inst

func (m MemUsage) Inst() metric.Int64Histogram

Inst returns the underlying metric instrument.

func (MemUsage) Name

func (MemUsage) Name() string

Name returns the semantic convention name of the instrument.

func (MemUsage) Record

func (m MemUsage) Record(
	ctx context.Context,
	val int64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (MemUsage) Unit

func (MemUsage) Unit() string

Unit returns the semantic convention unit of the instrument

type NetIO

type NetIO struct {
	metric.Int64Histogram
}

NetIO is an instrument used to record metric values conforming to the "faas.net_io" semantic conventions. It represents the distribution of net I/O usage per invocation.

func NewNetIO

func NewNetIO(
	m metric.Meter,
	opt ...metric.Int64HistogramOption,
) (NetIO, error)

NewNetIO returns a new NetIO instrument.

func (NetIO) AttrTrigger

func (NetIO) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (NetIO) Description

func (NetIO) Description() string

Description returns the semantic convention description of the instrument

func (NetIO) Inst

func (m NetIO) Inst() metric.Int64Histogram

Inst returns the underlying metric instrument.

func (NetIO) Name

func (NetIO) Name() string

Name returns the semantic convention name of the instrument.

func (NetIO) Record

func (m NetIO) Record(
	ctx context.Context,
	val int64,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

All additional attrs passed are included in the recorded value.

func (NetIO) Unit

func (NetIO) Unit() string

Unit returns the semantic convention unit of the instrument

type Timeouts

type Timeouts struct {
	metric.Int64Counter
}

Timeouts is an instrument used to record metric values conforming to the "faas.timeouts" semantic conventions. It represents the number of invocation timeouts.

func NewTimeouts

func NewTimeouts(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (Timeouts, error)

NewTimeouts returns a new Timeouts instrument.

func (Timeouts) Add

func (m Timeouts) Add(
	ctx context.Context,
	incr int64,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

All additional attrs passed are included in the recorded value.

func (Timeouts) AttrTrigger

func (Timeouts) AttrTrigger(val TriggerAttr) attribute.KeyValue

AttrTrigger returns an optional attribute for the "faas.trigger" semantic convention. It represents the type of the trigger which caused this function invocation.

func (Timeouts) Description

func (Timeouts) Description() string

Description returns the semantic convention description of the instrument

func (Timeouts) Inst

func (m Timeouts) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (Timeouts) Name

func (Timeouts) Name() string

Name returns the semantic convention name of the instrument.

func (Timeouts) Unit

func (Timeouts) Unit() string

Unit returns the semantic convention unit of the instrument

type TriggerAttr

type TriggerAttr string

TriggerAttr is an attribute conforming to the faas.trigger semantic conventions. It represents the type of the trigger which caused this function invocation.

var (
	// TriggerDatasource is a response to some data source operation such as a
	// database or filesystem read/write.
	TriggerDatasource TriggerAttr = "datasource"
	// TriggerHTTP is the to provide an answer to an inbound HTTP request.
	TriggerHTTP TriggerAttr = "http"
	// TriggerPubSub is a function is set to be executed when messages are sent to a
	// messaging system.
	TriggerPubSub TriggerAttr = "pubsub"
	// TriggerTimer is a function is scheduled to be executed regularly.
	TriggerTimer TriggerAttr = "timer"
	// TriggerOther is the if none of the others apply.
	TriggerOther TriggerAttr = "other"
)

Source Files

metric.go

Version
v1.43.0 (latest)
Published
Apr 3, 2026
Platform
linux/amd64
Imports
5 packages
Last checked
1 hour ago

Tools for package owners.