From 3baabce4c681a0af4a425945a27c823c7d6633ea Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 9 Sep 2025 12:21:48 -0700 Subject: [PATCH] Do not allocate instrument options if possible in generated semconv packages (#7328) Avoid allocating instrument creation option if possible. If a user does not provide any options, use a static, read-only, file-level defined option slice. Otherwise, append to the user allocated slice the description and unit options. --- semconv/templates/registry/go/metric.go.j2 | 16 +- semconv/v1.37.0/azureconv/metric.go | 32 +- semconv/v1.37.0/cicdconv/metric.go | 80 +- semconv/v1.37.0/containerconv/metric.go | 144 +- semconv/v1.37.0/dbconv/metric.go | 176 ++- semconv/v1.37.0/dnsconv/metric.go | 16 +- semconv/v1.37.0/faasconv/metric.go | 144 +- semconv/v1.37.0/genaiconv/metric.go | 80 +- semconv/v1.37.0/goconv/metric.go | 144 +- semconv/v1.37.0/httpconv/metric.go | 160 ++- semconv/v1.37.0/hwconv/metric.go | 672 ++++++--- semconv/v1.37.0/k8sconv/metric.go | 1424 +++++++++++++++----- semconv/v1.37.0/messagingconv/metric.go | 64 +- semconv/v1.37.0/otelconv/metric.go | 272 +++- semconv/v1.37.0/processconv/metric.go | 176 ++- semconv/v1.37.0/rpcconv/metric.go | 160 ++- semconv/v1.37.0/signalrconv/metric.go | 32 +- semconv/v1.37.0/systemconv/metric.go | 512 +++++-- semconv/v1.37.0/vcsconv/metric.go | 160 ++- 19 files changed, 3348 insertions(+), 1116 deletions(-) diff --git a/semconv/templates/registry/go/metric.go.j2 b/semconv/templates/registry/go/metric.go.j2 index f516d120b..90c3f785d 100644 --- a/semconv/templates/registry/go/metric.go.j2 +++ b/semconv/templates/registry/go/metric.go.j2 @@ -58,6 +58,11 @@ type {{ metric_name }} struct { metric.{{ metric_inst }} } +var new{{ metric_name }}Opts = []metric.{{ metric_inst }}Option{ + metric.WithDescription("{{ i.desc(metric) }}"), + metric.WithUnit("{{metric.unit}}"), +} + {{ ["New" ~ metric_name ~ " returns a new " ~ metric_name ~ " instrument."] | comment }} func New{{ metric_name }}( m metric.Meter, @@ -68,12 +73,15 @@ func New{{ metric_name }}( return {{metric_name}}{noop.{{ metric_inst }}{}}, nil } + if len(opt) == 0 { + opt = new{{ metric_name }}Opts + } else { + opt = append(opt, new{{ metric_name }}Opts...) + } + i, err := m.{{ metric_inst }}( "{{metric.metric_name}}", - append([]metric.{{ metric_inst }}Option{ - metric.WithDescription("{{ i.desc(metric) }}"), - metric.WithUnit("{{metric.unit}}"), - }, opt...)..., + opt..., ) if err != nil { return {{metric_name}}{noop.{{ metric_inst }}{}}, err diff --git a/semconv/v1.37.0/azureconv/metric.go b/semconv/v1.37.0/azureconv/metric.go index 7a1b132e6..dbade5d2a 100644 --- a/semconv/v1.37.0/azureconv/metric.go +++ b/semconv/v1.37.0/azureconv/metric.go @@ -59,6 +59,11 @@ type CosmosDBClientActiveInstanceCount struct { metric.Int64UpDownCounter } +var newCosmosDBClientActiveInstanceCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active client instances."), + metric.WithUnit("{instance}"), +} + // NewCosmosDBClientActiveInstanceCount returns a new // CosmosDBClientActiveInstanceCount instrument. func NewCosmosDBClientActiveInstanceCount( @@ -70,12 +75,15 @@ func NewCosmosDBClientActiveInstanceCount( return CosmosDBClientActiveInstanceCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newCosmosDBClientActiveInstanceCountOpts + } else { + opt = append(opt, newCosmosDBClientActiveInstanceCountOpts...) + } + i, err := m.Int64UpDownCounter( "azure.cosmosdb.client.active_instance.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of active client instances."), - metric.WithUnit("{instance}"), - }, opt...)..., + opt..., ) if err != nil { return CosmosDBClientActiveInstanceCount{noop.Int64UpDownCounter{}}, err @@ -171,6 +179,11 @@ type CosmosDBClientOperationRequestCharge struct { metric.Int64Histogram } +var newCosmosDBClientOperationRequestChargeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation."), + metric.WithUnit("{request_unit}"), +} + // NewCosmosDBClientOperationRequestCharge returns a new // CosmosDBClientOperationRequestCharge instrument. func NewCosmosDBClientOperationRequestCharge( @@ -182,12 +195,15 @@ func NewCosmosDBClientOperationRequestCharge( return CosmosDBClientOperationRequestCharge{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newCosmosDBClientOperationRequestChargeOpts + } else { + opt = append(opt, newCosmosDBClientOperationRequestChargeOpts...) + } + i, err := m.Int64Histogram( "azure.cosmosdb.client.operation.request_charge", - append([]metric.Int64HistogramOption{ - metric.WithDescription("[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation."), - metric.WithUnit("{request_unit}"), - }, opt...)..., + opt..., ) if err != nil { return CosmosDBClientOperationRequestCharge{noop.Int64Histogram{}}, err diff --git a/semconv/v1.37.0/cicdconv/metric.go b/semconv/v1.37.0/cicdconv/metric.go index 2e156d394..69bd16ad8 100644 --- a/semconv/v1.37.0/cicdconv/metric.go +++ b/semconv/v1.37.0/cicdconv/metric.go @@ -97,6 +97,11 @@ type PipelineRunActive struct { metric.Int64UpDownCounter } +var newPipelineRunActiveOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of pipeline runs currently active in the system by state."), + metric.WithUnit("{run}"), +} + // NewPipelineRunActive returns a new PipelineRunActive instrument. func NewPipelineRunActive( m metric.Meter, @@ -107,12 +112,15 @@ func NewPipelineRunActive( return PipelineRunActive{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPipelineRunActiveOpts + } else { + opt = append(opt, newPipelineRunActiveOpts...) + } + i, err := m.Int64UpDownCounter( "cicd.pipeline.run.active", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of pipeline runs currently active in the system by state."), - metric.WithUnit("{run}"), - }, opt...)..., + opt..., ) if err != nil { return PipelineRunActive{noop.Int64UpDownCounter{}}, err @@ -203,6 +211,11 @@ type PipelineRunDuration struct { metric.Float64Histogram } +var newPipelineRunDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of a pipeline run grouped by pipeline, state and result."), + metric.WithUnit("s"), +} + // NewPipelineRunDuration returns a new PipelineRunDuration instrument. func NewPipelineRunDuration( m metric.Meter, @@ -213,12 +226,15 @@ func NewPipelineRunDuration( return PipelineRunDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newPipelineRunDurationOpts + } else { + opt = append(opt, newPipelineRunDurationOpts...) + } + i, err := m.Float64Histogram( "cicd.pipeline.run.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of a pipeline run grouped by pipeline, state and result."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return PipelineRunDuration{noop.Float64Histogram{}}, err @@ -324,6 +340,11 @@ type PipelineRunErrors struct { metric.Int64Counter } +var newPipelineRunErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of errors encountered in pipeline runs (eg. compile, test failures)."), + metric.WithUnit("{error}"), +} + // NewPipelineRunErrors returns a new PipelineRunErrors instrument. func NewPipelineRunErrors( m metric.Meter, @@ -334,12 +355,15 @@ func NewPipelineRunErrors( return PipelineRunErrors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPipelineRunErrorsOpts + } else { + opt = append(opt, newPipelineRunErrorsOpts...) + } + i, err := m.Int64Counter( "cicd.pipeline.run.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of errors encountered in pipeline runs (eg. compile, test failures)."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return PipelineRunErrors{noop.Int64Counter{}}, err @@ -439,6 +463,11 @@ type SystemErrors struct { metric.Int64Counter } +var newSystemErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of errors in a component of the CICD system (eg. controller, scheduler, agent)."), + metric.WithUnit("{error}"), +} + // NewSystemErrors returns a new SystemErrors instrument. func NewSystemErrors( m metric.Meter, @@ -449,12 +478,15 @@ func NewSystemErrors( return SystemErrors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSystemErrorsOpts + } else { + opt = append(opt, newSystemErrorsOpts...) + } + i, err := m.Int64Counter( "cicd.system.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of errors in a component of the CICD system (eg. controller, scheduler, agent)."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return SystemErrors{noop.Int64Counter{}}, err @@ -549,6 +581,11 @@ type WorkerCount struct { metric.Int64UpDownCounter } +var newWorkerCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of workers on the CICD system by state."), + metric.WithUnit("{count}"), +} + // NewWorkerCount returns a new WorkerCount instrument. func NewWorkerCount( m metric.Meter, @@ -559,12 +596,15 @@ func NewWorkerCount( return WorkerCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newWorkerCountOpts + } else { + opt = append(opt, newWorkerCountOpts...) + } + i, err := m.Int64UpDownCounter( "cicd.worker.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of workers on the CICD system by state."), - metric.WithUnit("{count}"), - }, opt...)..., + opt..., ) if err != nil { return WorkerCount{noop.Int64UpDownCounter{}}, err diff --git a/semconv/v1.37.0/containerconv/metric.go b/semconv/v1.37.0/containerconv/metric.go index a480f96e5..e4a3f4157 100644 --- a/semconv/v1.37.0/containerconv/metric.go +++ b/semconv/v1.37.0/containerconv/metric.go @@ -78,6 +78,11 @@ type CPUTime struct { metric.Float64Counter } +var newCPUTimeOpts = []metric.Float64CounterOption{ + metric.WithDescription("Total CPU time consumed."), + metric.WithUnit("s"), +} + // NewCPUTime returns a new CPUTime instrument. func NewCPUTime( m metric.Meter, @@ -88,12 +93,15 @@ func NewCPUTime( return CPUTime{noop.Float64Counter{}}, nil } + if len(opt) == 0 { + opt = newCPUTimeOpts + } else { + opt = append(opt, newCPUTimeOpts...) + } + i, err := m.Float64Counter( "container.cpu.time", - append([]metric.Float64CounterOption{ - metric.WithDescription("Total CPU time consumed."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return CPUTime{noop.Float64Counter{}}, err @@ -186,6 +194,11 @@ type CPUUsage struct { metric.Int64Gauge } +var newCPUUsageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), + metric.WithUnit("{cpu}"), +} + // NewCPUUsage returns a new CPUUsage instrument. func NewCPUUsage( m metric.Meter, @@ -196,12 +209,15 @@ func NewCPUUsage( return CPUUsage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUUsageOpts + } else { + opt = append(opt, newCPUUsageOpts...) + } + i, err := m.Int64Gauge( "container.cpu.usage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return CPUUsage{noop.Int64Gauge{}}, err @@ -295,6 +311,11 @@ type DiskIO struct { metric.Int64Counter } +var newDiskIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Disk bytes for the container."), + metric.WithUnit("By"), +} + // NewDiskIO returns a new DiskIO instrument. func NewDiskIO( m metric.Meter, @@ -305,12 +326,15 @@ func NewDiskIO( return DiskIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskIOOpts + } else { + opt = append(opt, newDiskIOOpts...) + } + i, err := m.Int64Counter( "container.disk.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Disk bytes for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return DiskIO{noop.Int64Counter{}}, err @@ -409,6 +433,11 @@ type FilesystemAvailable struct { metric.Int64UpDownCounter } +var newFilesystemAvailableOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Container filesystem available bytes."), + metric.WithUnit("By"), +} + // NewFilesystemAvailable returns a new FilesystemAvailable instrument. func NewFilesystemAvailable( m metric.Meter, @@ -419,12 +448,15 @@ func NewFilesystemAvailable( return FilesystemAvailable{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newFilesystemAvailableOpts + } else { + opt = append(opt, newFilesystemAvailableOpts...) + } + i, err := m.Int64UpDownCounter( "container.filesystem.available", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Container filesystem available bytes."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemAvailable{noop.Int64UpDownCounter{}}, err @@ -509,6 +541,11 @@ type FilesystemCapacity struct { metric.Int64UpDownCounter } +var newFilesystemCapacityOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Container filesystem capacity."), + metric.WithUnit("By"), +} + // NewFilesystemCapacity returns a new FilesystemCapacity instrument. func NewFilesystemCapacity( m metric.Meter, @@ -519,12 +556,15 @@ func NewFilesystemCapacity( return FilesystemCapacity{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newFilesystemCapacityOpts + } else { + opt = append(opt, newFilesystemCapacityOpts...) + } + i, err := m.Int64UpDownCounter( "container.filesystem.capacity", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Container filesystem capacity."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemCapacity{noop.Int64UpDownCounter{}}, err @@ -609,6 +649,11 @@ type FilesystemUsage struct { metric.Int64UpDownCounter } +var newFilesystemUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Container filesystem usage."), + metric.WithUnit("By"), +} + // NewFilesystemUsage returns a new FilesystemUsage instrument. func NewFilesystemUsage( m metric.Meter, @@ -619,12 +664,15 @@ func NewFilesystemUsage( return FilesystemUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newFilesystemUsageOpts + } else { + opt = append(opt, newFilesystemUsageOpts...) + } + i, err := m.Int64UpDownCounter( "container.filesystem.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Container filesystem usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemUsage{noop.Int64UpDownCounter{}}, err @@ -713,6 +761,11 @@ type MemoryUsage struct { metric.Int64Counter } +var newMemoryUsageOpts = []metric.Int64CounterOption{ + metric.WithDescription("Memory usage of the container."), + metric.WithUnit("By"), +} + // NewMemoryUsage returns a new MemoryUsage instrument. func NewMemoryUsage( m metric.Meter, @@ -723,12 +776,15 @@ func NewMemoryUsage( return MemoryUsage{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newMemoryUsageOpts + } else { + opt = append(opt, newMemoryUsageOpts...) + } + i, err := m.Int64Counter( "container.memory.usage", - append([]metric.Int64CounterOption{ - metric.WithDescription("Memory usage of the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryUsage{noop.Int64Counter{}}, err @@ -801,6 +857,11 @@ type NetworkIO struct { metric.Int64Counter } +var newNetworkIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Network bytes for the container."), + metric.WithUnit("By"), +} + // NewNetworkIO returns a new NetworkIO instrument. func NewNetworkIO( m metric.Meter, @@ -811,12 +872,15 @@ func NewNetworkIO( return NetworkIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkIOOpts + } else { + opt = append(opt, newNetworkIOOpts...) + } + i, err := m.Int64Counter( "container.network.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Network bytes for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NetworkIO{noop.Int64Counter{}}, err @@ -915,6 +979,11 @@ type Uptime struct { metric.Float64Gauge } +var newUptimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time the container has been running."), + metric.WithUnit("s"), +} + // NewUptime returns a new Uptime instrument. func NewUptime( m metric.Meter, @@ -925,12 +994,15 @@ func NewUptime( return Uptime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newUptimeOpts + } else { + opt = append(opt, newUptimeOpts...) + } + i, err := m.Float64Gauge( "container.uptime", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time the container has been running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return Uptime{noop.Float64Gauge{}}, err diff --git a/semconv/v1.37.0/dbconv/metric.go b/semconv/v1.37.0/dbconv/metric.go index e08447e53..eba312e87 100644 --- a/semconv/v1.37.0/dbconv/metric.go +++ b/semconv/v1.37.0/dbconv/metric.go @@ -224,6 +224,11 @@ type ClientConnectionCount struct { metric.Int64UpDownCounter } +var newClientConnectionCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of connections that are currently in state described by the `state` attribute."), + metric.WithUnit("{connection}"), +} + // NewClientConnectionCount returns a new ClientConnectionCount instrument. func NewClientConnectionCount( m metric.Meter, @@ -234,12 +239,15 @@ func NewClientConnectionCount( return ClientConnectionCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionCountOpts + } else { + opt = append(opt, newClientConnectionCountOpts...) + } + i, err := m.Int64UpDownCounter( "db.client.connection.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of connections that are currently in state described by the `state` attribute."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionCount{noop.Int64UpDownCounter{}}, err @@ -334,6 +342,11 @@ type ClientConnectionCreateTime struct { metric.Float64Histogram } +var newClientConnectionCreateTimeOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The time it took to create a new connection."), + metric.WithUnit("s"), +} + // NewClientConnectionCreateTime returns a new ClientConnectionCreateTime // instrument. func NewClientConnectionCreateTime( @@ -345,12 +358,15 @@ func NewClientConnectionCreateTime( return ClientConnectionCreateTime{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionCreateTimeOpts + } else { + opt = append(opt, newClientConnectionCreateTimeOpts...) + } + i, err := m.Float64Histogram( "db.client.connection.create_time", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The time it took to create a new connection."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionCreateTime{noop.Float64Histogram{}}, err @@ -440,6 +456,11 @@ type ClientConnectionIdleMax struct { metric.Int64UpDownCounter } +var newClientConnectionIdleMaxOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The maximum number of idle open connections allowed."), + metric.WithUnit("{connection}"), +} + // NewClientConnectionIdleMax returns a new ClientConnectionIdleMax instrument. func NewClientConnectionIdleMax( m metric.Meter, @@ -450,12 +471,15 @@ func NewClientConnectionIdleMax( return ClientConnectionIdleMax{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionIdleMaxOpts + } else { + opt = append(opt, newClientConnectionIdleMaxOpts...) + } + i, err := m.Int64UpDownCounter( "db.client.connection.idle.max", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The maximum number of idle open connections allowed."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionIdleMax{noop.Int64UpDownCounter{}}, err @@ -546,6 +570,11 @@ type ClientConnectionIdleMin struct { metric.Int64UpDownCounter } +var newClientConnectionIdleMinOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The minimum number of idle open connections allowed."), + metric.WithUnit("{connection}"), +} + // NewClientConnectionIdleMin returns a new ClientConnectionIdleMin instrument. func NewClientConnectionIdleMin( m metric.Meter, @@ -556,12 +585,15 @@ func NewClientConnectionIdleMin( return ClientConnectionIdleMin{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionIdleMinOpts + } else { + opt = append(opt, newClientConnectionIdleMinOpts...) + } + i, err := m.Int64UpDownCounter( "db.client.connection.idle.min", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The minimum number of idle open connections allowed."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionIdleMin{noop.Int64UpDownCounter{}}, err @@ -652,6 +684,11 @@ type ClientConnectionMax struct { metric.Int64UpDownCounter } +var newClientConnectionMaxOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The maximum number of open connections allowed."), + metric.WithUnit("{connection}"), +} + // NewClientConnectionMax returns a new ClientConnectionMax instrument. func NewClientConnectionMax( m metric.Meter, @@ -662,12 +699,15 @@ func NewClientConnectionMax( return ClientConnectionMax{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionMaxOpts + } else { + opt = append(opt, newClientConnectionMaxOpts...) + } + i, err := m.Int64UpDownCounter( "db.client.connection.max", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The maximum number of open connections allowed."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionMax{noop.Int64UpDownCounter{}}, err @@ -759,6 +799,11 @@ type ClientConnectionPendingRequests struct { metric.Int64UpDownCounter } +var newClientConnectionPendingRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of current pending requests for an open connection."), + metric.WithUnit("{request}"), +} + // NewClientConnectionPendingRequests returns a new // ClientConnectionPendingRequests instrument. func NewClientConnectionPendingRequests( @@ -770,12 +815,15 @@ func NewClientConnectionPendingRequests( return ClientConnectionPendingRequests{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionPendingRequestsOpts + } else { + opt = append(opt, newClientConnectionPendingRequestsOpts...) + } + i, err := m.Int64UpDownCounter( "db.client.connection.pending_requests", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of current pending requests for an open connection."), - metric.WithUnit("{request}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionPendingRequests{noop.Int64UpDownCounter{}}, err @@ -867,6 +915,11 @@ type ClientConnectionTimeouts struct { metric.Int64Counter } +var newClientConnectionTimeoutsOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of connection timeouts that have occurred trying to obtain a connection from the pool."), + metric.WithUnit("{timeout}"), +} + // NewClientConnectionTimeouts returns a new ClientConnectionTimeouts instrument. func NewClientConnectionTimeouts( m metric.Meter, @@ -877,12 +930,15 @@ func NewClientConnectionTimeouts( return ClientConnectionTimeouts{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionTimeoutsOpts + } else { + opt = append(opt, newClientConnectionTimeoutsOpts...) + } + i, err := m.Int64Counter( "db.client.connection.timeouts", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of connection timeouts that have occurred trying to obtain a connection from the pool."), - metric.WithUnit("{timeout}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionTimeouts{noop.Int64Counter{}}, err @@ -974,6 +1030,11 @@ type ClientConnectionUseTime struct { metric.Float64Histogram } +var newClientConnectionUseTimeOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The time between borrowing a connection and returning it to the pool."), + metric.WithUnit("s"), +} + // NewClientConnectionUseTime returns a new ClientConnectionUseTime instrument. func NewClientConnectionUseTime( m metric.Meter, @@ -984,12 +1045,15 @@ func NewClientConnectionUseTime( return ClientConnectionUseTime{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionUseTimeOpts + } else { + opt = append(opt, newClientConnectionUseTimeOpts...) + } + i, err := m.Float64Histogram( "db.client.connection.use_time", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The time between borrowing a connection and returning it to the pool."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionUseTime{noop.Float64Histogram{}}, err @@ -1079,6 +1143,11 @@ type ClientConnectionWaitTime struct { metric.Float64Histogram } +var newClientConnectionWaitTimeOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The time it took to obtain an open connection from the pool."), + metric.WithUnit("s"), +} + // NewClientConnectionWaitTime returns a new ClientConnectionWaitTime instrument. func NewClientConnectionWaitTime( m metric.Meter, @@ -1089,12 +1158,15 @@ func NewClientConnectionWaitTime( return ClientConnectionWaitTime{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionWaitTimeOpts + } else { + opt = append(opt, newClientConnectionWaitTimeOpts...) + } + i, err := m.Float64Histogram( "db.client.connection.wait_time", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The time it took to obtain an open connection from the pool."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionWaitTime{noop.Float64Histogram{}}, err @@ -1184,6 +1256,11 @@ type ClientOperationDuration struct { metric.Float64Histogram } +var newClientOperationDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of database client operations."), + metric.WithUnit("s"), +} + // NewClientOperationDuration returns a new ClientOperationDuration instrument. func NewClientOperationDuration( m metric.Meter, @@ -1194,12 +1271,15 @@ func NewClientOperationDuration( return ClientOperationDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientOperationDurationOpts + } else { + opt = append(opt, newClientOperationDurationOpts...) + } + i, err := m.Float64Histogram( "db.client.operation.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of database client operations."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientOperationDuration{noop.Float64Histogram{}}, err @@ -1371,6 +1451,11 @@ type ClientResponseReturnedRows struct { metric.Int64Histogram } +var newClientResponseReturnedRowsOpts = []metric.Int64HistogramOption{ + metric.WithDescription("The actual number of records returned by the database operation."), + metric.WithUnit("{row}"), +} + // NewClientResponseReturnedRows returns a new ClientResponseReturnedRows // instrument. func NewClientResponseReturnedRows( @@ -1382,12 +1467,15 @@ func NewClientResponseReturnedRows( return ClientResponseReturnedRows{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientResponseReturnedRowsOpts + } else { + opt = append(opt, newClientResponseReturnedRowsOpts...) + } + i, err := m.Int64Histogram( "db.client.response.returned_rows", - append([]metric.Int64HistogramOption{ - metric.WithDescription("The actual number of records returned by the database operation."), - metric.WithUnit("{row}"), - }, opt...)..., + opt..., ) if err != nil { return ClientResponseReturnedRows{noop.Int64Histogram{}}, err diff --git a/semconv/v1.37.0/dnsconv/metric.go b/semconv/v1.37.0/dnsconv/metric.go index b5348a23f..18629a679 100644 --- a/semconv/v1.37.0/dnsconv/metric.go +++ b/semconv/v1.37.0/dnsconv/metric.go @@ -38,6 +38,11 @@ type LookupDuration struct { metric.Float64Histogram } +var newLookupDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the time taken to perform a DNS lookup."), + metric.WithUnit("s"), +} + // NewLookupDuration returns a new LookupDuration instrument. func NewLookupDuration( m metric.Meter, @@ -48,12 +53,15 @@ func NewLookupDuration( return LookupDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newLookupDurationOpts + } else { + opt = append(opt, newLookupDurationOpts...) + } + i, err := m.Float64Histogram( "dns.lookup.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Measures the time taken to perform a DNS lookup."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return LookupDuration{noop.Float64Histogram{}}, err diff --git a/semconv/v1.37.0/faasconv/metric.go b/semconv/v1.37.0/faasconv/metric.go index f2f0510bb..a402982b2 100644 --- a/semconv/v1.37.0/faasconv/metric.go +++ b/semconv/v1.37.0/faasconv/metric.go @@ -48,6 +48,11 @@ type Coldstarts struct { metric.Int64Counter } +var newColdstartsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of invocation cold starts."), + metric.WithUnit("{coldstart}"), +} + // NewColdstarts returns a new Coldstarts instrument. func NewColdstarts( m metric.Meter, @@ -58,12 +63,15 @@ func NewColdstarts( return Coldstarts{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newColdstartsOpts + } else { + opt = append(opt, newColdstartsOpts...) + } + i, err := m.Int64Counter( "faas.coldstarts", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of invocation cold starts."), - metric.WithUnit("{coldstart}"), - }, opt...)..., + opt..., ) if err != nil { return Coldstarts{noop.Int64Counter{}}, err @@ -151,6 +159,11 @@ type CPUUsage struct { metric.Float64Histogram } +var newCPUUsageOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Distribution of CPU usage per invocation."), + metric.WithUnit("s"), +} + // NewCPUUsage returns a new CPUUsage instrument. func NewCPUUsage( m metric.Meter, @@ -161,12 +174,15 @@ func NewCPUUsage( return CPUUsage{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newCPUUsageOpts + } else { + opt = append(opt, newCPUUsageOpts...) + } + i, err := m.Float64Histogram( "faas.cpu_usage", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Distribution of CPU usage per invocation."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return CPUUsage{noop.Float64Histogram{}}, err @@ -253,6 +269,11 @@ type Errors struct { metric.Int64Counter } +var newErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of invocation errors."), + metric.WithUnit("{error}"), +} + // NewErrors returns a new Errors instrument. func NewErrors( m metric.Meter, @@ -263,12 +284,15 @@ func NewErrors( return Errors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newErrorsOpts + } else { + opt = append(opt, newErrorsOpts...) + } + i, err := m.Int64Counter( "faas.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of invocation errors."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return Errors{noop.Int64Counter{}}, err @@ -356,6 +380,11 @@ type InitDuration struct { metric.Float64Histogram } +var newInitDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of the function's initialization, such as a cold start."), + metric.WithUnit("s"), +} + // NewInitDuration returns a new InitDuration instrument. func NewInitDuration( m metric.Meter, @@ -366,12 +395,15 @@ func NewInitDuration( return InitDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newInitDurationOpts + } else { + opt = append(opt, newInitDurationOpts...) + } + i, err := m.Float64Histogram( "faas.init_duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of the function's initialization, such as a cold start."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return InitDuration{noop.Float64Histogram{}}, err @@ -458,6 +490,11 @@ type Invocations struct { metric.Int64Counter } +var newInvocationsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of successful invocations."), + metric.WithUnit("{invocation}"), +} + // NewInvocations returns a new Invocations instrument. func NewInvocations( m metric.Meter, @@ -468,12 +505,15 @@ func NewInvocations( return Invocations{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newInvocationsOpts + } else { + opt = append(opt, newInvocationsOpts...) + } + i, err := m.Int64Counter( "faas.invocations", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of successful invocations."), - metric.WithUnit("{invocation}"), - }, opt...)..., + opt..., ) if err != nil { return Invocations{noop.Int64Counter{}}, err @@ -561,6 +601,11 @@ type InvokeDuration struct { metric.Float64Histogram } +var newInvokeDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of the function's logic execution."), + metric.WithUnit("s"), +} + // NewInvokeDuration returns a new InvokeDuration instrument. func NewInvokeDuration( m metric.Meter, @@ -571,12 +616,15 @@ func NewInvokeDuration( return InvokeDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newInvokeDurationOpts + } else { + opt = append(opt, newInvokeDurationOpts...) + } + i, err := m.Float64Histogram( "faas.invoke_duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of the function's logic execution."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return InvokeDuration{noop.Float64Histogram{}}, err @@ -663,6 +711,11 @@ type MemUsage struct { metric.Int64Histogram } +var newMemUsageOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Distribution of max memory usage per invocation."), + metric.WithUnit("By"), +} + // NewMemUsage returns a new MemUsage instrument. func NewMemUsage( m metric.Meter, @@ -673,12 +726,15 @@ func NewMemUsage( return MemUsage{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newMemUsageOpts + } else { + opt = append(opt, newMemUsageOpts...) + } + i, err := m.Int64Histogram( "faas.mem_usage", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Distribution of max memory usage per invocation."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemUsage{noop.Int64Histogram{}}, err @@ -765,6 +821,11 @@ type NetIO struct { metric.Int64Histogram } +var newNetIOOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Distribution of net I/O usage per invocation."), + metric.WithUnit("By"), +} + // NewNetIO returns a new NetIO instrument. func NewNetIO( m metric.Meter, @@ -775,12 +836,15 @@ func NewNetIO( return NetIO{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newNetIOOpts + } else { + opt = append(opt, newNetIOOpts...) + } + i, err := m.Int64Histogram( "faas.net_io", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Distribution of net I/O usage per invocation."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NetIO{noop.Int64Histogram{}}, err @@ -867,6 +931,11 @@ type Timeouts struct { metric.Int64Counter } +var newTimeoutsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of invocation timeouts."), + metric.WithUnit("{timeout}"), +} + // NewTimeouts returns a new Timeouts instrument. func NewTimeouts( m metric.Meter, @@ -877,12 +946,15 @@ func NewTimeouts( return Timeouts{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newTimeoutsOpts + } else { + opt = append(opt, newTimeoutsOpts...) + } + i, err := m.Int64Counter( "faas.timeouts", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of invocation timeouts."), - metric.WithUnit("{timeout}"), - }, opt...)..., + opt..., ) if err != nil { return Timeouts{noop.Int64Counter{}}, err diff --git a/semconv/v1.37.0/genaiconv/metric.go b/semconv/v1.37.0/genaiconv/metric.go index a697015c9..c2676aee8 100644 --- a/semconv/v1.37.0/genaiconv/metric.go +++ b/semconv/v1.37.0/genaiconv/metric.go @@ -147,6 +147,11 @@ type ClientOperationDuration struct { metric.Float64Histogram } +var newClientOperationDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("GenAI operation duration."), + metric.WithUnit("s"), +} + // NewClientOperationDuration returns a new ClientOperationDuration instrument. func NewClientOperationDuration( m metric.Meter, @@ -157,12 +162,15 @@ func NewClientOperationDuration( return ClientOperationDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientOperationDurationOpts + } else { + opt = append(opt, newClientOperationDurationOpts...) + } + i, err := m.Float64Histogram( "gen_ai.client.operation.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("GenAI operation duration."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientOperationDuration{noop.Float64Histogram{}}, err @@ -286,6 +294,11 @@ type ClientTokenUsage struct { metric.Int64Histogram } +var newClientTokenUsageOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Number of input and output tokens used."), + metric.WithUnit("{token}"), +} + // NewClientTokenUsage returns a new ClientTokenUsage instrument. func NewClientTokenUsage( m metric.Meter, @@ -296,12 +309,15 @@ func NewClientTokenUsage( return ClientTokenUsage{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientTokenUsageOpts + } else { + opt = append(opt, newClientTokenUsageOpts...) + } + i, err := m.Int64Histogram( "gen_ai.client.token.usage", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Number of input and output tokens used."), - metric.WithUnit("{token}"), - }, opt...)..., + opt..., ) if err != nil { return ClientTokenUsage{noop.Int64Histogram{}}, err @@ -423,6 +439,11 @@ type ServerRequestDuration struct { metric.Float64Histogram } +var newServerRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Generative AI server request duration such as time-to-last byte or last output token."), + metric.WithUnit("s"), +} + // NewServerRequestDuration returns a new ServerRequestDuration instrument. func NewServerRequestDuration( m metric.Meter, @@ -433,12 +454,15 @@ func NewServerRequestDuration( return ServerRequestDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerRequestDurationOpts + } else { + opt = append(opt, newServerRequestDurationOpts...) + } + i, err := m.Float64Histogram( "gen_ai.server.request.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Generative AI server request duration such as time-to-last byte or last output token."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ServerRequestDuration{noop.Float64Histogram{}}, err @@ -563,6 +587,11 @@ type ServerTimePerOutputToken struct { metric.Float64Histogram } +var newServerTimePerOutputTokenOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Time per output token generated after the first token for successful responses."), + metric.WithUnit("s"), +} + // NewServerTimePerOutputToken returns a new ServerTimePerOutputToken instrument. func NewServerTimePerOutputToken( m metric.Meter, @@ -573,12 +602,15 @@ func NewServerTimePerOutputToken( return ServerTimePerOutputToken{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerTimePerOutputTokenOpts + } else { + opt = append(opt, newServerTimePerOutputTokenOpts...) + } + i, err := m.Float64Histogram( "gen_ai.server.time_per_output_token", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Time per output token generated after the first token for successful responses."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ServerTimePerOutputToken{noop.Float64Histogram{}}, err @@ -695,6 +727,11 @@ type ServerTimeToFirstToken struct { metric.Float64Histogram } +var newServerTimeToFirstTokenOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Time to generate first token for successful responses."), + metric.WithUnit("s"), +} + // NewServerTimeToFirstToken returns a new ServerTimeToFirstToken instrument. func NewServerTimeToFirstToken( m metric.Meter, @@ -705,12 +742,15 @@ func NewServerTimeToFirstToken( return ServerTimeToFirstToken{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerTimeToFirstTokenOpts + } else { + opt = append(opt, newServerTimeToFirstTokenOpts...) + } + i, err := m.Float64Histogram( "gen_ai.server.time_to_first_token", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Time to generate first token for successful responses."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ServerTimeToFirstToken{noop.Float64Histogram{}}, err diff --git a/semconv/v1.37.0/goconv/metric.go b/semconv/v1.37.0/goconv/metric.go index fe9e2933e..14f4b3313 100644 --- a/semconv/v1.37.0/goconv/metric.go +++ b/semconv/v1.37.0/goconv/metric.go @@ -41,6 +41,11 @@ type ConfigGogc struct { metric.Int64ObservableUpDownCounter } +var newConfigGogcOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Heap size target percentage configured by the user, otherwise 100."), + metric.WithUnit("%"), +} + // NewConfigGogc returns a new ConfigGogc instrument. func NewConfigGogc( m metric.Meter, @@ -51,12 +56,15 @@ func NewConfigGogc( return ConfigGogc{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newConfigGogcOpts + } else { + opt = append(opt, newConfigGogcOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.config.gogc", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Heap size target percentage configured by the user, otherwise 100."), - metric.WithUnit("%"), - }, opt...)..., + opt..., ) if err != nil { return ConfigGogc{noop.Int64ObservableUpDownCounter{}}, err @@ -91,6 +99,11 @@ type GoroutineCount struct { metric.Int64ObservableUpDownCounter } +var newGoroutineCountOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Count of live goroutines."), + metric.WithUnit("{goroutine}"), +} + // NewGoroutineCount returns a new GoroutineCount instrument. func NewGoroutineCount( m metric.Meter, @@ -101,12 +114,15 @@ func NewGoroutineCount( return GoroutineCount{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newGoroutineCountOpts + } else { + opt = append(opt, newGoroutineCountOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.goroutine.count", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Count of live goroutines."), - metric.WithUnit("{goroutine}"), - }, opt...)..., + opt..., ) if err != nil { return GoroutineCount{noop.Int64ObservableUpDownCounter{}}, err @@ -141,6 +157,11 @@ type MemoryAllocated struct { metric.Int64ObservableCounter } +var newMemoryAllocatedOpts = []metric.Int64ObservableCounterOption{ + metric.WithDescription("Memory allocated to the heap by the application."), + metric.WithUnit("By"), +} + // NewMemoryAllocated returns a new MemoryAllocated instrument. func NewMemoryAllocated( m metric.Meter, @@ -151,12 +172,15 @@ func NewMemoryAllocated( return MemoryAllocated{noop.Int64ObservableCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryAllocatedOpts + } else { + opt = append(opt, newMemoryAllocatedOpts...) + } + i, err := m.Int64ObservableCounter( "go.memory.allocated", - append([]metric.Int64ObservableCounterOption{ - metric.WithDescription("Memory allocated to the heap by the application."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryAllocated{noop.Int64ObservableCounter{}}, err @@ -191,6 +215,11 @@ type MemoryAllocations struct { metric.Int64ObservableCounter } +var newMemoryAllocationsOpts = []metric.Int64ObservableCounterOption{ + metric.WithDescription("Count of allocations to the heap by the application."), + metric.WithUnit("{allocation}"), +} + // NewMemoryAllocations returns a new MemoryAllocations instrument. func NewMemoryAllocations( m metric.Meter, @@ -201,12 +230,15 @@ func NewMemoryAllocations( return MemoryAllocations{noop.Int64ObservableCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryAllocationsOpts + } else { + opt = append(opt, newMemoryAllocationsOpts...) + } + i, err := m.Int64ObservableCounter( "go.memory.allocations", - append([]metric.Int64ObservableCounterOption{ - metric.WithDescription("Count of allocations to the heap by the application."), - metric.WithUnit("{allocation}"), - }, opt...)..., + opt..., ) if err != nil { return MemoryAllocations{noop.Int64ObservableCounter{}}, err @@ -241,6 +273,11 @@ type MemoryGCGoal struct { metric.Int64ObservableUpDownCounter } +var newMemoryGCGoalOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Heap size target for the end of the GC cycle."), + metric.WithUnit("By"), +} + // NewMemoryGCGoal returns a new MemoryGCGoal instrument. func NewMemoryGCGoal( m metric.Meter, @@ -251,12 +288,15 @@ func NewMemoryGCGoal( return MemoryGCGoal{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryGCGoalOpts + } else { + opt = append(opt, newMemoryGCGoalOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.memory.gc.goal", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Heap size target for the end of the GC cycle."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryGCGoal{noop.Int64ObservableUpDownCounter{}}, err @@ -291,6 +331,11 @@ type MemoryLimit struct { metric.Int64ObservableUpDownCounter } +var newMemoryLimitOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Go runtime memory limit configured by the user, if a limit exists."), + metric.WithUnit("By"), +} + // NewMemoryLimit returns a new MemoryLimit instrument. func NewMemoryLimit( m metric.Meter, @@ -301,12 +346,15 @@ func NewMemoryLimit( return MemoryLimit{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryLimitOpts + } else { + opt = append(opt, newMemoryLimitOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.memory.limit", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Go runtime memory limit configured by the user, if a limit exists."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryLimit{noop.Int64ObservableUpDownCounter{}}, err @@ -341,6 +389,11 @@ type MemoryUsed struct { metric.Int64ObservableUpDownCounter } +var newMemoryUsedOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Memory used by the Go runtime."), + metric.WithUnit("By"), +} + // NewMemoryUsed returns a new MemoryUsed instrument. func NewMemoryUsed( m metric.Meter, @@ -351,12 +404,15 @@ func NewMemoryUsed( return MemoryUsed{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryUsedOpts + } else { + opt = append(opt, newMemoryUsedOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.memory.used", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Memory used by the Go runtime."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryUsed{noop.Int64ObservableUpDownCounter{}}, err @@ -397,6 +453,11 @@ type ProcessorLimit struct { metric.Int64ObservableUpDownCounter } +var newProcessorLimitOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("The number of OS threads that can execute user-level Go code simultaneously."), + metric.WithUnit("{thread}"), +} + // NewProcessorLimit returns a new ProcessorLimit instrument. func NewProcessorLimit( m metric.Meter, @@ -407,12 +468,15 @@ func NewProcessorLimit( return ProcessorLimit{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newProcessorLimitOpts + } else { + opt = append(opt, newProcessorLimitOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "go.processor.limit", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The number of OS threads that can execute user-level Go code simultaneously."), - metric.WithUnit("{thread}"), - }, opt...)..., + opt..., ) if err != nil { return ProcessorLimit{noop.Int64ObservableUpDownCounter{}}, err @@ -448,6 +512,11 @@ type ScheduleDuration struct { metric.Float64Histogram } +var newScheduleDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The time goroutines have spent in the scheduler in a runnable state before actually running."), + metric.WithUnit("s"), +} + // NewScheduleDuration returns a new ScheduleDuration instrument. func NewScheduleDuration( m metric.Meter, @@ -458,12 +527,15 @@ func NewScheduleDuration( return ScheduleDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newScheduleDurationOpts + } else { + opt = append(opt, newScheduleDurationOpts...) + } + i, err := m.Float64Histogram( "go.schedule.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The time goroutines have spent in the scheduler in a runnable state before actually running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ScheduleDuration{noop.Float64Histogram{}}, err diff --git a/semconv/v1.37.0/httpconv/metric.go b/semconv/v1.37.0/httpconv/metric.go index 55bde895d..92b532d8a 100644 --- a/semconv/v1.37.0/httpconv/metric.go +++ b/semconv/v1.37.0/httpconv/metric.go @@ -91,6 +91,11 @@ type ClientActiveRequests struct { metric.Int64UpDownCounter } +var newClientActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP requests."), + metric.WithUnit("{request}"), +} + // NewClientActiveRequests returns a new ClientActiveRequests instrument. func NewClientActiveRequests( m metric.Meter, @@ -101,12 +106,15 @@ func NewClientActiveRequests( return ClientActiveRequests{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientActiveRequestsOpts + } else { + opt = append(opt, newClientActiveRequestsOpts...) + } + i, err := m.Int64UpDownCounter( "http.client.active_requests", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of active HTTP requests."), - metric.WithUnit("{request}"), - }, opt...)..., + opt..., ) if err != nil { return ClientActiveRequests{noop.Int64UpDownCounter{}}, err @@ -223,6 +231,11 @@ type ClientConnectionDuration struct { metric.Float64Histogram } +var newClientConnectionDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of the successfully established outbound HTTP connections."), + metric.WithUnit("s"), +} + // NewClientConnectionDuration returns a new ClientConnectionDuration instrument. func NewClientConnectionDuration( m metric.Meter, @@ -233,12 +246,15 @@ func NewClientConnectionDuration( return ClientConnectionDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientConnectionDurationOpts + } else { + opt = append(opt, newClientConnectionDurationOpts...) + } + i, err := m.Float64Histogram( "http.client.connection.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The duration of the successfully established outbound HTTP connections."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientConnectionDuration{noop.Float64Histogram{}}, err @@ -353,6 +369,11 @@ type ClientOpenConnections struct { metric.Int64UpDownCounter } +var newClientOpenConnectionsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of outbound HTTP connections that are currently active or idle on the client."), + metric.WithUnit("{connection}"), +} + // NewClientOpenConnections returns a new ClientOpenConnections instrument. func NewClientOpenConnections( m metric.Meter, @@ -363,12 +384,15 @@ func NewClientOpenConnections( return ClientOpenConnections{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newClientOpenConnectionsOpts + } else { + opt = append(opt, newClientOpenConnectionsOpts...) + } + i, err := m.Int64UpDownCounter( "http.client.open_connections", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of outbound HTTP connections that are currently active or idle on the client."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ClientOpenConnections{noop.Int64UpDownCounter{}}, err @@ -488,6 +512,11 @@ type ClientRequestBodySize struct { metric.Int64Histogram } +var newClientRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client request bodies."), + metric.WithUnit("By"), +} + // NewClientRequestBodySize returns a new ClientRequestBodySize instrument. func NewClientRequestBodySize( m metric.Meter, @@ -498,12 +527,15 @@ func NewClientRequestBodySize( return ClientRequestBodySize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientRequestBodySizeOpts + } else { + opt = append(opt, newClientRequestBodySizeOpts...) + } + i, err := m.Int64Histogram( "http.client.request.body.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Size of HTTP client request bodies."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ClientRequestBodySize{noop.Int64Histogram{}}, err @@ -662,6 +694,11 @@ type ClientRequestDuration struct { metric.Float64Histogram } +var newClientRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP client requests."), + metric.WithUnit("s"), +} + // NewClientRequestDuration returns a new ClientRequestDuration instrument. func NewClientRequestDuration( m metric.Meter, @@ -672,12 +709,15 @@ func NewClientRequestDuration( return ClientRequestDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientRequestDurationOpts + } else { + opt = append(opt, newClientRequestDurationOpts...) + } + i, err := m.Float64Histogram( "http.client.request.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of HTTP client requests."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientRequestDuration{noop.Float64Histogram{}}, err @@ -822,6 +862,11 @@ type ClientResponseBodySize struct { metric.Int64Histogram } +var newClientResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client response bodies."), + metric.WithUnit("By"), +} + // NewClientResponseBodySize returns a new ClientResponseBodySize instrument. func NewClientResponseBodySize( m metric.Meter, @@ -832,12 +877,15 @@ func NewClientResponseBodySize( return ClientResponseBodySize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientResponseBodySizeOpts + } else { + opt = append(opt, newClientResponseBodySizeOpts...) + } + i, err := m.Int64Histogram( "http.client.response.body.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Size of HTTP client response bodies."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ClientResponseBodySize{noop.Int64Histogram{}}, err @@ -996,6 +1044,11 @@ type ServerActiveRequests struct { metric.Int64UpDownCounter } +var newServerActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP server requests."), + metric.WithUnit("{request}"), +} + // NewServerActiveRequests returns a new ServerActiveRequests instrument. func NewServerActiveRequests( m metric.Meter, @@ -1006,12 +1059,15 @@ func NewServerActiveRequests( return ServerActiveRequests{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newServerActiveRequestsOpts + } else { + opt = append(opt, newServerActiveRequestsOpts...) + } + i, err := m.Int64UpDownCounter( "http.server.active_requests", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of active HTTP server requests."), - metric.WithUnit("{request}"), - }, opt...)..., + opt..., ) if err != nil { return ServerActiveRequests{noop.Int64UpDownCounter{}}, err @@ -1118,6 +1174,11 @@ type ServerRequestBodySize struct { metric.Int64Histogram } +var newServerRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server request bodies."), + metric.WithUnit("By"), +} + // NewServerRequestBodySize returns a new ServerRequestBodySize instrument. func NewServerRequestBodySize( m metric.Meter, @@ -1128,12 +1189,15 @@ func NewServerRequestBodySize( return ServerRequestBodySize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerRequestBodySizeOpts + } else { + opt = append(opt, newServerRequestBodySizeOpts...) + } + i, err := m.Int64Histogram( "http.server.request.body.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Size of HTTP server request bodies."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ServerRequestBodySize{noop.Int64Histogram{}}, err @@ -1299,6 +1363,11 @@ type ServerRequestDuration struct { metric.Float64Histogram } +var newServerRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP server requests."), + metric.WithUnit("s"), +} + // NewServerRequestDuration returns a new ServerRequestDuration instrument. func NewServerRequestDuration( m metric.Meter, @@ -1309,12 +1378,15 @@ func NewServerRequestDuration( return ServerRequestDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerRequestDurationOpts + } else { + opt = append(opt, newServerRequestDurationOpts...) + } + i, err := m.Float64Histogram( "http.server.request.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of HTTP server requests."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ServerRequestDuration{noop.Float64Histogram{}}, err @@ -1466,6 +1538,11 @@ type ServerResponseBodySize struct { metric.Int64Histogram } +var newServerResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server response bodies."), + metric.WithUnit("By"), +} + // NewServerResponseBodySize returns a new ServerResponseBodySize instrument. func NewServerResponseBodySize( m metric.Meter, @@ -1476,12 +1553,15 @@ func NewServerResponseBodySize( return ServerResponseBodySize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerResponseBodySizeOpts + } else { + opt = append(opt, newServerResponseBodySizeOpts...) + } + i, err := m.Int64Histogram( "http.server.response.body.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Size of HTTP server response bodies."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ServerResponseBodySize{noop.Int64Histogram{}}, err diff --git a/semconv/v1.37.0/hwconv/metric.go b/semconv/v1.37.0/hwconv/metric.go index b687e4bb3..9f249aeb5 100644 --- a/semconv/v1.37.0/hwconv/metric.go +++ b/semconv/v1.37.0/hwconv/metric.go @@ -192,6 +192,11 @@ type BatteryCharge struct { metric.Int64Gauge } +var newBatteryChargeOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Remaining fraction of battery charge."), + metric.WithUnit("1"), +} + // NewBatteryCharge returns a new BatteryCharge instrument. func NewBatteryCharge( m metric.Meter, @@ -202,12 +207,15 @@ func NewBatteryCharge( return BatteryCharge{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newBatteryChargeOpts + } else { + opt = append(opt, newBatteryChargeOpts...) + } + i, err := m.Int64Gauge( "hw.battery.charge", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Remaining fraction of battery charge."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return BatteryCharge{noop.Int64Gauge{}}, err @@ -336,6 +344,11 @@ type BatteryChargeLimit struct { metric.Int64Gauge } +var newBatteryChargeLimitOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Lower limit of battery charge fraction to ensure proper operation."), + metric.WithUnit("1"), +} + // NewBatteryChargeLimit returns a new BatteryChargeLimit instrument. func NewBatteryChargeLimit( m metric.Meter, @@ -346,12 +359,15 @@ func NewBatteryChargeLimit( return BatteryChargeLimit{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newBatteryChargeLimitOpts + } else { + opt = append(opt, newBatteryChargeLimitOpts...) + } + i, err := m.Int64Gauge( "hw.battery.charge.limit", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Lower limit of battery charge fraction to ensure proper operation."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return BatteryChargeLimit{noop.Int64Gauge{}}, err @@ -490,6 +506,11 @@ type BatteryTimeLeft struct { metric.Float64Gauge } +var newBatteryTimeLeftOpts = []metric.Float64GaugeOption{ + metric.WithDescription("Time left before battery is completely charged or discharged."), + metric.WithUnit("s"), +} + // NewBatteryTimeLeft returns a new BatteryTimeLeft instrument. func NewBatteryTimeLeft( m metric.Meter, @@ -500,12 +521,15 @@ func NewBatteryTimeLeft( return BatteryTimeLeft{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newBatteryTimeLeftOpts + } else { + opt = append(opt, newBatteryTimeLeftOpts...) + } + i, err := m.Float64Gauge( "hw.battery.time_left", - append([]metric.Float64GaugeOption{ - metric.WithDescription("Time left before battery is completely charged or discharged."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return BatteryTimeLeft{noop.Float64Gauge{}}, err @@ -643,6 +667,11 @@ type CPUSpeed struct { metric.Int64Gauge } +var newCPUSpeedOpts = []metric.Int64GaugeOption{ + metric.WithDescription("CPU current frequency."), + metric.WithUnit("Hz"), +} + // NewCPUSpeed returns a new CPUSpeed instrument. func NewCPUSpeed( m metric.Meter, @@ -653,12 +682,15 @@ func NewCPUSpeed( return CPUSpeed{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUSpeedOpts + } else { + opt = append(opt, newCPUSpeedOpts...) + } + i, err := m.Int64Gauge( "hw.cpu.speed", - append([]metric.Int64GaugeOption{ - metric.WithDescription("CPU current frequency."), - metric.WithUnit("Hz"), - }, opt...)..., + opt..., ) if err != nil { return CPUSpeed{noop.Int64Gauge{}}, err @@ -771,6 +803,11 @@ type CPUSpeedLimit struct { metric.Int64Gauge } +var newCPUSpeedLimitOpts = []metric.Int64GaugeOption{ + metric.WithDescription("CPU maximum frequency."), + metric.WithUnit("Hz"), +} + // NewCPUSpeedLimit returns a new CPUSpeedLimit instrument. func NewCPUSpeedLimit( m metric.Meter, @@ -781,12 +818,15 @@ func NewCPUSpeedLimit( return CPUSpeedLimit{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUSpeedLimitOpts + } else { + opt = append(opt, newCPUSpeedLimitOpts...) + } + i, err := m.Int64Gauge( "hw.cpu.speed.limit", - append([]metric.Int64GaugeOption{ - metric.WithDescription("CPU maximum frequency."), - metric.WithUnit("Hz"), - }, opt...)..., + opt..., ) if err != nil { return CPUSpeedLimit{noop.Int64Gauge{}}, err @@ -905,6 +945,11 @@ type Energy struct { metric.Int64Counter } +var newEnergyOpts = []metric.Int64CounterOption{ + metric.WithDescription("Energy consumed by the component."), + metric.WithUnit("J"), +} + // NewEnergy returns a new Energy instrument. func NewEnergy( m metric.Meter, @@ -915,12 +960,15 @@ func NewEnergy( return Energy{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newEnergyOpts + } else { + opt = append(opt, newEnergyOpts...) + } + i, err := m.Int64Counter( "hw.energy", - append([]metric.Int64CounterOption{ - metric.WithDescription("Energy consumed by the component."), - metric.WithUnit("J"), - }, opt...)..., + opt..., ) if err != nil { return Energy{noop.Int64Counter{}}, err @@ -1025,6 +1073,11 @@ type Errors struct { metric.Int64Counter } +var newErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of errors encountered by the component."), + metric.WithUnit("{error}"), +} + // NewErrors returns a new Errors instrument. func NewErrors( m metric.Meter, @@ -1035,12 +1088,15 @@ func NewErrors( return Errors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newErrorsOpts + } else { + opt = append(opt, newErrorsOpts...) + } + i, err := m.Int64Counter( "hw.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of errors encountered by the component."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return Errors{noop.Int64Counter{}}, err @@ -1158,6 +1214,11 @@ type FanSpeed struct { metric.Int64Gauge } +var newFanSpeedOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Fan speed in revolutions per minute."), + metric.WithUnit("rpm"), +} + // NewFanSpeed returns a new FanSpeed instrument. func NewFanSpeed( m metric.Meter, @@ -1168,12 +1229,15 @@ func NewFanSpeed( return FanSpeed{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newFanSpeedOpts + } else { + opt = append(opt, newFanSpeedOpts...) + } + i, err := m.Int64Gauge( "hw.fan.speed", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Fan speed in revolutions per minute."), - metric.WithUnit("rpm"), - }, opt...)..., + opt..., ) if err != nil { return FanSpeed{noop.Int64Gauge{}}, err @@ -1279,6 +1343,11 @@ type FanSpeedLimit struct { metric.Int64Gauge } +var newFanSpeedLimitOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Speed limit in rpm."), + metric.WithUnit("rpm"), +} + // NewFanSpeedLimit returns a new FanSpeedLimit instrument. func NewFanSpeedLimit( m metric.Meter, @@ -1289,12 +1358,15 @@ func NewFanSpeedLimit( return FanSpeedLimit{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newFanSpeedLimitOpts + } else { + opt = append(opt, newFanSpeedLimitOpts...) + } + i, err := m.Int64Gauge( "hw.fan.speed.limit", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Speed limit in rpm."), - metric.WithUnit("rpm"), - }, opt...)..., + opt..., ) if err != nil { return FanSpeedLimit{noop.Int64Gauge{}}, err @@ -1406,6 +1478,11 @@ type FanSpeedRatio struct { metric.Int64Gauge } +var newFanSpeedRatioOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Fan speed expressed as a fraction of its maximum speed."), + metric.WithUnit("1"), +} + // NewFanSpeedRatio returns a new FanSpeedRatio instrument. func NewFanSpeedRatio( m metric.Meter, @@ -1416,12 +1493,15 @@ func NewFanSpeedRatio( return FanSpeedRatio{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newFanSpeedRatioOpts + } else { + opt = append(opt, newFanSpeedRatioOpts...) + } + i, err := m.Int64Gauge( "hw.fan.speed_ratio", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Fan speed expressed as a fraction of its maximum speed."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return FanSpeedRatio{noop.Int64Gauge{}}, err @@ -1527,6 +1607,11 @@ type GpuIO struct { metric.Int64Counter } +var newGpuIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Received and transmitted bytes by the GPU."), + metric.WithUnit("By"), +} + // NewGpuIO returns a new GpuIO instrument. func NewGpuIO( m metric.Meter, @@ -1537,12 +1622,15 @@ func NewGpuIO( return GpuIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newGpuIOOpts + } else { + opt = append(opt, newGpuIOOpts...) + } + i, err := m.Int64Counter( "hw.gpu.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Received and transmitted bytes by the GPU."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return GpuIO{noop.Int64Counter{}}, err @@ -1681,6 +1769,11 @@ type GpuMemoryLimit struct { metric.Int64UpDownCounter } +var newGpuMemoryLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Size of the GPU memory."), + metric.WithUnit("By"), +} + // NewGpuMemoryLimit returns a new GpuMemoryLimit instrument. func NewGpuMemoryLimit( m metric.Meter, @@ -1691,12 +1784,15 @@ func NewGpuMemoryLimit( return GpuMemoryLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newGpuMemoryLimitOpts + } else { + opt = append(opt, newGpuMemoryLimitOpts...) + } + i, err := m.Int64UpDownCounter( "hw.gpu.memory.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Size of the GPU memory."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return GpuMemoryLimit{noop.Int64UpDownCounter{}}, err @@ -1830,6 +1926,11 @@ type GpuMemoryUsage struct { metric.Int64UpDownCounter } +var newGpuMemoryUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("GPU memory used."), + metric.WithUnit("By"), +} + // NewGpuMemoryUsage returns a new GpuMemoryUsage instrument. func NewGpuMemoryUsage( m metric.Meter, @@ -1840,12 +1941,15 @@ func NewGpuMemoryUsage( return GpuMemoryUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newGpuMemoryUsageOpts + } else { + opt = append(opt, newGpuMemoryUsageOpts...) + } + i, err := m.Int64UpDownCounter( "hw.gpu.memory.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("GPU memory used."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return GpuMemoryUsage{noop.Int64UpDownCounter{}}, err @@ -1980,6 +2084,11 @@ type GpuMemoryUtilization struct { metric.Int64Gauge } +var newGpuMemoryUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Fraction of GPU memory used."), + metric.WithUnit("1"), +} + // NewGpuMemoryUtilization returns a new GpuMemoryUtilization instrument. func NewGpuMemoryUtilization( m metric.Meter, @@ -1990,12 +2099,15 @@ func NewGpuMemoryUtilization( return GpuMemoryUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newGpuMemoryUtilizationOpts + } else { + opt = append(opt, newGpuMemoryUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.gpu.memory.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Fraction of GPU memory used."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return GpuMemoryUtilization{noop.Int64Gauge{}}, err @@ -2129,6 +2241,11 @@ type GpuUtilization struct { metric.Int64Gauge } +var newGpuUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Fraction of time spent in a specific task."), + metric.WithUnit("1"), +} + // NewGpuUtilization returns a new GpuUtilization instrument. func NewGpuUtilization( m metric.Meter, @@ -2139,12 +2256,15 @@ func NewGpuUtilization( return GpuUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newGpuUtilizationOpts + } else { + opt = append(opt, newGpuUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.gpu.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Fraction of time spent in a specific task."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return GpuUtilization{noop.Int64Gauge{}}, err @@ -2284,6 +2404,11 @@ type HostAmbientTemperature struct { metric.Int64Gauge } +var newHostAmbientTemperatureOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Ambient (external) temperature of the physical host."), + metric.WithUnit("Cel"), +} + // NewHostAmbientTemperature returns a new HostAmbientTemperature instrument. func NewHostAmbientTemperature( m metric.Meter, @@ -2294,12 +2419,15 @@ func NewHostAmbientTemperature( return HostAmbientTemperature{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHostAmbientTemperatureOpts + } else { + opt = append(opt, newHostAmbientTemperatureOpts...) + } + i, err := m.Int64Gauge( "hw.host.ambient_temperature", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Ambient (external) temperature of the physical host."), - metric.WithUnit("Cel"), - }, opt...)..., + opt..., ) if err != nil { return HostAmbientTemperature{noop.Int64Gauge{}}, err @@ -2399,6 +2527,11 @@ type HostEnergy struct { metric.Int64Counter } +var newHostEnergyOpts = []metric.Int64CounterOption{ + metric.WithDescription("Total energy consumed by the entire physical host, in joules."), + metric.WithUnit("J"), +} + // NewHostEnergy returns a new HostEnergy instrument. func NewHostEnergy( m metric.Meter, @@ -2409,12 +2542,15 @@ func NewHostEnergy( return HostEnergy{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newHostEnergyOpts + } else { + opt = append(opt, newHostEnergyOpts...) + } + i, err := m.Int64Counter( "hw.host.energy", - append([]metric.Int64CounterOption{ - metric.WithDescription("Total energy consumed by the entire physical host, in joules."), - metric.WithUnit("J"), - }, opt...)..., + opt..., ) if err != nil { return HostEnergy{noop.Int64Counter{}}, err @@ -2526,6 +2662,11 @@ type HostHeatingMargin struct { metric.Int64Gauge } +var newHostHeatingMarginOpts = []metric.Int64GaugeOption{ + metric.WithDescription("By how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors."), + metric.WithUnit("Cel"), +} + // NewHostHeatingMargin returns a new HostHeatingMargin instrument. func NewHostHeatingMargin( m metric.Meter, @@ -2536,12 +2677,15 @@ func NewHostHeatingMargin( return HostHeatingMargin{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHostHeatingMarginOpts + } else { + opt = append(opt, newHostHeatingMarginOpts...) + } + i, err := m.Int64Gauge( "hw.host.heating_margin", - append([]metric.Int64GaugeOption{ - metric.WithDescription("By how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors."), - metric.WithUnit("Cel"), - }, opt...)..., + opt..., ) if err != nil { return HostHeatingMargin{noop.Int64Gauge{}}, err @@ -2641,6 +2785,11 @@ type HostPower struct { metric.Int64Gauge } +var newHostPowerOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred)."), + metric.WithUnit("W"), +} + // NewHostPower returns a new HostPower instrument. func NewHostPower( m metric.Meter, @@ -2651,12 +2800,15 @@ func NewHostPower( return HostPower{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHostPowerOpts + } else { + opt = append(opt, newHostPowerOpts...) + } + i, err := m.Int64Gauge( "hw.host.power", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred)."), - metric.WithUnit("W"), - }, opt...)..., + opt..., ) if err != nil { return HostPower{noop.Int64Gauge{}}, err @@ -2766,6 +2918,11 @@ type LogicalDiskLimit struct { metric.Int64UpDownCounter } +var newLogicalDiskLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Size of the logical disk."), + metric.WithUnit("By"), +} + // NewLogicalDiskLimit returns a new LogicalDiskLimit instrument. func NewLogicalDiskLimit( m metric.Meter, @@ -2776,12 +2933,15 @@ func NewLogicalDiskLimit( return LogicalDiskLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newLogicalDiskLimitOpts + } else { + opt = append(opt, newLogicalDiskLimitOpts...) + } + i, err := m.Int64UpDownCounter( "hw.logical_disk.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Size of the logical disk."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return LogicalDiskLimit{noop.Int64UpDownCounter{}}, err @@ -2889,6 +3049,11 @@ type LogicalDiskUsage struct { metric.Int64UpDownCounter } +var newLogicalDiskUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Logical disk space usage."), + metric.WithUnit("By"), +} + // NewLogicalDiskUsage returns a new LogicalDiskUsage instrument. func NewLogicalDiskUsage( m metric.Meter, @@ -2899,12 +3064,15 @@ func NewLogicalDiskUsage( return LogicalDiskUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newLogicalDiskUsageOpts + } else { + opt = append(opt, newLogicalDiskUsageOpts...) + } + i, err := m.Int64UpDownCounter( "hw.logical_disk.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Logical disk space usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return LogicalDiskUsage{noop.Int64UpDownCounter{}}, err @@ -3016,6 +3184,11 @@ type LogicalDiskUtilization struct { metric.Int64Gauge } +var newLogicalDiskUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Logical disk space utilization as a fraction."), + metric.WithUnit("1"), +} + // NewLogicalDiskUtilization returns a new LogicalDiskUtilization instrument. func NewLogicalDiskUtilization( m metric.Meter, @@ -3026,12 +3199,15 @@ func NewLogicalDiskUtilization( return LogicalDiskUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newLogicalDiskUtilizationOpts + } else { + opt = append(opt, newLogicalDiskUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.logical_disk.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Logical disk space utilization as a fraction."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return LogicalDiskUtilization{noop.Int64Gauge{}}, err @@ -3142,6 +3318,11 @@ type MemorySize struct { metric.Int64UpDownCounter } +var newMemorySizeOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Size of the memory module."), + metric.WithUnit("By"), +} + // NewMemorySize returns a new MemorySize instrument. func NewMemorySize( m metric.Meter, @@ -3152,12 +3333,15 @@ func NewMemorySize( return MemorySize{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemorySizeOpts + } else { + opt = append(opt, newMemorySizeOpts...) + } + i, err := m.Int64UpDownCounter( "hw.memory.size", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Size of the memory module."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemorySize{noop.Int64UpDownCounter{}}, err @@ -3284,6 +3468,11 @@ type NetworkBandwidthLimit struct { metric.Int64UpDownCounter } +var newNetworkBandwidthLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Link speed."), + metric.WithUnit("By/s"), +} + // NewNetworkBandwidthLimit returns a new NetworkBandwidthLimit instrument. func NewNetworkBandwidthLimit( m metric.Meter, @@ -3294,12 +3483,15 @@ func NewNetworkBandwidthLimit( return NetworkBandwidthLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNetworkBandwidthLimitOpts + } else { + opt = append(opt, newNetworkBandwidthLimitOpts...) + } + i, err := m.Int64UpDownCounter( "hw.network.bandwidth.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Link speed."), - metric.WithUnit("By/s"), - }, opt...)..., + opt..., ) if err != nil { return NetworkBandwidthLimit{noop.Int64UpDownCounter{}}, err @@ -3434,6 +3626,11 @@ type NetworkBandwidthUtilization struct { metric.Int64Gauge } +var newNetworkBandwidthUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Utilization of the network bandwidth as a fraction."), + metric.WithUnit("1"), +} + // NewNetworkBandwidthUtilization returns a new NetworkBandwidthUtilization // instrument. func NewNetworkBandwidthUtilization( @@ -3445,12 +3642,15 @@ func NewNetworkBandwidthUtilization( return NetworkBandwidthUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newNetworkBandwidthUtilizationOpts + } else { + opt = append(opt, newNetworkBandwidthUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.network.bandwidth.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Utilization of the network bandwidth as a fraction."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return NetworkBandwidthUtilization{noop.Int64Gauge{}}, err @@ -3584,6 +3784,11 @@ type NetworkIO struct { metric.Int64Counter } +var newNetworkIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Received and transmitted network traffic in bytes."), + metric.WithUnit("By"), +} + // NewNetworkIO returns a new NetworkIO instrument. func NewNetworkIO( m metric.Meter, @@ -3594,12 +3799,15 @@ func NewNetworkIO( return NetworkIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkIOOpts + } else { + opt = append(opt, newNetworkIOOpts...) + } + i, err := m.Int64Counter( "hw.network.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Received and transmitted network traffic in bytes."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NetworkIO{noop.Int64Counter{}}, err @@ -3738,6 +3946,11 @@ type NetworkPackets struct { metric.Int64Counter } +var newNetworkPacketsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Received and transmitted network traffic in packets (or frames)."), + metric.WithUnit("{packet}"), +} + // NewNetworkPackets returns a new NetworkPackets instrument. func NewNetworkPackets( m metric.Meter, @@ -3748,12 +3961,15 @@ func NewNetworkPackets( return NetworkPackets{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkPacketsOpts + } else { + opt = append(opt, newNetworkPacketsOpts...) + } + i, err := m.Int64Counter( "hw.network.packets", - append([]metric.Int64CounterOption{ - metric.WithDescription("Received and transmitted network traffic in packets (or frames)."), - metric.WithUnit("{packet}"), - }, opt...)..., + opt..., ) if err != nil { return NetworkPackets{noop.Int64Counter{}}, err @@ -3892,6 +4108,11 @@ type NetworkUp struct { metric.Int64UpDownCounter } +var newNetworkUpOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Link status: `1` (up) or `0` (down)."), + metric.WithUnit("1"), +} + // NewNetworkUp returns a new NetworkUp instrument. func NewNetworkUp( m metric.Meter, @@ -3902,12 +4123,15 @@ func NewNetworkUp( return NetworkUp{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNetworkUpOpts + } else { + opt = append(opt, newNetworkUpOpts...) + } + i, err := m.Int64UpDownCounter( "hw.network.up", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Link status: `1` (up) or `0` (down)."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return NetworkUp{noop.Int64UpDownCounter{}}, err @@ -4042,6 +4266,11 @@ type PhysicalDiskEnduranceUtilization struct { metric.Int64Gauge } +var newPhysicalDiskEnduranceUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Endurance remaining for this SSD disk."), + metric.WithUnit("1"), +} + // NewPhysicalDiskEnduranceUtilization returns a new // PhysicalDiskEnduranceUtilization instrument. func NewPhysicalDiskEnduranceUtilization( @@ -4053,12 +4282,15 @@ func NewPhysicalDiskEnduranceUtilization( return PhysicalDiskEnduranceUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPhysicalDiskEnduranceUtilizationOpts + } else { + opt = append(opt, newPhysicalDiskEnduranceUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.physical_disk.endurance_utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Endurance remaining for this SSD disk."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return PhysicalDiskEnduranceUtilization{noop.Int64Gauge{}}, err @@ -4196,6 +4428,11 @@ type PhysicalDiskSize struct { metric.Int64UpDownCounter } +var newPhysicalDiskSizeOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Size of the disk."), + metric.WithUnit("By"), +} + // NewPhysicalDiskSize returns a new PhysicalDiskSize instrument. func NewPhysicalDiskSize( m metric.Meter, @@ -4206,12 +4443,15 @@ func NewPhysicalDiskSize( return PhysicalDiskSize{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPhysicalDiskSizeOpts + } else { + opt = append(opt, newPhysicalDiskSizeOpts...) + } + i, err := m.Int64UpDownCounter( "hw.physical_disk.size", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Size of the disk."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PhysicalDiskSize{noop.Int64UpDownCounter{}}, err @@ -4349,6 +4589,11 @@ type PhysicalDiskSmart struct { metric.Int64Gauge } +var newPhysicalDiskSmartOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Value of the corresponding [S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute."), + metric.WithUnit("1"), +} + // NewPhysicalDiskSmart returns a new PhysicalDiskSmart instrument. func NewPhysicalDiskSmart( m metric.Meter, @@ -4359,12 +4604,15 @@ func NewPhysicalDiskSmart( return PhysicalDiskSmart{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPhysicalDiskSmartOpts + } else { + opt = append(opt, newPhysicalDiskSmartOpts...) + } + i, err := m.Int64Gauge( "hw.physical_disk.smart", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Value of the corresponding [S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return PhysicalDiskSmart{noop.Int64Gauge{}}, err @@ -4508,6 +4756,11 @@ type Power struct { metric.Int64Gauge } +var newPowerOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Instantaneous power consumed by the component."), + metric.WithUnit("W"), +} + // NewPower returns a new Power instrument. func NewPower( m metric.Meter, @@ -4518,12 +4771,15 @@ func NewPower( return Power{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPowerOpts + } else { + opt = append(opt, newPowerOpts...) + } + i, err := m.Int64Gauge( "hw.power", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Instantaneous power consumed by the component."), - metric.WithUnit("W"), - }, opt...)..., + opt..., ) if err != nil { return Power{noop.Int64Gauge{}}, err @@ -4631,6 +4887,11 @@ type PowerSupplyLimit struct { metric.Int64UpDownCounter } +var newPowerSupplyLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Maximum power output of the power supply."), + metric.WithUnit("W"), +} + // NewPowerSupplyLimit returns a new PowerSupplyLimit instrument. func NewPowerSupplyLimit( m metric.Meter, @@ -4641,12 +4902,15 @@ func NewPowerSupplyLimit( return PowerSupplyLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPowerSupplyLimitOpts + } else { + opt = append(opt, newPowerSupplyLimitOpts...) + } + i, err := m.Int64UpDownCounter( "hw.power_supply.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Maximum power output of the power supply."), - metric.WithUnit("W"), - }, opt...)..., + opt..., ) if err != nil { return PowerSupplyLimit{noop.Int64UpDownCounter{}}, err @@ -4773,6 +5037,11 @@ type PowerSupplyUsage struct { metric.Int64UpDownCounter } +var newPowerSupplyUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Current power output of the power supply."), + metric.WithUnit("W"), +} + // NewPowerSupplyUsage returns a new PowerSupplyUsage instrument. func NewPowerSupplyUsage( m metric.Meter, @@ -4783,12 +5052,15 @@ func NewPowerSupplyUsage( return PowerSupplyUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPowerSupplyUsageOpts + } else { + opt = append(opt, newPowerSupplyUsageOpts...) + } + i, err := m.Int64UpDownCounter( "hw.power_supply.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Current power output of the power supply."), - metric.WithUnit("W"), - }, opt...)..., + opt..., ) if err != nil { return PowerSupplyUsage{noop.Int64UpDownCounter{}}, err @@ -4910,6 +5182,11 @@ type PowerSupplyUtilization struct { metric.Int64Gauge } +var newPowerSupplyUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Utilization of the power supply as a fraction of its maximum output."), + metric.WithUnit("1"), +} + // NewPowerSupplyUtilization returns a new PowerSupplyUtilization instrument. func NewPowerSupplyUtilization( m metric.Meter, @@ -4920,12 +5197,15 @@ func NewPowerSupplyUtilization( return PowerSupplyUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPowerSupplyUtilizationOpts + } else { + opt = append(opt, newPowerSupplyUtilizationOpts...) + } + i, err := m.Int64Gauge( "hw.power_supply.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Utilization of the power supply as a fraction of its maximum output."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return PowerSupplyUtilization{noop.Int64Gauge{}}, err @@ -5045,6 +5325,11 @@ type Status struct { metric.Int64UpDownCounter } +var newStatusOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Operational status: `1` (true) or `0` (false) for each of the possible states."), + metric.WithUnit("1"), +} + // NewStatus returns a new Status instrument. func NewStatus( m metric.Meter, @@ -5055,12 +5340,15 @@ func NewStatus( return Status{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newStatusOpts + } else { + opt = append(opt, newStatusOpts...) + } + i, err := m.Int64UpDownCounter( "hw.status", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Operational status: `1` (true) or `0` (false) for each of the possible states."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return Status{noop.Int64UpDownCounter{}}, err @@ -5185,6 +5473,11 @@ type TapeDriveOperations struct { metric.Int64Counter } +var newTapeDriveOperationsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Operations performed by the tape drive."), + metric.WithUnit("{operation}"), +} + // NewTapeDriveOperations returns a new TapeDriveOperations instrument. func NewTapeDriveOperations( m metric.Meter, @@ -5195,12 +5488,15 @@ func NewTapeDriveOperations( return TapeDriveOperations{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newTapeDriveOperationsOpts + } else { + opt = append(opt, newTapeDriveOperationsOpts...) + } + i, err := m.Int64Counter( "hw.tape_drive.operations", - append([]metric.Int64CounterOption{ - metric.WithDescription("Operations performed by the tape drive."), - metric.WithUnit("{operation}"), - }, opt...)..., + opt..., ) if err != nil { return TapeDriveOperations{noop.Int64Counter{}}, err @@ -5328,6 +5624,11 @@ type Temperature struct { metric.Int64Gauge } +var newTemperatureOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Temperature in degrees Celsius."), + metric.WithUnit("Cel"), +} + // NewTemperature returns a new Temperature instrument. func NewTemperature( m metric.Meter, @@ -5338,12 +5639,15 @@ func NewTemperature( return Temperature{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newTemperatureOpts + } else { + opt = append(opt, newTemperatureOpts...) + } + i, err := m.Int64Gauge( "hw.temperature", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Temperature in degrees Celsius."), - metric.WithUnit("Cel"), - }, opt...)..., + opt..., ) if err != nil { return Temperature{noop.Int64Gauge{}}, err @@ -5449,6 +5753,11 @@ type TemperatureLimit struct { metric.Int64Gauge } +var newTemperatureLimitOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Temperature limit in degrees Celsius."), + metric.WithUnit("Cel"), +} + // NewTemperatureLimit returns a new TemperatureLimit instrument. func NewTemperatureLimit( m metric.Meter, @@ -5459,12 +5768,15 @@ func NewTemperatureLimit( return TemperatureLimit{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newTemperatureLimitOpts + } else { + opt = append(opt, newTemperatureLimitOpts...) + } + i, err := m.Int64Gauge( "hw.temperature.limit", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Temperature limit in degrees Celsius."), - metric.WithUnit("Cel"), - }, opt...)..., + opt..., ) if err != nil { return TemperatureLimit{noop.Int64Gauge{}}, err @@ -5576,6 +5888,11 @@ type Voltage struct { metric.Int64Gauge } +var newVoltageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Voltage measured by the sensor."), + metric.WithUnit("V"), +} + // NewVoltage returns a new Voltage instrument. func NewVoltage( m metric.Meter, @@ -5586,12 +5903,15 @@ func NewVoltage( return Voltage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newVoltageOpts + } else { + opt = append(opt, newVoltageOpts...) + } + i, err := m.Int64Gauge( "hw.voltage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Voltage measured by the sensor."), - metric.WithUnit("V"), - }, opt...)..., + opt..., ) if err != nil { return Voltage{noop.Int64Gauge{}}, err @@ -5697,6 +6017,11 @@ type VoltageLimit struct { metric.Int64Gauge } +var newVoltageLimitOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Voltage limit in Volts."), + metric.WithUnit("V"), +} + // NewVoltageLimit returns a new VoltageLimit instrument. func NewVoltageLimit( m metric.Meter, @@ -5707,12 +6032,15 @@ func NewVoltageLimit( return VoltageLimit{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newVoltageLimitOpts + } else { + opt = append(opt, newVoltageLimitOpts...) + } + i, err := m.Int64Gauge( "hw.voltage.limit", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Voltage limit in Volts."), - metric.WithUnit("V"), - }, opt...)..., + opt..., ) if err != nil { return VoltageLimit{noop.Int64Gauge{}}, err @@ -5824,6 +6152,11 @@ type VoltageNominal struct { metric.Int64Gauge } +var newVoltageNominalOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Nominal (expected) voltage."), + metric.WithUnit("V"), +} + // NewVoltageNominal returns a new VoltageNominal instrument. func NewVoltageNominal( m metric.Meter, @@ -5834,12 +6167,15 @@ func NewVoltageNominal( return VoltageNominal{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newVoltageNominalOpts + } else { + opt = append(opt, newVoltageNominalOpts...) + } + i, err := m.Int64Gauge( "hw.voltage.nominal", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Nominal (expected) voltage."), - metric.WithUnit("V"), - }, opt...)..., + opt..., ) if err != nil { return VoltageNominal{noop.Int64Gauge{}}, err diff --git a/semconv/v1.37.0/k8sconv/metric.go b/semconv/v1.37.0/k8sconv/metric.go index 05e39c92e..5e9f768c4 100644 --- a/semconv/v1.37.0/k8sconv/metric.go +++ b/semconv/v1.37.0/k8sconv/metric.go @@ -179,6 +179,11 @@ type ContainerCPULimit struct { metric.Int64UpDownCounter } +var newContainerCPULimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Maximum CPU resource limit set for the container."), + metric.WithUnit("{cpu}"), +} + // NewContainerCPULimit returns a new ContainerCPULimit instrument. func NewContainerCPULimit( m metric.Meter, @@ -189,12 +194,15 @@ func NewContainerCPULimit( return ContainerCPULimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerCPULimitOpts + } else { + opt = append(opt, newContainerCPULimitOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.cpu.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Maximum CPU resource limit set for the container."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerCPULimit{noop.Int64UpDownCounter{}}, err @@ -271,6 +279,11 @@ type ContainerCPURequest struct { metric.Int64UpDownCounter } +var newContainerCPURequestOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("CPU resource requested for the container."), + metric.WithUnit("{cpu}"), +} + // NewContainerCPURequest returns a new ContainerCPURequest instrument. func NewContainerCPURequest( m metric.Meter, @@ -281,12 +294,15 @@ func NewContainerCPURequest( return ContainerCPURequest{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerCPURequestOpts + } else { + opt = append(opt, newContainerCPURequestOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.cpu.request", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("CPU resource requested for the container."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerCPURequest{noop.Int64UpDownCounter{}}, err @@ -364,6 +380,11 @@ type ContainerEphemeralStorageLimit struct { metric.Int64UpDownCounter } +var newContainerEphemeralStorageLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Maximum ephemeral storage resource limit set for the container."), + metric.WithUnit("By"), +} + // NewContainerEphemeralStorageLimit returns a new ContainerEphemeralStorageLimit // instrument. func NewContainerEphemeralStorageLimit( @@ -375,12 +396,15 @@ func NewContainerEphemeralStorageLimit( return ContainerEphemeralStorageLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerEphemeralStorageLimitOpts + } else { + opt = append(opt, newContainerEphemeralStorageLimitOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.ephemeral_storage.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Maximum ephemeral storage resource limit set for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerEphemeralStorageLimit{noop.Int64UpDownCounter{}}, err @@ -458,6 +482,11 @@ type ContainerEphemeralStorageRequest struct { metric.Int64UpDownCounter } +var newContainerEphemeralStorageRequestOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Ephemeral storage resource requested for the container."), + metric.WithUnit("By"), +} + // NewContainerEphemeralStorageRequest returns a new // ContainerEphemeralStorageRequest instrument. func NewContainerEphemeralStorageRequest( @@ -469,12 +498,15 @@ func NewContainerEphemeralStorageRequest( return ContainerEphemeralStorageRequest{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerEphemeralStorageRequestOpts + } else { + opt = append(opt, newContainerEphemeralStorageRequestOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.ephemeral_storage.request", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Ephemeral storage resource requested for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerEphemeralStorageRequest{noop.Int64UpDownCounter{}}, err @@ -551,6 +583,11 @@ type ContainerMemoryLimit struct { metric.Int64UpDownCounter } +var newContainerMemoryLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Maximum memory resource limit set for the container."), + metric.WithUnit("By"), +} + // NewContainerMemoryLimit returns a new ContainerMemoryLimit instrument. func NewContainerMemoryLimit( m metric.Meter, @@ -561,12 +598,15 @@ func NewContainerMemoryLimit( return ContainerMemoryLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerMemoryLimitOpts + } else { + opt = append(opt, newContainerMemoryLimitOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.memory.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Maximum memory resource limit set for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerMemoryLimit{noop.Int64UpDownCounter{}}, err @@ -643,6 +683,11 @@ type ContainerMemoryRequest struct { metric.Int64UpDownCounter } +var newContainerMemoryRequestOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Memory resource requested for the container."), + metric.WithUnit("By"), +} + // NewContainerMemoryRequest returns a new ContainerMemoryRequest instrument. func NewContainerMemoryRequest( m metric.Meter, @@ -653,12 +698,15 @@ func NewContainerMemoryRequest( return ContainerMemoryRequest{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerMemoryRequestOpts + } else { + opt = append(opt, newContainerMemoryRequestOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.memory.request", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Memory resource requested for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerMemoryRequest{noop.Int64UpDownCounter{}}, err @@ -736,6 +784,11 @@ type ContainerReady struct { metric.Int64UpDownCounter } +var newContainerReadyOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)."), + metric.WithUnit("{container}"), +} + // NewContainerReady returns a new ContainerReady instrument. func NewContainerReady( m metric.Meter, @@ -746,12 +799,15 @@ func NewContainerReady( return ContainerReady{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerReadyOpts + } else { + opt = append(opt, newContainerReadyOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.ready", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)."), - metric.WithUnit("{container}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerReady{noop.Int64UpDownCounter{}}, err @@ -831,6 +887,11 @@ type ContainerRestartCount struct { metric.Int64UpDownCounter } +var newContainerRestartCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Describes how many times the container has restarted (since the last counter reset)."), + metric.WithUnit("{restart}"), +} + // NewContainerRestartCount returns a new ContainerRestartCount instrument. func NewContainerRestartCount( m metric.Meter, @@ -841,12 +902,15 @@ func NewContainerRestartCount( return ContainerRestartCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerRestartCountOpts + } else { + opt = append(opt, newContainerRestartCountOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.restart.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Describes how many times the container has restarted (since the last counter reset)."), - metric.WithUnit("{restart}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerRestartCount{noop.Int64UpDownCounter{}}, err @@ -936,6 +1000,11 @@ type ContainerStatusReason struct { metric.Int64UpDownCounter } +var newContainerStatusReasonOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Describes the number of K8s containers that are currently in a state for a given reason."), + metric.WithUnit("{container}"), +} + // NewContainerStatusReason returns a new ContainerStatusReason instrument. func NewContainerStatusReason( m metric.Meter, @@ -946,12 +1015,15 @@ func NewContainerStatusReason( return ContainerStatusReason{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerStatusReasonOpts + } else { + opt = append(opt, newContainerStatusReasonOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.status.reason", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Describes the number of K8s containers that are currently in a state for a given reason."), - metric.WithUnit("{container}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerStatusReason{noop.Int64UpDownCounter{}}, err @@ -1049,6 +1121,11 @@ type ContainerStatusState struct { metric.Int64UpDownCounter } +var newContainerStatusStateOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Describes the number of K8s containers that are currently in a given state."), + metric.WithUnit("{container}"), +} + // NewContainerStatusState returns a new ContainerStatusState instrument. func NewContainerStatusState( m metric.Meter, @@ -1059,12 +1136,15 @@ func NewContainerStatusState( return ContainerStatusState{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerStatusStateOpts + } else { + opt = append(opt, newContainerStatusStateOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.status.state", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Describes the number of K8s containers that are currently in a given state."), - metric.WithUnit("{container}"), - }, opt...)..., + opt..., ) if err != nil { return ContainerStatusState{noop.Int64UpDownCounter{}}, err @@ -1160,6 +1240,11 @@ type ContainerStorageLimit struct { metric.Int64UpDownCounter } +var newContainerStorageLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Maximum storage resource limit set for the container."), + metric.WithUnit("By"), +} + // NewContainerStorageLimit returns a new ContainerStorageLimit instrument. func NewContainerStorageLimit( m metric.Meter, @@ -1170,12 +1255,15 @@ func NewContainerStorageLimit( return ContainerStorageLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerStorageLimitOpts + } else { + opt = append(opt, newContainerStorageLimitOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.storage.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Maximum storage resource limit set for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerStorageLimit{noop.Int64UpDownCounter{}}, err @@ -1252,6 +1340,11 @@ type ContainerStorageRequest struct { metric.Int64UpDownCounter } +var newContainerStorageRequestOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Storage resource requested for the container."), + metric.WithUnit("By"), +} + // NewContainerStorageRequest returns a new ContainerStorageRequest instrument. func NewContainerStorageRequest( m metric.Meter, @@ -1262,12 +1355,15 @@ func NewContainerStorageRequest( return ContainerStorageRequest{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newContainerStorageRequestOpts + } else { + opt = append(opt, newContainerStorageRequestOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.container.storage.request", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Storage resource requested for the container."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ContainerStorageRequest{noop.Int64UpDownCounter{}}, err @@ -1344,6 +1440,11 @@ type CronJobActiveJobs struct { metric.Int64UpDownCounter } +var newCronJobActiveJobsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of actively running jobs for a cronjob."), + metric.WithUnit("{job}"), +} + // NewCronJobActiveJobs returns a new CronJobActiveJobs instrument. func NewCronJobActiveJobs( m metric.Meter, @@ -1354,12 +1455,15 @@ func NewCronJobActiveJobs( return CronJobActiveJobs{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newCronJobActiveJobsOpts + } else { + opt = append(opt, newCronJobActiveJobsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.cronjob.active_jobs", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of actively running jobs for a cronjob."), - metric.WithUnit("{job}"), - }, opt...)..., + opt..., ) if err != nil { return CronJobActiveJobs{noop.Int64UpDownCounter{}}, err @@ -1439,6 +1543,11 @@ type DaemonSetCurrentScheduledNodes struct { metric.Int64UpDownCounter } +var newDaemonSetCurrentScheduledNodesOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod."), + metric.WithUnit("{node}"), +} + // NewDaemonSetCurrentScheduledNodes returns a new DaemonSetCurrentScheduledNodes // instrument. func NewDaemonSetCurrentScheduledNodes( @@ -1450,12 +1559,15 @@ func NewDaemonSetCurrentScheduledNodes( return DaemonSetCurrentScheduledNodes{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDaemonSetCurrentScheduledNodesOpts + } else { + opt = append(opt, newDaemonSetCurrentScheduledNodesOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.daemonset.current_scheduled_nodes", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod."), - metric.WithUnit("{node}"), - }, opt...)..., + opt..., ) if err != nil { return DaemonSetCurrentScheduledNodes{noop.Int64UpDownCounter{}}, err @@ -1535,6 +1647,11 @@ type DaemonSetDesiredScheduledNodes struct { metric.Int64UpDownCounter } +var newDaemonSetDesiredScheduledNodesOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)."), + metric.WithUnit("{node}"), +} + // NewDaemonSetDesiredScheduledNodes returns a new DaemonSetDesiredScheduledNodes // instrument. func NewDaemonSetDesiredScheduledNodes( @@ -1546,12 +1663,15 @@ func NewDaemonSetDesiredScheduledNodes( return DaemonSetDesiredScheduledNodes{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDaemonSetDesiredScheduledNodesOpts + } else { + opt = append(opt, newDaemonSetDesiredScheduledNodesOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.daemonset.desired_scheduled_nodes", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)."), - metric.WithUnit("{node}"), - }, opt...)..., + opt..., ) if err != nil { return DaemonSetDesiredScheduledNodes{noop.Int64UpDownCounter{}}, err @@ -1631,6 +1751,11 @@ type DaemonSetMisscheduledNodes struct { metric.Int64UpDownCounter } +var newDaemonSetMisscheduledNodesOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."), + metric.WithUnit("{node}"), +} + // NewDaemonSetMisscheduledNodes returns a new DaemonSetMisscheduledNodes // instrument. func NewDaemonSetMisscheduledNodes( @@ -1642,12 +1767,15 @@ func NewDaemonSetMisscheduledNodes( return DaemonSetMisscheduledNodes{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDaemonSetMisscheduledNodesOpts + } else { + opt = append(opt, newDaemonSetMisscheduledNodesOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.daemonset.misscheduled_nodes", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."), - metric.WithUnit("{node}"), - }, opt...)..., + opt..., ) if err != nil { return DaemonSetMisscheduledNodes{noop.Int64UpDownCounter{}}, err @@ -1727,6 +1855,11 @@ type DaemonSetReadyNodes struct { metric.Int64UpDownCounter } +var newDaemonSetReadyNodesOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready."), + metric.WithUnit("{node}"), +} + // NewDaemonSetReadyNodes returns a new DaemonSetReadyNodes instrument. func NewDaemonSetReadyNodes( m metric.Meter, @@ -1737,12 +1870,15 @@ func NewDaemonSetReadyNodes( return DaemonSetReadyNodes{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDaemonSetReadyNodesOpts + } else { + opt = append(opt, newDaemonSetReadyNodesOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.daemonset.ready_nodes", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready."), - metric.WithUnit("{node}"), - }, opt...)..., + opt..., ) if err != nil { return DaemonSetReadyNodes{noop.Int64UpDownCounter{}}, err @@ -1822,6 +1958,11 @@ type DeploymentAvailablePods struct { metric.Int64UpDownCounter } +var newDeploymentAvailablePodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment."), + metric.WithUnit("{pod}"), +} + // NewDeploymentAvailablePods returns a new DeploymentAvailablePods instrument. func NewDeploymentAvailablePods( m metric.Meter, @@ -1832,12 +1973,15 @@ func NewDeploymentAvailablePods( return DeploymentAvailablePods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDeploymentAvailablePodsOpts + } else { + opt = append(opt, newDeploymentAvailablePodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.deployment.available_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return DeploymentAvailablePods{noop.Int64UpDownCounter{}}, err @@ -1916,6 +2060,11 @@ type DeploymentDesiredPods struct { metric.Int64UpDownCounter } +var newDeploymentDesiredPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of desired replica pods in this deployment."), + metric.WithUnit("{pod}"), +} + // NewDeploymentDesiredPods returns a new DeploymentDesiredPods instrument. func NewDeploymentDesiredPods( m metric.Meter, @@ -1926,12 +2075,15 @@ func NewDeploymentDesiredPods( return DeploymentDesiredPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDeploymentDesiredPodsOpts + } else { + opt = append(opt, newDeploymentDesiredPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.deployment.desired_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of desired replica pods in this deployment."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return DeploymentDesiredPods{noop.Int64UpDownCounter{}}, err @@ -2011,6 +2163,11 @@ type HPACurrentPods struct { metric.Int64UpDownCounter } +var newHPACurrentPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler."), + metric.WithUnit("{pod}"), +} + // NewHPACurrentPods returns a new HPACurrentPods instrument. func NewHPACurrentPods( m metric.Meter, @@ -2021,12 +2178,15 @@ func NewHPACurrentPods( return HPACurrentPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newHPACurrentPodsOpts + } else { + opt = append(opt, newHPACurrentPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.hpa.current_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return HPACurrentPods{noop.Int64UpDownCounter{}}, err @@ -2106,6 +2266,11 @@ type HPADesiredPods struct { metric.Int64UpDownCounter } +var newHPADesiredPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler."), + metric.WithUnit("{pod}"), +} + // NewHPADesiredPods returns a new HPADesiredPods instrument. func NewHPADesiredPods( m metric.Meter, @@ -2116,12 +2281,15 @@ func NewHPADesiredPods( return HPADesiredPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newHPADesiredPodsOpts + } else { + opt = append(opt, newHPADesiredPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.hpa.desired_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return HPADesiredPods{noop.Int64UpDownCounter{}}, err @@ -2200,6 +2368,11 @@ type HPAMaxPods struct { metric.Int64UpDownCounter } +var newHPAMaxPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The upper limit for the number of replica pods to which the autoscaler can scale up."), + metric.WithUnit("{pod}"), +} + // NewHPAMaxPods returns a new HPAMaxPods instrument. func NewHPAMaxPods( m metric.Meter, @@ -2210,12 +2383,15 @@ func NewHPAMaxPods( return HPAMaxPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newHPAMaxPodsOpts + } else { + opt = append(opt, newHPAMaxPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.hpa.max_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The upper limit for the number of replica pods to which the autoscaler can scale up."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return HPAMaxPods{noop.Int64UpDownCounter{}}, err @@ -2295,6 +2471,11 @@ type HPAMetricTargetCPUAverageUtilization struct { metric.Int64Gauge } +var newHPAMetricTargetCPUAverageUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Target average utilization, in percentage, for CPU resource in HPA config."), + metric.WithUnit("1"), +} + // NewHPAMetricTargetCPUAverageUtilization returns a new // HPAMetricTargetCPUAverageUtilization instrument. func NewHPAMetricTargetCPUAverageUtilization( @@ -2306,12 +2487,15 @@ func NewHPAMetricTargetCPUAverageUtilization( return HPAMetricTargetCPUAverageUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHPAMetricTargetCPUAverageUtilizationOpts + } else { + opt = append(opt, newHPAMetricTargetCPUAverageUtilizationOpts...) + } + i, err := m.Int64Gauge( "k8s.hpa.metric.target.cpu.average_utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Target average utilization, in percentage, for CPU resource in HPA config."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return HPAMetricTargetCPUAverageUtilization{noop.Int64Gauge{}}, err @@ -2425,6 +2609,11 @@ type HPAMetricTargetCPUAverageValue struct { metric.Int64Gauge } +var newHPAMetricTargetCPUAverageValueOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Target average value for CPU resource in HPA config."), + metric.WithUnit("{cpu}"), +} + // NewHPAMetricTargetCPUAverageValue returns a new HPAMetricTargetCPUAverageValue // instrument. func NewHPAMetricTargetCPUAverageValue( @@ -2436,12 +2625,15 @@ func NewHPAMetricTargetCPUAverageValue( return HPAMetricTargetCPUAverageValue{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHPAMetricTargetCPUAverageValueOpts + } else { + opt = append(opt, newHPAMetricTargetCPUAverageValueOpts...) + } + i, err := m.Int64Gauge( "k8s.hpa.metric.target.cpu.average_value", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Target average value for CPU resource in HPA config."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return HPAMetricTargetCPUAverageValue{noop.Int64Gauge{}}, err @@ -2554,6 +2746,11 @@ type HPAMetricTargetCPUValue struct { metric.Int64Gauge } +var newHPAMetricTargetCPUValueOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Target value for CPU resource in HPA config."), + metric.WithUnit("{cpu}"), +} + // NewHPAMetricTargetCPUValue returns a new HPAMetricTargetCPUValue instrument. func NewHPAMetricTargetCPUValue( m metric.Meter, @@ -2564,12 +2761,15 @@ func NewHPAMetricTargetCPUValue( return HPAMetricTargetCPUValue{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newHPAMetricTargetCPUValueOpts + } else { + opt = append(opt, newHPAMetricTargetCPUValueOpts...) + } + i, err := m.Int64Gauge( "k8s.hpa.metric.target.cpu.value", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Target value for CPU resource in HPA config."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return HPAMetricTargetCPUValue{noop.Int64Gauge{}}, err @@ -2682,6 +2882,11 @@ type HPAMinPods struct { metric.Int64UpDownCounter } +var newHPAMinPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The lower limit for the number of replica pods to which the autoscaler can scale down."), + metric.WithUnit("{pod}"), +} + // NewHPAMinPods returns a new HPAMinPods instrument. func NewHPAMinPods( m metric.Meter, @@ -2692,12 +2897,15 @@ func NewHPAMinPods( return HPAMinPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newHPAMinPodsOpts + } else { + opt = append(opt, newHPAMinPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.hpa.min_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The lower limit for the number of replica pods to which the autoscaler can scale down."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return HPAMinPods{noop.Int64UpDownCounter{}}, err @@ -2776,6 +2984,11 @@ type JobActivePods struct { metric.Int64UpDownCounter } +var newJobActivePodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of pending and actively running pods for a job."), + metric.WithUnit("{pod}"), +} + // NewJobActivePods returns a new JobActivePods instrument. func NewJobActivePods( m metric.Meter, @@ -2786,12 +2999,15 @@ func NewJobActivePods( return JobActivePods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newJobActivePodsOpts + } else { + opt = append(opt, newJobActivePodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.job.active_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of pending and actively running pods for a job."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return JobActivePods{noop.Int64UpDownCounter{}}, err @@ -2871,6 +3087,11 @@ type JobDesiredSuccessfulPods struct { metric.Int64UpDownCounter } +var newJobDesiredSuccessfulPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The desired number of successfully finished pods the job should be run with."), + metric.WithUnit("{pod}"), +} + // NewJobDesiredSuccessfulPods returns a new JobDesiredSuccessfulPods instrument. func NewJobDesiredSuccessfulPods( m metric.Meter, @@ -2881,12 +3102,15 @@ func NewJobDesiredSuccessfulPods( return JobDesiredSuccessfulPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newJobDesiredSuccessfulPodsOpts + } else { + opt = append(opt, newJobDesiredSuccessfulPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.job.desired_successful_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The desired number of successfully finished pods the job should be run with."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return JobDesiredSuccessfulPods{noop.Int64UpDownCounter{}}, err @@ -2965,6 +3189,11 @@ type JobFailedPods struct { metric.Int64UpDownCounter } +var newJobFailedPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of pods which reached phase Failed for a job."), + metric.WithUnit("{pod}"), +} + // NewJobFailedPods returns a new JobFailedPods instrument. func NewJobFailedPods( m metric.Meter, @@ -2975,12 +3204,15 @@ func NewJobFailedPods( return JobFailedPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newJobFailedPodsOpts + } else { + opt = append(opt, newJobFailedPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.job.failed_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of pods which reached phase Failed for a job."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return JobFailedPods{noop.Int64UpDownCounter{}}, err @@ -3059,6 +3291,11 @@ type JobMaxParallelPods struct { metric.Int64UpDownCounter } +var newJobMaxParallelPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The max desired number of pods the job should run at any given time."), + metric.WithUnit("{pod}"), +} + // NewJobMaxParallelPods returns a new JobMaxParallelPods instrument. func NewJobMaxParallelPods( m metric.Meter, @@ -3069,12 +3306,15 @@ func NewJobMaxParallelPods( return JobMaxParallelPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newJobMaxParallelPodsOpts + } else { + opt = append(opt, newJobMaxParallelPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.job.max_parallel_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The max desired number of pods the job should run at any given time."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return JobMaxParallelPods{noop.Int64UpDownCounter{}}, err @@ -3153,6 +3393,11 @@ type JobSuccessfulPods struct { metric.Int64UpDownCounter } +var newJobSuccessfulPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of pods which reached phase Succeeded for a job."), + metric.WithUnit("{pod}"), +} + // NewJobSuccessfulPods returns a new JobSuccessfulPods instrument. func NewJobSuccessfulPods( m metric.Meter, @@ -3163,12 +3408,15 @@ func NewJobSuccessfulPods( return JobSuccessfulPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newJobSuccessfulPodsOpts + } else { + opt = append(opt, newJobSuccessfulPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.job.successful_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of pods which reached phase Succeeded for a job."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return JobSuccessfulPods{noop.Int64UpDownCounter{}}, err @@ -3247,6 +3495,11 @@ type NamespacePhase struct { metric.Int64UpDownCounter } +var newNamespacePhaseOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Describes number of K8s namespaces that are currently in a given phase."), + metric.WithUnit("{namespace}"), +} + // NewNamespacePhase returns a new NamespacePhase instrument. func NewNamespacePhase( m metric.Meter, @@ -3257,12 +3510,15 @@ func NewNamespacePhase( return NamespacePhase{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNamespacePhaseOpts + } else { + opt = append(opt, newNamespacePhaseOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.namespace.phase", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Describes number of K8s namespaces that are currently in a given phase."), - metric.WithUnit("{namespace}"), - }, opt...)..., + opt..., ) if err != nil { return NamespacePhase{noop.Int64UpDownCounter{}}, err @@ -3347,6 +3603,11 @@ type NodeAllocatableCPU struct { metric.Int64UpDownCounter } +var newNodeAllocatableCPUOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Amount of cpu allocatable on the node."), + metric.WithUnit("{cpu}"), +} + // NewNodeAllocatableCPU returns a new NodeAllocatableCPU instrument. func NewNodeAllocatableCPU( m metric.Meter, @@ -3357,12 +3618,15 @@ func NewNodeAllocatableCPU( return NodeAllocatableCPU{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeAllocatableCPUOpts + } else { + opt = append(opt, newNodeAllocatableCPUOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.allocatable.cpu", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Amount of cpu allocatable on the node."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return NodeAllocatableCPU{noop.Int64UpDownCounter{}}, err @@ -3432,6 +3696,11 @@ type NodeAllocatableEphemeralStorage struct { metric.Int64UpDownCounter } +var newNodeAllocatableEphemeralStorageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Amount of ephemeral-storage allocatable on the node."), + metric.WithUnit("By"), +} + // NewNodeAllocatableEphemeralStorage returns a new // NodeAllocatableEphemeralStorage instrument. func NewNodeAllocatableEphemeralStorage( @@ -3443,12 +3712,15 @@ func NewNodeAllocatableEphemeralStorage( return NodeAllocatableEphemeralStorage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeAllocatableEphemeralStorageOpts + } else { + opt = append(opt, newNodeAllocatableEphemeralStorageOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.allocatable.ephemeral_storage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Amount of ephemeral-storage allocatable on the node."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeAllocatableEphemeralStorage{noop.Int64UpDownCounter{}}, err @@ -3517,6 +3789,11 @@ type NodeAllocatableMemory struct { metric.Int64UpDownCounter } +var newNodeAllocatableMemoryOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Amount of memory allocatable on the node."), + metric.WithUnit("By"), +} + // NewNodeAllocatableMemory returns a new NodeAllocatableMemory instrument. func NewNodeAllocatableMemory( m metric.Meter, @@ -3527,12 +3804,15 @@ func NewNodeAllocatableMemory( return NodeAllocatableMemory{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeAllocatableMemoryOpts + } else { + opt = append(opt, newNodeAllocatableMemoryOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.allocatable.memory", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Amount of memory allocatable on the node."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeAllocatableMemory{noop.Int64UpDownCounter{}}, err @@ -3601,6 +3881,11 @@ type NodeAllocatablePods struct { metric.Int64UpDownCounter } +var newNodeAllocatablePodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Amount of pods allocatable on the node."), + metric.WithUnit("{pod}"), +} + // NewNodeAllocatablePods returns a new NodeAllocatablePods instrument. func NewNodeAllocatablePods( m metric.Meter, @@ -3611,12 +3896,15 @@ func NewNodeAllocatablePods( return NodeAllocatablePods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeAllocatablePodsOpts + } else { + opt = append(opt, newNodeAllocatablePodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.allocatable.pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Amount of pods allocatable on the node."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return NodeAllocatablePods{noop.Int64UpDownCounter{}}, err @@ -3685,6 +3973,11 @@ type NodeConditionStatus struct { metric.Int64UpDownCounter } +var newNodeConditionStatusOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Describes the condition of a particular Node."), + metric.WithUnit("{node}"), +} + // NewNodeConditionStatus returns a new NodeConditionStatus instrument. func NewNodeConditionStatus( m metric.Meter, @@ -3695,12 +3988,15 @@ func NewNodeConditionStatus( return NodeConditionStatus{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeConditionStatusOpts + } else { + opt = append(opt, newNodeConditionStatusOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.condition.status", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Describes the condition of a particular Node."), - metric.WithUnit("{node}"), - }, opt...)..., + opt..., ) if err != nil { return NodeConditionStatus{noop.Int64UpDownCounter{}}, err @@ -3798,6 +4094,11 @@ type NodeCPUTime struct { metric.Float64Counter } +var newNodeCPUTimeOpts = []metric.Float64CounterOption{ + metric.WithDescription("Total CPU time consumed."), + metric.WithUnit("s"), +} + // NewNodeCPUTime returns a new NodeCPUTime instrument. func NewNodeCPUTime( m metric.Meter, @@ -3808,12 +4109,15 @@ func NewNodeCPUTime( return NodeCPUTime{noop.Float64Counter{}}, nil } + if len(opt) == 0 { + opt = newNodeCPUTimeOpts + } else { + opt = append(opt, newNodeCPUTimeOpts...) + } + i, err := m.Float64Counter( "k8s.node.cpu.time", - append([]metric.Float64CounterOption{ - metric.WithDescription("Total CPU time consumed."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return NodeCPUTime{noop.Float64Counter{}}, err @@ -3886,6 +4190,11 @@ type NodeCPUUsage struct { metric.Int64Gauge } +var newNodeCPUUsageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), + metric.WithUnit("{cpu}"), +} + // NewNodeCPUUsage returns a new NodeCPUUsage instrument. func NewNodeCPUUsage( m metric.Meter, @@ -3896,12 +4205,15 @@ func NewNodeCPUUsage( return NodeCPUUsage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newNodeCPUUsageOpts + } else { + opt = append(opt, newNodeCPUUsageOpts...) + } + i, err := m.Int64Gauge( "k8s.node.cpu.usage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return NodeCPUUsage{noop.Int64Gauge{}}, err @@ -3975,6 +4287,11 @@ type NodeFilesystemAvailable struct { metric.Int64UpDownCounter } +var newNodeFilesystemAvailableOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Node filesystem available bytes."), + metric.WithUnit("By"), +} + // NewNodeFilesystemAvailable returns a new NodeFilesystemAvailable instrument. func NewNodeFilesystemAvailable( m metric.Meter, @@ -3985,12 +4302,15 @@ func NewNodeFilesystemAvailable( return NodeFilesystemAvailable{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeFilesystemAvailableOpts + } else { + opt = append(opt, newNodeFilesystemAvailableOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.filesystem.available", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Node filesystem available bytes."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeFilesystemAvailable{noop.Int64UpDownCounter{}}, err @@ -4075,6 +4395,11 @@ type NodeFilesystemCapacity struct { metric.Int64UpDownCounter } +var newNodeFilesystemCapacityOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Node filesystem capacity."), + metric.WithUnit("By"), +} + // NewNodeFilesystemCapacity returns a new NodeFilesystemCapacity instrument. func NewNodeFilesystemCapacity( m metric.Meter, @@ -4085,12 +4410,15 @@ func NewNodeFilesystemCapacity( return NodeFilesystemCapacity{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeFilesystemCapacityOpts + } else { + opt = append(opt, newNodeFilesystemCapacityOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.filesystem.capacity", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Node filesystem capacity."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeFilesystemCapacity{noop.Int64UpDownCounter{}}, err @@ -4175,6 +4503,11 @@ type NodeFilesystemUsage struct { metric.Int64UpDownCounter } +var newNodeFilesystemUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Node filesystem usage."), + metric.WithUnit("By"), +} + // NewNodeFilesystemUsage returns a new NodeFilesystemUsage instrument. func NewNodeFilesystemUsage( m metric.Meter, @@ -4185,12 +4518,15 @@ func NewNodeFilesystemUsage( return NodeFilesystemUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNodeFilesystemUsageOpts + } else { + opt = append(opt, newNodeFilesystemUsageOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.node.filesystem.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Node filesystem usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeFilesystemUsage{noop.Int64UpDownCounter{}}, err @@ -4279,6 +4615,11 @@ type NodeMemoryUsage struct { metric.Int64Gauge } +var newNodeMemoryUsageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Memory usage of the Node."), + metric.WithUnit("By"), +} + // NewNodeMemoryUsage returns a new NodeMemoryUsage instrument. func NewNodeMemoryUsage( m metric.Meter, @@ -4289,12 +4630,15 @@ func NewNodeMemoryUsage( return NodeMemoryUsage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newNodeMemoryUsageOpts + } else { + opt = append(opt, newNodeMemoryUsageOpts...) + } + i, err := m.Int64Gauge( "k8s.node.memory.usage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Memory usage of the Node."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeMemoryUsage{noop.Int64Gauge{}}, err @@ -4366,6 +4710,11 @@ type NodeNetworkErrors struct { metric.Int64Counter } +var newNodeNetworkErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Node network errors."), + metric.WithUnit("{error}"), +} + // NewNodeNetworkErrors returns a new NodeNetworkErrors instrument. func NewNodeNetworkErrors( m metric.Meter, @@ -4376,12 +4725,15 @@ func NewNodeNetworkErrors( return NodeNetworkErrors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNodeNetworkErrorsOpts + } else { + opt = append(opt, newNodeNetworkErrorsOpts...) + } + i, err := m.Int64Counter( "k8s.node.network.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("Node network errors."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return NodeNetworkErrors{noop.Int64Counter{}}, err @@ -4476,6 +4828,11 @@ type NodeNetworkIO struct { metric.Int64Counter } +var newNodeNetworkIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Network bytes for the Node."), + metric.WithUnit("By"), +} + // NewNodeNetworkIO returns a new NodeNetworkIO instrument. func NewNodeNetworkIO( m metric.Meter, @@ -4486,12 +4843,15 @@ func NewNodeNetworkIO( return NodeNetworkIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNodeNetworkIOOpts + } else { + opt = append(opt, newNodeNetworkIOOpts...) + } + i, err := m.Int64Counter( "k8s.node.network.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Network bytes for the Node."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NodeNetworkIO{noop.Int64Counter{}}, err @@ -4586,6 +4946,11 @@ type NodeUptime struct { metric.Float64Gauge } +var newNodeUptimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time the Node has been running."), + metric.WithUnit("s"), +} + // NewNodeUptime returns a new NodeUptime instrument. func NewNodeUptime( m metric.Meter, @@ -4596,12 +4961,15 @@ func NewNodeUptime( return NodeUptime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newNodeUptimeOpts + } else { + opt = append(opt, newNodeUptimeOpts...) + } + i, err := m.Float64Gauge( "k8s.node.uptime", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time the Node has been running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return NodeUptime{noop.Float64Gauge{}}, err @@ -4677,6 +5045,11 @@ type PodCPUTime struct { metric.Float64Counter } +var newPodCPUTimeOpts = []metric.Float64CounterOption{ + metric.WithDescription("Total CPU time consumed."), + metric.WithUnit("s"), +} + // NewPodCPUTime returns a new PodCPUTime instrument. func NewPodCPUTime( m metric.Meter, @@ -4687,12 +5060,15 @@ func NewPodCPUTime( return PodCPUTime{noop.Float64Counter{}}, nil } + if len(opt) == 0 { + opt = newPodCPUTimeOpts + } else { + opt = append(opt, newPodCPUTimeOpts...) + } + i, err := m.Float64Counter( "k8s.pod.cpu.time", - append([]metric.Float64CounterOption{ - metric.WithDescription("Total CPU time consumed."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return PodCPUTime{noop.Float64Counter{}}, err @@ -4765,6 +5141,11 @@ type PodCPUUsage struct { metric.Int64Gauge } +var newPodCPUUsageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), + metric.WithUnit("{cpu}"), +} + // NewPodCPUUsage returns a new PodCPUUsage instrument. func NewPodCPUUsage( m metric.Meter, @@ -4775,12 +5156,15 @@ func NewPodCPUUsage( return PodCPUUsage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPodCPUUsageOpts + } else { + opt = append(opt, newPodCPUUsageOpts...) + } + i, err := m.Int64Gauge( "k8s.pod.cpu.usage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return PodCPUUsage{noop.Int64Gauge{}}, err @@ -4854,6 +5238,11 @@ type PodFilesystemAvailable struct { metric.Int64UpDownCounter } +var newPodFilesystemAvailableOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod filesystem available bytes."), + metric.WithUnit("By"), +} + // NewPodFilesystemAvailable returns a new PodFilesystemAvailable instrument. func NewPodFilesystemAvailable( m metric.Meter, @@ -4864,12 +5253,15 @@ func NewPodFilesystemAvailable( return PodFilesystemAvailable{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodFilesystemAvailableOpts + } else { + opt = append(opt, newPodFilesystemAvailableOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.filesystem.available", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod filesystem available bytes."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodFilesystemAvailable{noop.Int64UpDownCounter{}}, err @@ -4954,6 +5346,11 @@ type PodFilesystemCapacity struct { metric.Int64UpDownCounter } +var newPodFilesystemCapacityOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod filesystem capacity."), + metric.WithUnit("By"), +} + // NewPodFilesystemCapacity returns a new PodFilesystemCapacity instrument. func NewPodFilesystemCapacity( m metric.Meter, @@ -4964,12 +5361,15 @@ func NewPodFilesystemCapacity( return PodFilesystemCapacity{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodFilesystemCapacityOpts + } else { + opt = append(opt, newPodFilesystemCapacityOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.filesystem.capacity", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod filesystem capacity."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodFilesystemCapacity{noop.Int64UpDownCounter{}}, err @@ -5054,6 +5454,11 @@ type PodFilesystemUsage struct { metric.Int64UpDownCounter } +var newPodFilesystemUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod filesystem usage."), + metric.WithUnit("By"), +} + // NewPodFilesystemUsage returns a new PodFilesystemUsage instrument. func NewPodFilesystemUsage( m metric.Meter, @@ -5064,12 +5469,15 @@ func NewPodFilesystemUsage( return PodFilesystemUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodFilesystemUsageOpts + } else { + opt = append(opt, newPodFilesystemUsageOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.filesystem.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod filesystem usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodFilesystemUsage{noop.Int64UpDownCounter{}}, err @@ -5158,6 +5566,11 @@ type PodMemoryUsage struct { metric.Int64Gauge } +var newPodMemoryUsageOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Memory usage of the Pod."), + metric.WithUnit("By"), +} + // NewPodMemoryUsage returns a new PodMemoryUsage instrument. func NewPodMemoryUsage( m metric.Meter, @@ -5168,12 +5581,15 @@ func NewPodMemoryUsage( return PodMemoryUsage{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPodMemoryUsageOpts + } else { + opt = append(opt, newPodMemoryUsageOpts...) + } + i, err := m.Int64Gauge( "k8s.pod.memory.usage", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Memory usage of the Pod."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodMemoryUsage{noop.Int64Gauge{}}, err @@ -5245,6 +5661,11 @@ type PodNetworkErrors struct { metric.Int64Counter } +var newPodNetworkErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Pod network errors."), + metric.WithUnit("{error}"), +} + // NewPodNetworkErrors returns a new PodNetworkErrors instrument. func NewPodNetworkErrors( m metric.Meter, @@ -5255,12 +5676,15 @@ func NewPodNetworkErrors( return PodNetworkErrors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPodNetworkErrorsOpts + } else { + opt = append(opt, newPodNetworkErrorsOpts...) + } + i, err := m.Int64Counter( "k8s.pod.network.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("Pod network errors."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return PodNetworkErrors{noop.Int64Counter{}}, err @@ -5355,6 +5779,11 @@ type PodNetworkIO struct { metric.Int64Counter } +var newPodNetworkIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Network bytes for the Pod."), + metric.WithUnit("By"), +} + // NewPodNetworkIO returns a new PodNetworkIO instrument. func NewPodNetworkIO( m metric.Meter, @@ -5365,12 +5794,15 @@ func NewPodNetworkIO( return PodNetworkIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPodNetworkIOOpts + } else { + opt = append(opt, newPodNetworkIOOpts...) + } + i, err := m.Int64Counter( "k8s.pod.network.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Network bytes for the Pod."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodNetworkIO{noop.Int64Counter{}}, err @@ -5465,6 +5897,11 @@ type PodUptime struct { metric.Float64Gauge } +var newPodUptimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time the Pod has been running."), + metric.WithUnit("s"), +} + // NewPodUptime returns a new PodUptime instrument. func NewPodUptime( m metric.Meter, @@ -5475,12 +5912,15 @@ func NewPodUptime( return PodUptime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPodUptimeOpts + } else { + opt = append(opt, newPodUptimeOpts...) + } + i, err := m.Float64Gauge( "k8s.pod.uptime", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time the Pod has been running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return PodUptime{noop.Float64Gauge{}}, err @@ -5556,6 +5996,11 @@ type PodVolumeAvailable struct { metric.Int64UpDownCounter } +var newPodVolumeAvailableOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod volume storage space available."), + metric.WithUnit("By"), +} + // NewPodVolumeAvailable returns a new PodVolumeAvailable instrument. func NewPodVolumeAvailable( m metric.Meter, @@ -5566,12 +6011,15 @@ func NewPodVolumeAvailable( return PodVolumeAvailable{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeAvailableOpts + } else { + opt = append(opt, newPodVolumeAvailableOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.available", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod volume storage space available."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeAvailable{noop.Int64UpDownCounter{}}, err @@ -5680,6 +6128,11 @@ type PodVolumeCapacity struct { metric.Int64UpDownCounter } +var newPodVolumeCapacityOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod volume total capacity."), + metric.WithUnit("By"), +} + // NewPodVolumeCapacity returns a new PodVolumeCapacity instrument. func NewPodVolumeCapacity( m metric.Meter, @@ -5690,12 +6143,15 @@ func NewPodVolumeCapacity( return PodVolumeCapacity{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeCapacityOpts + } else { + opt = append(opt, newPodVolumeCapacityOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.capacity", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod volume total capacity."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeCapacity{noop.Int64UpDownCounter{}}, err @@ -5804,6 +6260,11 @@ type PodVolumeInodeCount struct { metric.Int64UpDownCounter } +var newPodVolumeInodeCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The total inodes in the filesystem of the Pod's volume."), + metric.WithUnit("{inode}"), +} + // NewPodVolumeInodeCount returns a new PodVolumeInodeCount instrument. func NewPodVolumeInodeCount( m metric.Meter, @@ -5814,12 +6275,15 @@ func NewPodVolumeInodeCount( return PodVolumeInodeCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeInodeCountOpts + } else { + opt = append(opt, newPodVolumeInodeCountOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.inode.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The total inodes in the filesystem of the Pod's volume."), - metric.WithUnit("{inode}"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeInodeCount{noop.Int64UpDownCounter{}}, err @@ -5928,6 +6392,11 @@ type PodVolumeInodeFree struct { metric.Int64UpDownCounter } +var newPodVolumeInodeFreeOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The free inodes in the filesystem of the Pod's volume."), + metric.WithUnit("{inode}"), +} + // NewPodVolumeInodeFree returns a new PodVolumeInodeFree instrument. func NewPodVolumeInodeFree( m metric.Meter, @@ -5938,12 +6407,15 @@ func NewPodVolumeInodeFree( return PodVolumeInodeFree{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeInodeFreeOpts + } else { + opt = append(opt, newPodVolumeInodeFreeOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.inode.free", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The free inodes in the filesystem of the Pod's volume."), - metric.WithUnit("{inode}"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeInodeFree{noop.Int64UpDownCounter{}}, err @@ -6052,6 +6524,11 @@ type PodVolumeInodeUsed struct { metric.Int64UpDownCounter } +var newPodVolumeInodeUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The inodes used by the filesystem of the Pod's volume."), + metric.WithUnit("{inode}"), +} + // NewPodVolumeInodeUsed returns a new PodVolumeInodeUsed instrument. func NewPodVolumeInodeUsed( m metric.Meter, @@ -6062,12 +6539,15 @@ func NewPodVolumeInodeUsed( return PodVolumeInodeUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeInodeUsedOpts + } else { + opt = append(opt, newPodVolumeInodeUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.inode.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The inodes used by the filesystem of the Pod's volume."), - metric.WithUnit("{inode}"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeInodeUsed{noop.Int64UpDownCounter{}}, err @@ -6182,6 +6662,11 @@ type PodVolumeUsage struct { metric.Int64UpDownCounter } +var newPodVolumeUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Pod volume usage."), + metric.WithUnit("By"), +} + // NewPodVolumeUsage returns a new PodVolumeUsage instrument. func NewPodVolumeUsage( m metric.Meter, @@ -6192,12 +6677,15 @@ func NewPodVolumeUsage( return PodVolumeUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPodVolumeUsageOpts + } else { + opt = append(opt, newPodVolumeUsageOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.pod.volume.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Pod volume usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PodVolumeUsage{noop.Int64UpDownCounter{}}, err @@ -6311,6 +6799,11 @@ type ReplicaSetAvailablePods struct { metric.Int64UpDownCounter } +var newReplicaSetAvailablePodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset."), + metric.WithUnit("{pod}"), +} + // NewReplicaSetAvailablePods returns a new ReplicaSetAvailablePods instrument. func NewReplicaSetAvailablePods( m metric.Meter, @@ -6321,12 +6814,15 @@ func NewReplicaSetAvailablePods( return ReplicaSetAvailablePods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newReplicaSetAvailablePodsOpts + } else { + opt = append(opt, newReplicaSetAvailablePodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.replicaset.available_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return ReplicaSetAvailablePods{noop.Int64UpDownCounter{}}, err @@ -6405,6 +6901,11 @@ type ReplicaSetDesiredPods struct { metric.Int64UpDownCounter } +var newReplicaSetDesiredPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of desired replica pods in this replicaset."), + metric.WithUnit("{pod}"), +} + // NewReplicaSetDesiredPods returns a new ReplicaSetDesiredPods instrument. func NewReplicaSetDesiredPods( m metric.Meter, @@ -6415,12 +6916,15 @@ func NewReplicaSetDesiredPods( return ReplicaSetDesiredPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newReplicaSetDesiredPodsOpts + } else { + opt = append(opt, newReplicaSetDesiredPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.replicaset.desired_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of desired replica pods in this replicaset."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return ReplicaSetDesiredPods{noop.Int64UpDownCounter{}}, err @@ -6500,6 +7004,11 @@ type ReplicationControllerAvailablePods struct { metric.Int64UpDownCounter } +var newReplicationControllerAvailablePodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller."), + metric.WithUnit("{pod}"), +} + // NewReplicationControllerAvailablePods returns a new // ReplicationControllerAvailablePods instrument. func NewReplicationControllerAvailablePods( @@ -6511,12 +7020,15 @@ func NewReplicationControllerAvailablePods( return ReplicationControllerAvailablePods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newReplicationControllerAvailablePodsOpts + } else { + opt = append(opt, newReplicationControllerAvailablePodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.replicationcontroller.available_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return ReplicationControllerAvailablePods{noop.Int64UpDownCounter{}}, err @@ -6596,6 +7108,11 @@ type ReplicationControllerDesiredPods struct { metric.Int64UpDownCounter } +var newReplicationControllerDesiredPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of desired replica pods in this replication controller."), + metric.WithUnit("{pod}"), +} + // NewReplicationControllerDesiredPods returns a new // ReplicationControllerDesiredPods instrument. func NewReplicationControllerDesiredPods( @@ -6607,12 +7124,15 @@ func NewReplicationControllerDesiredPods( return ReplicationControllerDesiredPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newReplicationControllerDesiredPodsOpts + } else { + opt = append(opt, newReplicationControllerDesiredPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.replicationcontroller.desired_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of desired replica pods in this replication controller."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return ReplicationControllerDesiredPods{noop.Int64UpDownCounter{}}, err @@ -6693,6 +7213,11 @@ type ResourceQuotaCPULimitHard struct { metric.Int64UpDownCounter } +var newResourceQuotaCPULimitHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("{cpu}"), +} + // NewResourceQuotaCPULimitHard returns a new ResourceQuotaCPULimitHard // instrument. func NewResourceQuotaCPULimitHard( @@ -6704,12 +7229,15 @@ func NewResourceQuotaCPULimitHard( return ResourceQuotaCPULimitHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaCPULimitHardOpts + } else { + opt = append(opt, newResourceQuotaCPULimitHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.cpu.limit.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaCPULimitHard{noop.Int64UpDownCounter{}}, err @@ -6790,6 +7318,11 @@ type ResourceQuotaCPULimitUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaCPULimitUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The CPU limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("{cpu}"), +} + // NewResourceQuotaCPULimitUsed returns a new ResourceQuotaCPULimitUsed // instrument. func NewResourceQuotaCPULimitUsed( @@ -6801,12 +7334,15 @@ func NewResourceQuotaCPULimitUsed( return ResourceQuotaCPULimitUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaCPULimitUsedOpts + } else { + opt = append(opt, newResourceQuotaCPULimitUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.cpu.limit.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The CPU limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaCPULimitUsed{noop.Int64UpDownCounter{}}, err @@ -6887,6 +7423,11 @@ type ResourceQuotaCPURequestHard struct { metric.Int64UpDownCounter } +var newResourceQuotaCPURequestHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The CPU requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("{cpu}"), +} + // NewResourceQuotaCPURequestHard returns a new ResourceQuotaCPURequestHard // instrument. func NewResourceQuotaCPURequestHard( @@ -6898,12 +7439,15 @@ func NewResourceQuotaCPURequestHard( return ResourceQuotaCPURequestHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaCPURequestHardOpts + } else { + opt = append(opt, newResourceQuotaCPURequestHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.cpu.request.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The CPU requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaCPURequestHard{noop.Int64UpDownCounter{}}, err @@ -6984,6 +7528,11 @@ type ResourceQuotaCPURequestUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaCPURequestUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The CPU requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("{cpu}"), +} + // NewResourceQuotaCPURequestUsed returns a new ResourceQuotaCPURequestUsed // instrument. func NewResourceQuotaCPURequestUsed( @@ -6995,12 +7544,15 @@ func NewResourceQuotaCPURequestUsed( return ResourceQuotaCPURequestUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaCPURequestUsedOpts + } else { + opt = append(opt, newResourceQuotaCPURequestUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.cpu.request.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The CPU requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaCPURequestUsed{noop.Int64UpDownCounter{}}, err @@ -7082,6 +7634,11 @@ type ResourceQuotaEphemeralStorageLimitHard struct { metric.Int64UpDownCounter } +var newResourceQuotaEphemeralStorageLimitHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The sum of local ephemeral storage limits in the namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaEphemeralStorageLimitHard returns a new // ResourceQuotaEphemeralStorageLimitHard instrument. func NewResourceQuotaEphemeralStorageLimitHard( @@ -7093,12 +7650,15 @@ func NewResourceQuotaEphemeralStorageLimitHard( return ResourceQuotaEphemeralStorageLimitHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaEphemeralStorageLimitHardOpts + } else { + opt = append(opt, newResourceQuotaEphemeralStorageLimitHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.ephemeral_storage.limit.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The sum of local ephemeral storage limits in the namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaEphemeralStorageLimitHard{noop.Int64UpDownCounter{}}, err @@ -7180,6 +7740,11 @@ type ResourceQuotaEphemeralStorageLimitUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaEphemeralStorageLimitUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The sum of local ephemeral storage limits in the namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaEphemeralStorageLimitUsed returns a new // ResourceQuotaEphemeralStorageLimitUsed instrument. func NewResourceQuotaEphemeralStorageLimitUsed( @@ -7191,12 +7756,15 @@ func NewResourceQuotaEphemeralStorageLimitUsed( return ResourceQuotaEphemeralStorageLimitUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaEphemeralStorageLimitUsedOpts + } else { + opt = append(opt, newResourceQuotaEphemeralStorageLimitUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.ephemeral_storage.limit.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The sum of local ephemeral storage limits in the namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaEphemeralStorageLimitUsed{noop.Int64UpDownCounter{}}, err @@ -7278,6 +7846,11 @@ type ResourceQuotaEphemeralStorageRequestHard struct { metric.Int64UpDownCounter } +var newResourceQuotaEphemeralStorageRequestHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The sum of local ephemeral storage requests in the namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaEphemeralStorageRequestHard returns a new // ResourceQuotaEphemeralStorageRequestHard instrument. func NewResourceQuotaEphemeralStorageRequestHard( @@ -7289,12 +7862,15 @@ func NewResourceQuotaEphemeralStorageRequestHard( return ResourceQuotaEphemeralStorageRequestHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaEphemeralStorageRequestHardOpts + } else { + opt = append(opt, newResourceQuotaEphemeralStorageRequestHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.ephemeral_storage.request.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The sum of local ephemeral storage requests in the namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaEphemeralStorageRequestHard{noop.Int64UpDownCounter{}}, err @@ -7376,6 +7952,11 @@ type ResourceQuotaEphemeralStorageRequestUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaEphemeralStorageRequestUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The sum of local ephemeral storage requests in the namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaEphemeralStorageRequestUsed returns a new // ResourceQuotaEphemeralStorageRequestUsed instrument. func NewResourceQuotaEphemeralStorageRequestUsed( @@ -7387,12 +7968,15 @@ func NewResourceQuotaEphemeralStorageRequestUsed( return ResourceQuotaEphemeralStorageRequestUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaEphemeralStorageRequestUsedOpts + } else { + opt = append(opt, newResourceQuotaEphemeralStorageRequestUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.ephemeral_storage.request.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The sum of local ephemeral storage requests in the namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaEphemeralStorageRequestUsed{noop.Int64UpDownCounter{}}, err @@ -7474,6 +8058,11 @@ type ResourceQuotaHugepageCountRequestHard struct { metric.Int64UpDownCounter } +var newResourceQuotaHugepageCountRequestHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The huge page requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("{hugepage}"), +} + // NewResourceQuotaHugepageCountRequestHard returns a new // ResourceQuotaHugepageCountRequestHard instrument. func NewResourceQuotaHugepageCountRequestHard( @@ -7485,12 +8074,15 @@ func NewResourceQuotaHugepageCountRequestHard( return ResourceQuotaHugepageCountRequestHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaHugepageCountRequestHardOpts + } else { + opt = append(opt, newResourceQuotaHugepageCountRequestHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.hugepage_count.request.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The huge page requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("{hugepage}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaHugepageCountRequestHard{noop.Int64UpDownCounter{}}, err @@ -7588,6 +8180,11 @@ type ResourceQuotaHugepageCountRequestUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaHugepageCountRequestUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The huge page requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("{hugepage}"), +} + // NewResourceQuotaHugepageCountRequestUsed returns a new // ResourceQuotaHugepageCountRequestUsed instrument. func NewResourceQuotaHugepageCountRequestUsed( @@ -7599,12 +8196,15 @@ func NewResourceQuotaHugepageCountRequestUsed( return ResourceQuotaHugepageCountRequestUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaHugepageCountRequestUsedOpts + } else { + opt = append(opt, newResourceQuotaHugepageCountRequestUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.hugepage_count.request.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The huge page requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("{hugepage}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaHugepageCountRequestUsed{noop.Int64UpDownCounter{}}, err @@ -7701,6 +8301,11 @@ type ResourceQuotaMemoryLimitHard struct { metric.Int64UpDownCounter } +var newResourceQuotaMemoryLimitHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The memory limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaMemoryLimitHard returns a new ResourceQuotaMemoryLimitHard // instrument. func NewResourceQuotaMemoryLimitHard( @@ -7712,12 +8317,15 @@ func NewResourceQuotaMemoryLimitHard( return ResourceQuotaMemoryLimitHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaMemoryLimitHardOpts + } else { + opt = append(opt, newResourceQuotaMemoryLimitHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.memory.limit.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The memory limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaMemoryLimitHard{noop.Int64UpDownCounter{}}, err @@ -7798,6 +8406,11 @@ type ResourceQuotaMemoryLimitUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaMemoryLimitUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The memory limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaMemoryLimitUsed returns a new ResourceQuotaMemoryLimitUsed // instrument. func NewResourceQuotaMemoryLimitUsed( @@ -7809,12 +8422,15 @@ func NewResourceQuotaMemoryLimitUsed( return ResourceQuotaMemoryLimitUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaMemoryLimitUsedOpts + } else { + opt = append(opt, newResourceQuotaMemoryLimitUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.memory.limit.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The memory limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaMemoryLimitUsed{noop.Int64UpDownCounter{}}, err @@ -7895,6 +8511,11 @@ type ResourceQuotaMemoryRequestHard struct { metric.Int64UpDownCounter } +var newResourceQuotaMemoryRequestHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The memory requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaMemoryRequestHard returns a new ResourceQuotaMemoryRequestHard // instrument. func NewResourceQuotaMemoryRequestHard( @@ -7906,12 +8527,15 @@ func NewResourceQuotaMemoryRequestHard( return ResourceQuotaMemoryRequestHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaMemoryRequestHardOpts + } else { + opt = append(opt, newResourceQuotaMemoryRequestHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.memory.request.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The memory requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaMemoryRequestHard{noop.Int64UpDownCounter{}}, err @@ -7992,6 +8616,11 @@ type ResourceQuotaMemoryRequestUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaMemoryRequestUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The memory requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaMemoryRequestUsed returns a new ResourceQuotaMemoryRequestUsed // instrument. func NewResourceQuotaMemoryRequestUsed( @@ -8003,12 +8632,15 @@ func NewResourceQuotaMemoryRequestUsed( return ResourceQuotaMemoryRequestUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaMemoryRequestUsedOpts + } else { + opt = append(opt, newResourceQuotaMemoryRequestUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.memory.request.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The memory requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaMemoryRequestUsed{noop.Int64UpDownCounter{}}, err @@ -8089,6 +8721,11 @@ type ResourceQuotaObjectCountHard struct { metric.Int64UpDownCounter } +var newResourceQuotaObjectCountHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The object count limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("{object}"), +} + // NewResourceQuotaObjectCountHard returns a new ResourceQuotaObjectCountHard // instrument. func NewResourceQuotaObjectCountHard( @@ -8100,12 +8737,15 @@ func NewResourceQuotaObjectCountHard( return ResourceQuotaObjectCountHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaObjectCountHardOpts + } else { + opt = append(opt, newResourceQuotaObjectCountHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.object_count.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The object count limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("{object}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaObjectCountHard{noop.Int64UpDownCounter{}}, err @@ -8203,6 +8843,11 @@ type ResourceQuotaObjectCountUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaObjectCountUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The object count limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("{object}"), +} + // NewResourceQuotaObjectCountUsed returns a new ResourceQuotaObjectCountUsed // instrument. func NewResourceQuotaObjectCountUsed( @@ -8214,12 +8859,15 @@ func NewResourceQuotaObjectCountUsed( return ResourceQuotaObjectCountUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaObjectCountUsedOpts + } else { + opt = append(opt, newResourceQuotaObjectCountUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.object_count.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The object count limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("{object}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaObjectCountUsed{noop.Int64UpDownCounter{}}, err @@ -8319,6 +8967,11 @@ type ResourceQuotaPersistentvolumeclaimCountHard struct { metric.Int64UpDownCounter } +var newResourceQuotaPersistentvolumeclaimCountHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("{persistentvolumeclaim}"), +} + // NewResourceQuotaPersistentvolumeclaimCountHard returns a new // ResourceQuotaPersistentvolumeclaimCountHard instrument. func NewResourceQuotaPersistentvolumeclaimCountHard( @@ -8330,12 +8983,15 @@ func NewResourceQuotaPersistentvolumeclaimCountHard( return ResourceQuotaPersistentvolumeclaimCountHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaPersistentvolumeclaimCountHardOpts + } else { + opt = append(opt, newResourceQuotaPersistentvolumeclaimCountHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.persistentvolumeclaim_count.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("{persistentvolumeclaim}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaPersistentvolumeclaimCountHard{noop.Int64UpDownCounter{}}, err @@ -8447,6 +9103,11 @@ type ResourceQuotaPersistentvolumeclaimCountUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaPersistentvolumeclaimCountUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("{persistentvolumeclaim}"), +} + // NewResourceQuotaPersistentvolumeclaimCountUsed returns a new // ResourceQuotaPersistentvolumeclaimCountUsed instrument. func NewResourceQuotaPersistentvolumeclaimCountUsed( @@ -8458,12 +9119,15 @@ func NewResourceQuotaPersistentvolumeclaimCountUsed( return ResourceQuotaPersistentvolumeclaimCountUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaPersistentvolumeclaimCountUsedOpts + } else { + opt = append(opt, newResourceQuotaPersistentvolumeclaimCountUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.persistentvolumeclaim_count.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("{persistentvolumeclaim}"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaPersistentvolumeclaimCountUsed{noop.Int64UpDownCounter{}}, err @@ -8573,6 +9237,11 @@ type ResourceQuotaStorageRequestHard struct { metric.Int64UpDownCounter } +var newResourceQuotaStorageRequestHardOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The storage requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaStorageRequestHard returns a new // ResourceQuotaStorageRequestHard instrument. func NewResourceQuotaStorageRequestHard( @@ -8584,12 +9253,15 @@ func NewResourceQuotaStorageRequestHard( return ResourceQuotaStorageRequestHard{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaStorageRequestHardOpts + } else { + opt = append(opt, newResourceQuotaStorageRequestHardOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.storage.request.hard", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The storage requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaStorageRequestHard{noop.Int64UpDownCounter{}}, err @@ -8699,6 +9371,11 @@ type ResourceQuotaStorageRequestUsed struct { metric.Int64UpDownCounter } +var newResourceQuotaStorageRequestUsedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The storage requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), + metric.WithUnit("By"), +} + // NewResourceQuotaStorageRequestUsed returns a new // ResourceQuotaStorageRequestUsed instrument. func NewResourceQuotaStorageRequestUsed( @@ -8710,12 +9387,15 @@ func NewResourceQuotaStorageRequestUsed( return ResourceQuotaStorageRequestUsed{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newResourceQuotaStorageRequestUsedOpts + } else { + opt = append(opt, newResourceQuotaStorageRequestUsedOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.resourcequota.storage.request.used", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The storage requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ResourceQuotaStorageRequestUsed{noop.Int64UpDownCounter{}}, err @@ -8824,6 +9504,11 @@ type StatefulSetCurrentPods struct { metric.Int64UpDownCounter } +var newStatefulSetCurrentPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision."), + metric.WithUnit("{pod}"), +} + // NewStatefulSetCurrentPods returns a new StatefulSetCurrentPods instrument. func NewStatefulSetCurrentPods( m metric.Meter, @@ -8834,12 +9519,15 @@ func NewStatefulSetCurrentPods( return StatefulSetCurrentPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newStatefulSetCurrentPodsOpts + } else { + opt = append(opt, newStatefulSetCurrentPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.statefulset.current_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return StatefulSetCurrentPods{noop.Int64UpDownCounter{}}, err @@ -8918,6 +9606,11 @@ type StatefulSetDesiredPods struct { metric.Int64UpDownCounter } +var newStatefulSetDesiredPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of desired replica pods in this statefulset."), + metric.WithUnit("{pod}"), +} + // NewStatefulSetDesiredPods returns a new StatefulSetDesiredPods instrument. func NewStatefulSetDesiredPods( m metric.Meter, @@ -8928,12 +9621,15 @@ func NewStatefulSetDesiredPods( return StatefulSetDesiredPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newStatefulSetDesiredPodsOpts + } else { + opt = append(opt, newStatefulSetDesiredPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.statefulset.desired_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of desired replica pods in this statefulset."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return StatefulSetDesiredPods{noop.Int64UpDownCounter{}}, err @@ -9012,6 +9708,11 @@ type StatefulSetReadyPods struct { metric.Int64UpDownCounter } +var newStatefulSetReadyPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of replica pods created for this statefulset with a Ready Condition."), + metric.WithUnit("{pod}"), +} + // NewStatefulSetReadyPods returns a new StatefulSetReadyPods instrument. func NewStatefulSetReadyPods( m metric.Meter, @@ -9022,12 +9723,15 @@ func NewStatefulSetReadyPods( return StatefulSetReadyPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newStatefulSetReadyPodsOpts + } else { + opt = append(opt, newStatefulSetReadyPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.statefulset.ready_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of replica pods created for this statefulset with a Ready Condition."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return StatefulSetReadyPods{noop.Int64UpDownCounter{}}, err @@ -9107,6 +9811,11 @@ type StatefulSetUpdatedPods struct { metric.Int64UpDownCounter } +var newStatefulSetUpdatedPodsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision."), + metric.WithUnit("{pod}"), +} + // NewStatefulSetUpdatedPods returns a new StatefulSetUpdatedPods instrument. func NewStatefulSetUpdatedPods( m metric.Meter, @@ -9117,12 +9826,15 @@ func NewStatefulSetUpdatedPods( return StatefulSetUpdatedPods{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newStatefulSetUpdatedPodsOpts + } else { + opt = append(opt, newStatefulSetUpdatedPodsOpts...) + } + i, err := m.Int64UpDownCounter( "k8s.statefulset.updated_pods", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision."), - metric.WithUnit("{pod}"), - }, opt...)..., + opt..., ) if err != nil { return StatefulSetUpdatedPods{noop.Int64UpDownCounter{}}, err diff --git a/semconv/v1.37.0/messagingconv/metric.go b/semconv/v1.37.0/messagingconv/metric.go index 0887eabf5..58438d02c 100644 --- a/semconv/v1.37.0/messagingconv/metric.go +++ b/semconv/v1.37.0/messagingconv/metric.go @@ -95,6 +95,11 @@ type ClientConsumedMessages struct { metric.Int64Counter } +var newClientConsumedMessagesOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of messages that were delivered to the application."), + metric.WithUnit("{message}"), +} + // NewClientConsumedMessages returns a new ClientConsumedMessages instrument. func NewClientConsumedMessages( m metric.Meter, @@ -105,12 +110,15 @@ func NewClientConsumedMessages( return ClientConsumedMessages{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newClientConsumedMessagesOpts + } else { + opt = append(opt, newClientConsumedMessagesOpts...) + } + i, err := m.Int64Counter( "messaging.client.consumed.messages", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of messages that were delivered to the application."), - metric.WithUnit("{message}"), - }, opt...)..., + opt..., ) if err != nil { return ClientConsumedMessages{noop.Int64Counter{}}, err @@ -273,6 +281,11 @@ type ClientOperationDuration struct { metric.Float64Histogram } +var newClientOperationDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of messaging operation initiated by a producer or consumer client."), + metric.WithUnit("s"), +} + // NewClientOperationDuration returns a new ClientOperationDuration instrument. func NewClientOperationDuration( m metric.Meter, @@ -283,12 +296,15 @@ func NewClientOperationDuration( return ClientOperationDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientOperationDurationOpts + } else { + opt = append(opt, newClientOperationDurationOpts...) + } + i, err := m.Float64Histogram( "messaging.client.operation.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of messaging operation initiated by a producer or consumer client."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ClientOperationDuration{noop.Float64Histogram{}}, err @@ -448,6 +464,11 @@ type ClientSentMessages struct { metric.Int64Counter } +var newClientSentMessagesOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of messages producer attempted to send to the broker."), + metric.WithUnit("{message}"), +} + // NewClientSentMessages returns a new ClientSentMessages instrument. func NewClientSentMessages( m metric.Meter, @@ -458,12 +479,15 @@ func NewClientSentMessages( return ClientSentMessages{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newClientSentMessagesOpts + } else { + opt = append(opt, newClientSentMessagesOpts...) + } + i, err := m.Int64Counter( "messaging.client.sent.messages", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of messages producer attempted to send to the broker."), - metric.WithUnit("{message}"), - }, opt...)..., + opt..., ) if err != nil { return ClientSentMessages{noop.Int64Counter{}}, err @@ -603,6 +627,11 @@ type ProcessDuration struct { metric.Float64Histogram } +var newProcessDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of processing operation."), + metric.WithUnit("s"), +} + // NewProcessDuration returns a new ProcessDuration instrument. func NewProcessDuration( m metric.Meter, @@ -613,12 +642,15 @@ func NewProcessDuration( return ProcessDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newProcessDurationOpts + } else { + opt = append(opt, newProcessDurationOpts...) + } + i, err := m.Float64Histogram( "messaging.process.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Duration of processing operation."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ProcessDuration{noop.Float64Histogram{}}, err diff --git a/semconv/v1.37.0/otelconv/metric.go b/semconv/v1.37.0/otelconv/metric.go index a78eafd1f..8fc525a11 100644 --- a/semconv/v1.37.0/otelconv/metric.go +++ b/semconv/v1.37.0/otelconv/metric.go @@ -172,6 +172,11 @@ type SDKExporterLogExported struct { metric.Int64Counter } +var newSDKExporterLogExportedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of log records for which the export has finished, either successful or failed."), + metric.WithUnit("{log_record}"), +} + // NewSDKExporterLogExported returns a new SDKExporterLogExported instrument. func NewSDKExporterLogExported( m metric.Meter, @@ -182,12 +187,15 @@ func NewSDKExporterLogExported( return SDKExporterLogExported{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterLogExportedOpts + } else { + opt = append(opt, newSDKExporterLogExportedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.exporter.log.exported", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of log records for which the export has finished, either successful or failed."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterLogExported{noop.Int64Counter{}}, err @@ -319,6 +327,11 @@ type SDKExporterLogInflight struct { metric.Int64UpDownCounter } +var newSDKExporterLogInflightOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), + metric.WithUnit("{log_record}"), +} + // NewSDKExporterLogInflight returns a new SDKExporterLogInflight instrument. func NewSDKExporterLogInflight( m metric.Meter, @@ -329,12 +342,15 @@ func NewSDKExporterLogInflight( return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterLogInflightOpts + } else { + opt = append(opt, newSDKExporterLogInflightOpts...) + } + i, err := m.Int64UpDownCounter( "otel.sdk.exporter.log.inflight", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, err @@ -449,6 +465,11 @@ type SDKExporterMetricDataPointExported struct { metric.Int64Counter } +var newSDKExporterMetricDataPointExportedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of metric data points for which the export has finished, either successful or failed."), + metric.WithUnit("{data_point}"), +} + // NewSDKExporterMetricDataPointExported returns a new // SDKExporterMetricDataPointExported instrument. func NewSDKExporterMetricDataPointExported( @@ -460,12 +481,15 @@ func NewSDKExporterMetricDataPointExported( return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterMetricDataPointExportedOpts + } else { + opt = append(opt, newSDKExporterMetricDataPointExportedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.exporter.metric_data_point.exported", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of metric data points for which the export has finished, either successful or failed."), - metric.WithUnit("{data_point}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, err @@ -598,6 +622,11 @@ type SDKExporterMetricDataPointInflight struct { metric.Int64UpDownCounter } +var newSDKExporterMetricDataPointInflightOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), + metric.WithUnit("{data_point}"), +} + // NewSDKExporterMetricDataPointInflight returns a new // SDKExporterMetricDataPointInflight instrument. func NewSDKExporterMetricDataPointInflight( @@ -609,12 +638,15 @@ func NewSDKExporterMetricDataPointInflight( return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterMetricDataPointInflightOpts + } else { + opt = append(opt, newSDKExporterMetricDataPointInflightOpts...) + } + i, err := m.Int64UpDownCounter( "otel.sdk.exporter.metric_data_point.inflight", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{data_point}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, err @@ -728,6 +760,11 @@ type SDKExporterOperationDuration struct { metric.Float64Histogram } +var newSDKExporterOperationDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of exporting a batch of telemetry records."), + metric.WithUnit("s"), +} + // NewSDKExporterOperationDuration returns a new SDKExporterOperationDuration // instrument. func NewSDKExporterOperationDuration( @@ -739,12 +776,15 @@ func NewSDKExporterOperationDuration( return SDKExporterOperationDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterOperationDurationOpts + } else { + opt = append(opt, newSDKExporterOperationDurationOpts...) + } + i, err := m.Float64Histogram( "otel.sdk.exporter.operation.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The duration of exporting a batch of telemetry records."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterOperationDuration{noop.Float64Histogram{}}, err @@ -893,6 +933,11 @@ type SDKExporterSpanExported struct { metric.Int64Counter } +var newSDKExporterSpanExportedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of spans for which the export has finished, either successful or failed."), + metric.WithUnit("{span}"), +} + // NewSDKExporterSpanExported returns a new SDKExporterSpanExported instrument. func NewSDKExporterSpanExported( m metric.Meter, @@ -903,12 +948,15 @@ func NewSDKExporterSpanExported( return SDKExporterSpanExported{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterSpanExportedOpts + } else { + opt = append(opt, newSDKExporterSpanExportedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.exporter.span.exported", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of spans for which the export has finished, either successful or failed."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterSpanExported{noop.Int64Counter{}}, err @@ -1040,6 +1088,11 @@ type SDKExporterSpanInflight struct { metric.Int64UpDownCounter } +var newSDKExporterSpanInflightOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), + metric.WithUnit("{span}"), +} + // NewSDKExporterSpanInflight returns a new SDKExporterSpanInflight instrument. func NewSDKExporterSpanInflight( m metric.Meter, @@ -1050,12 +1103,15 @@ func NewSDKExporterSpanInflight( return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKExporterSpanInflightOpts + } else { + opt = append(opt, newSDKExporterSpanInflightOpts...) + } + i, err := m.Int64UpDownCounter( "otel.sdk.exporter.span.inflight", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, err @@ -1169,6 +1225,11 @@ type SDKLogCreated struct { metric.Int64Counter } +var newSDKLogCreatedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of logs submitted to enabled SDK Loggers."), + metric.WithUnit("{log_record}"), +} + // NewSDKLogCreated returns a new SDKLogCreated instrument. func NewSDKLogCreated( m metric.Meter, @@ -1179,12 +1240,15 @@ func NewSDKLogCreated( return SDKLogCreated{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKLogCreatedOpts + } else { + opt = append(opt, newSDKLogCreatedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.log.created", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of logs submitted to enabled SDK Loggers."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKLogCreated{noop.Int64Counter{}}, err @@ -1254,6 +1318,11 @@ type SDKMetricReaderCollectionDuration struct { metric.Float64Histogram } +var newSDKMetricReaderCollectionDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of the collect operation of the metric reader."), + metric.WithUnit("s"), +} + // NewSDKMetricReaderCollectionDuration returns a new // SDKMetricReaderCollectionDuration instrument. func NewSDKMetricReaderCollectionDuration( @@ -1265,12 +1334,15 @@ func NewSDKMetricReaderCollectionDuration( return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newSDKMetricReaderCollectionDurationOpts + } else { + opt = append(opt, newSDKMetricReaderCollectionDurationOpts...) + } + i, err := m.Float64Histogram( "otel.sdk.metric_reader.collection.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The duration of the collect operation of the metric reader."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, err @@ -1384,6 +1456,11 @@ type SDKProcessorLogProcessed struct { metric.Int64Counter } +var newSDKProcessorLogProcessedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of log records for which the processing has finished, either successful or failed."), + metric.WithUnit("{log_record}"), +} + // NewSDKProcessorLogProcessed returns a new SDKProcessorLogProcessed instrument. func NewSDKProcessorLogProcessed( m metric.Meter, @@ -1394,12 +1471,15 @@ func NewSDKProcessorLogProcessed( return SDKProcessorLogProcessed{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorLogProcessedOpts + } else { + opt = append(opt, newSDKProcessorLogProcessedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.processor.log.processed", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of log records for which the processing has finished, either successful or failed."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorLogProcessed{noop.Int64Counter{}}, err @@ -1515,6 +1595,11 @@ type SDKProcessorLogQueueCapacity struct { metric.Int64ObservableUpDownCounter } +var newSDKProcessorLogQueueCapacityOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold."), + metric.WithUnit("{log_record}"), +} + // NewSDKProcessorLogQueueCapacity returns a new SDKProcessorLogQueueCapacity // instrument. func NewSDKProcessorLogQueueCapacity( @@ -1526,12 +1611,15 @@ func NewSDKProcessorLogQueueCapacity( return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorLogQueueCapacityOpts + } else { + opt = append(opt, newSDKProcessorLogQueueCapacityOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "otel.sdk.processor.log.queue.capacity", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, err @@ -1581,6 +1669,11 @@ type SDKProcessorLogQueueSize struct { metric.Int64ObservableUpDownCounter } +var newSDKProcessorLogQueueSizeOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("The number of log records in the queue of a given instance of an SDK log processor."), + metric.WithUnit("{log_record}"), +} + // NewSDKProcessorLogQueueSize returns a new SDKProcessorLogQueueSize instrument. func NewSDKProcessorLogQueueSize( m metric.Meter, @@ -1591,12 +1684,15 @@ func NewSDKProcessorLogQueueSize( return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorLogQueueSizeOpts + } else { + opt = append(opt, newSDKProcessorLogQueueSizeOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "otel.sdk.processor.log.queue.size", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The number of log records in the queue of a given instance of an SDK log processor."), - metric.WithUnit("{log_record}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, err @@ -1646,6 +1742,11 @@ type SDKProcessorSpanProcessed struct { metric.Int64Counter } +var newSDKProcessorSpanProcessedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of spans for which the processing has finished, either successful or failed."), + metric.WithUnit("{span}"), +} + // NewSDKProcessorSpanProcessed returns a new SDKProcessorSpanProcessed // instrument. func NewSDKProcessorSpanProcessed( @@ -1657,12 +1758,15 @@ func NewSDKProcessorSpanProcessed( return SDKProcessorSpanProcessed{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorSpanProcessedOpts + } else { + opt = append(opt, newSDKProcessorSpanProcessedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.processor.span.processed", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of spans for which the processing has finished, either successful or failed."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorSpanProcessed{noop.Int64Counter{}}, err @@ -1778,6 +1882,11 @@ type SDKProcessorSpanQueueCapacity struct { metric.Int64ObservableUpDownCounter } +var newSDKProcessorSpanQueueCapacityOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("The maximum number of spans the queue of a given instance of an SDK span processor can hold."), + metric.WithUnit("{span}"), +} + // NewSDKProcessorSpanQueueCapacity returns a new SDKProcessorSpanQueueCapacity // instrument. func NewSDKProcessorSpanQueueCapacity( @@ -1789,12 +1898,15 @@ func NewSDKProcessorSpanQueueCapacity( return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorSpanQueueCapacityOpts + } else { + opt = append(opt, newSDKProcessorSpanQueueCapacityOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "otel.sdk.processor.span.queue.capacity", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The maximum number of spans the queue of a given instance of an SDK span processor can hold."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, err @@ -1844,6 +1956,11 @@ type SDKProcessorSpanQueueSize struct { metric.Int64ObservableUpDownCounter } +var newSDKProcessorSpanQueueSizeOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("The number of spans in the queue of a given instance of an SDK span processor."), + metric.WithUnit("{span}"), +} + // NewSDKProcessorSpanQueueSize returns a new SDKProcessorSpanQueueSize // instrument. func NewSDKProcessorSpanQueueSize( @@ -1855,12 +1972,15 @@ func NewSDKProcessorSpanQueueSize( return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKProcessorSpanQueueSizeOpts + } else { + opt = append(opt, newSDKProcessorSpanQueueSizeOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "otel.sdk.processor.span.queue.size", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("The number of spans in the queue of a given instance of an SDK span processor."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, err @@ -1910,6 +2030,11 @@ type SDKSpanLive struct { metric.Int64UpDownCounter } +var newSDKSpanLiveOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of created spans with `recording=true` for which the end operation has not been called yet."), + metric.WithUnit("{span}"), +} + // NewSDKSpanLive returns a new SDKSpanLive instrument. func NewSDKSpanLive( m metric.Meter, @@ -1920,12 +2045,15 @@ func NewSDKSpanLive( return SDKSpanLive{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newSDKSpanLiveOpts + } else { + opt = append(opt, newSDKSpanLiveOpts...) + } + i, err := m.Int64UpDownCounter( "otel.sdk.span.live", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of created spans with `recording=true` for which the end operation has not been called yet."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKSpanLive{noop.Int64UpDownCounter{}}, err @@ -2013,6 +2141,11 @@ type SDKSpanStarted struct { metric.Int64Counter } +var newSDKSpanStartedOpts = []metric.Int64CounterOption{ + metric.WithDescription("The number of created spans."), + metric.WithUnit("{span}"), +} + // NewSDKSpanStarted returns a new SDKSpanStarted instrument. func NewSDKSpanStarted( m metric.Meter, @@ -2023,12 +2156,15 @@ func NewSDKSpanStarted( return SDKSpanStarted{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newSDKSpanStartedOpts + } else { + opt = append(opt, newSDKSpanStartedOpts...) + } + i, err := m.Int64Counter( "otel.sdk.span.started", - append([]metric.Int64CounterOption{ - metric.WithDescription("The number of created spans."), - metric.WithUnit("{span}"), - }, opt...)..., + opt..., ) if err != nil { return SDKSpanStarted{noop.Int64Counter{}}, err diff --git a/semconv/v1.37.0/processconv/metric.go b/semconv/v1.37.0/processconv/metric.go index 64921e041..c46937b0d 100644 --- a/semconv/v1.37.0/processconv/metric.go +++ b/semconv/v1.37.0/processconv/metric.go @@ -107,6 +107,11 @@ type ContextSwitches struct { metric.Int64Counter } +var newContextSwitchesOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of times the process has been context switched."), + metric.WithUnit("{context_switch}"), +} + // NewContextSwitches returns a new ContextSwitches instrument. func NewContextSwitches( m metric.Meter, @@ -117,12 +122,15 @@ func NewContextSwitches( return ContextSwitches{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newContextSwitchesOpts + } else { + opt = append(opt, newContextSwitchesOpts...) + } + i, err := m.Int64Counter( "process.context_switches", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of times the process has been context switched."), - metric.WithUnit("{context_switch}"), - }, opt...)..., + opt..., ) if err != nil { return ContextSwitches{noop.Int64Counter{}}, err @@ -211,6 +219,11 @@ type CPUTime struct { metric.Float64ObservableCounter } +var newCPUTimeOpts = []metric.Float64ObservableCounterOption{ + metric.WithDescription("Total CPU seconds broken down by different states."), + metric.WithUnit("s"), +} + // NewCPUTime returns a new CPUTime instrument. func NewCPUTime( m metric.Meter, @@ -221,12 +234,15 @@ func NewCPUTime( return CPUTime{noop.Float64ObservableCounter{}}, nil } + if len(opt) == 0 { + opt = newCPUTimeOpts + } else { + opt = append(opt, newCPUTimeOpts...) + } + i, err := m.Float64ObservableCounter( "process.cpu.time", - append([]metric.Float64ObservableCounterOption{ - metric.WithDescription("Total CPU seconds broken down by different states."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return CPUTime{noop.Float64ObservableCounter{}}, err @@ -269,6 +285,11 @@ type CPUUtilization struct { metric.Int64Gauge } +var newCPUUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process."), + metric.WithUnit("1"), +} + // NewCPUUtilization returns a new CPUUtilization instrument. func NewCPUUtilization( m metric.Meter, @@ -279,12 +300,15 @@ func NewCPUUtilization( return CPUUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUUtilizationOpts + } else { + opt = append(opt, newCPUUtilizationOpts...) + } + i, err := m.Int64Gauge( "process.cpu.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return CPUUtilization{noop.Int64Gauge{}}, err @@ -371,6 +395,11 @@ type DiskIO struct { metric.Int64Counter } +var newDiskIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Disk bytes transferred."), + metric.WithUnit("By"), +} + // NewDiskIO returns a new DiskIO instrument. func NewDiskIO( m metric.Meter, @@ -381,12 +410,15 @@ func NewDiskIO( return DiskIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskIOOpts + } else { + opt = append(opt, newDiskIOOpts...) + } + i, err := m.Int64Counter( "process.disk.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Disk bytes transferred."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return DiskIO{noop.Int64Counter{}}, err @@ -473,6 +505,11 @@ type MemoryUsage struct { metric.Int64UpDownCounter } +var newMemoryUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The amount of physical memory in use."), + metric.WithUnit("By"), +} + // NewMemoryUsage returns a new MemoryUsage instrument. func NewMemoryUsage( m metric.Meter, @@ -483,12 +520,15 @@ func NewMemoryUsage( return MemoryUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryUsageOpts + } else { + opt = append(opt, newMemoryUsageOpts...) + } + i, err := m.Int64UpDownCounter( "process.memory.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The amount of physical memory in use."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryUsage{noop.Int64UpDownCounter{}}, err @@ -557,6 +597,11 @@ type MemoryVirtual struct { metric.Int64UpDownCounter } +var newMemoryVirtualOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The amount of committed virtual memory."), + metric.WithUnit("By"), +} + // NewMemoryVirtual returns a new MemoryVirtual instrument. func NewMemoryVirtual( m metric.Meter, @@ -567,12 +612,15 @@ func NewMemoryVirtual( return MemoryVirtual{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryVirtualOpts + } else { + opt = append(opt, newMemoryVirtualOpts...) + } + i, err := m.Int64UpDownCounter( "process.memory.virtual", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The amount of committed virtual memory."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryVirtual{noop.Int64UpDownCounter{}}, err @@ -641,6 +689,11 @@ type NetworkIO struct { metric.Int64Counter } +var newNetworkIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("Network bytes transferred."), + metric.WithUnit("By"), +} + // NewNetworkIO returns a new NetworkIO instrument. func NewNetworkIO( m metric.Meter, @@ -651,12 +704,15 @@ func NewNetworkIO( return NetworkIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkIOOpts + } else { + opt = append(opt, newNetworkIOOpts...) + } + i, err := m.Int64Counter( "process.network.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("Network bytes transferred."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NetworkIO{noop.Int64Counter{}}, err @@ -744,6 +800,11 @@ type OpenFileDescriptorCount struct { metric.Int64UpDownCounter } +var newOpenFileDescriptorCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of file descriptors in use by the process."), + metric.WithUnit("{file_descriptor}"), +} + // NewOpenFileDescriptorCount returns a new OpenFileDescriptorCount instrument. func NewOpenFileDescriptorCount( m metric.Meter, @@ -754,12 +815,15 @@ func NewOpenFileDescriptorCount( return OpenFileDescriptorCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newOpenFileDescriptorCountOpts + } else { + opt = append(opt, newOpenFileDescriptorCountOpts...) + } + i, err := m.Int64UpDownCounter( "process.open_file_descriptor.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of file descriptors in use by the process."), - metric.WithUnit("{file_descriptor}"), - }, opt...)..., + opt..., ) if err != nil { return OpenFileDescriptorCount{noop.Int64UpDownCounter{}}, err @@ -828,6 +892,11 @@ type PagingFaults struct { metric.Int64Counter } +var newPagingFaultsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Number of page faults the process has made."), + metric.WithUnit("{fault}"), +} + // NewPagingFaults returns a new PagingFaults instrument. func NewPagingFaults( m metric.Meter, @@ -838,12 +907,15 @@ func NewPagingFaults( return PagingFaults{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPagingFaultsOpts + } else { + opt = append(opt, newPagingFaultsOpts...) + } + i, err := m.Int64Counter( "process.paging.faults", - append([]metric.Int64CounterOption{ - metric.WithDescription("Number of page faults the process has made."), - metric.WithUnit("{fault}"), - }, opt...)..., + opt..., ) if err != nil { return PagingFaults{noop.Int64Counter{}}, err @@ -932,6 +1004,11 @@ type ThreadCount struct { metric.Int64UpDownCounter } +var newThreadCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Process threads count."), + metric.WithUnit("{thread}"), +} + // NewThreadCount returns a new ThreadCount instrument. func NewThreadCount( m metric.Meter, @@ -942,12 +1019,15 @@ func NewThreadCount( return ThreadCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newThreadCountOpts + } else { + opt = append(opt, newThreadCountOpts...) + } + i, err := m.Int64UpDownCounter( "process.thread.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Process threads count."), - metric.WithUnit("{thread}"), - }, opt...)..., + opt..., ) if err != nil { return ThreadCount{noop.Int64UpDownCounter{}}, err @@ -1016,6 +1096,11 @@ type Uptime struct { metric.Float64Gauge } +var newUptimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time the process has been running."), + metric.WithUnit("s"), +} + // NewUptime returns a new Uptime instrument. func NewUptime( m metric.Meter, @@ -1026,12 +1111,15 @@ func NewUptime( return Uptime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newUptimeOpts + } else { + opt = append(opt, newUptimeOpts...) + } + i, err := m.Float64Gauge( "process.uptime", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time the process has been running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return Uptime{noop.Float64Gauge{}}, err diff --git a/semconv/v1.37.0/rpcconv/metric.go b/semconv/v1.37.0/rpcconv/metric.go index 146b7eda6..90a153e01 100644 --- a/semconv/v1.37.0/rpcconv/metric.go +++ b/semconv/v1.37.0/rpcconv/metric.go @@ -28,6 +28,11 @@ type ClientDuration struct { metric.Float64Histogram } +var newClientDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of outbound RPC."), + metric.WithUnit("ms"), +} + // NewClientDuration returns a new ClientDuration instrument. func NewClientDuration( m metric.Meter, @@ -38,12 +43,15 @@ func NewClientDuration( return ClientDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientDurationOpts + } else { + opt = append(opt, newClientDurationOpts...) + } + i, err := m.Float64Histogram( "rpc.client.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of outbound RPC."), - metric.WithUnit("ms"), - }, opt...)..., + opt..., ) if err != nil { return ClientDuration{noop.Float64Histogram{}}, err @@ -121,6 +129,11 @@ type ClientRequestSize struct { metric.Int64Histogram } +var newClientRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + // NewClientRequestSize returns a new ClientRequestSize instrument. func NewClientRequestSize( m metric.Meter, @@ -131,12 +144,15 @@ func NewClientRequestSize( return ClientRequestSize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientRequestSizeOpts + } else { + opt = append(opt, newClientRequestSizeOpts...) + } + i, err := m.Int64Histogram( "rpc.client.request.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ClientRequestSize{noop.Int64Histogram{}}, err @@ -208,6 +224,11 @@ type ClientRequestsPerRPC struct { metric.Int64Histogram } +var newClientRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + // NewClientRequestsPerRPC returns a new ClientRequestsPerRPC instrument. func NewClientRequestsPerRPC( m metric.Meter, @@ -218,12 +239,15 @@ func NewClientRequestsPerRPC( return ClientRequestsPerRPC{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientRequestsPerRPCOpts + } else { + opt = append(opt, newClientRequestsPerRPCOpts...) + } + i, err := m.Int64Histogram( "rpc.client.requests_per_rpc", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the number of messages received per RPC."), - metric.WithUnit("{count}"), - }, opt...)..., + opt..., ) if err != nil { return ClientRequestsPerRPC{noop.Int64Histogram{}}, err @@ -299,6 +323,11 @@ type ClientResponseSize struct { metric.Int64Histogram } +var newClientResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + // NewClientResponseSize returns a new ClientResponseSize instrument. func NewClientResponseSize( m metric.Meter, @@ -309,12 +338,15 @@ func NewClientResponseSize( return ClientResponseSize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientResponseSizeOpts + } else { + opt = append(opt, newClientResponseSizeOpts...) + } + i, err := m.Int64Histogram( "rpc.client.response.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ClientResponseSize{noop.Int64Histogram{}}, err @@ -386,6 +418,11 @@ type ClientResponsesPerRPC struct { metric.Int64Histogram } +var newClientResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + // NewClientResponsesPerRPC returns a new ClientResponsesPerRPC instrument. func NewClientResponsesPerRPC( m metric.Meter, @@ -396,12 +433,15 @@ func NewClientResponsesPerRPC( return ClientResponsesPerRPC{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newClientResponsesPerRPCOpts + } else { + opt = append(opt, newClientResponsesPerRPCOpts...) + } + i, err := m.Int64Histogram( "rpc.client.responses_per_rpc", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the number of messages sent per RPC."), - metric.WithUnit("{count}"), - }, opt...)..., + opt..., ) if err != nil { return ClientResponsesPerRPC{noop.Int64Histogram{}}, err @@ -477,6 +517,11 @@ type ServerDuration struct { metric.Float64Histogram } +var newServerDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of inbound RPC."), + metric.WithUnit("ms"), +} + // NewServerDuration returns a new ServerDuration instrument. func NewServerDuration( m metric.Meter, @@ -487,12 +532,15 @@ func NewServerDuration( return ServerDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerDurationOpts + } else { + opt = append(opt, newServerDurationOpts...) + } + i, err := m.Float64Histogram( "rpc.server.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("Measures the duration of inbound RPC."), - metric.WithUnit("ms"), - }, opt...)..., + opt..., ) if err != nil { return ServerDuration{noop.Float64Histogram{}}, err @@ -570,6 +618,11 @@ type ServerRequestSize struct { metric.Int64Histogram } +var newServerRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + // NewServerRequestSize returns a new ServerRequestSize instrument. func NewServerRequestSize( m metric.Meter, @@ -580,12 +633,15 @@ func NewServerRequestSize( return ServerRequestSize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerRequestSizeOpts + } else { + opt = append(opt, newServerRequestSizeOpts...) + } + i, err := m.Int64Histogram( "rpc.server.request.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ServerRequestSize{noop.Int64Histogram{}}, err @@ -657,6 +713,11 @@ type ServerRequestsPerRPC struct { metric.Int64Histogram } +var newServerRequestsPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages received per RPC."), + metric.WithUnit("{count}"), +} + // NewServerRequestsPerRPC returns a new ServerRequestsPerRPC instrument. func NewServerRequestsPerRPC( m metric.Meter, @@ -667,12 +728,15 @@ func NewServerRequestsPerRPC( return ServerRequestsPerRPC{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerRequestsPerRPCOpts + } else { + opt = append(opt, newServerRequestsPerRPCOpts...) + } + i, err := m.Int64Histogram( "rpc.server.requests_per_rpc", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the number of messages received per RPC."), - metric.WithUnit("{count}"), - }, opt...)..., + opt..., ) if err != nil { return ServerRequestsPerRPC{noop.Int64Histogram{}}, err @@ -748,6 +812,11 @@ type ServerResponseSize struct { metric.Int64Histogram } +var newServerResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + // NewServerResponseSize returns a new ServerResponseSize instrument. func NewServerResponseSize( m metric.Meter, @@ -758,12 +827,15 @@ func NewServerResponseSize( return ServerResponseSize{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerResponseSizeOpts + } else { + opt = append(opt, newServerResponseSizeOpts...) + } + i, err := m.Int64Histogram( "rpc.server.response.size", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return ServerResponseSize{noop.Int64Histogram{}}, err @@ -835,6 +907,11 @@ type ServerResponsesPerRPC struct { metric.Int64Histogram } +var newServerResponsesPerRPCOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the number of messages sent per RPC."), + metric.WithUnit("{count}"), +} + // NewServerResponsesPerRPC returns a new ServerResponsesPerRPC instrument. func NewServerResponsesPerRPC( m metric.Meter, @@ -845,12 +922,15 @@ func NewServerResponsesPerRPC( return ServerResponsesPerRPC{noop.Int64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerResponsesPerRPCOpts + } else { + opt = append(opt, newServerResponsesPerRPCOpts...) + } + i, err := m.Int64Histogram( "rpc.server.responses_per_rpc", - append([]metric.Int64HistogramOption{ - metric.WithDescription("Measures the number of messages sent per RPC."), - metric.WithUnit("{count}"), - }, opt...)..., + opt..., ) if err != nil { return ServerResponsesPerRPC{noop.Int64Histogram{}}, err diff --git a/semconv/v1.37.0/signalrconv/metric.go b/semconv/v1.37.0/signalrconv/metric.go index 57fb95286..56bf83f47 100644 --- a/semconv/v1.37.0/signalrconv/metric.go +++ b/semconv/v1.37.0/signalrconv/metric.go @@ -58,6 +58,11 @@ type ServerActiveConnections struct { metric.Int64UpDownCounter } +var newServerActiveConnectionsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of connections that are currently active on the server."), + metric.WithUnit("{connection}"), +} + // NewServerActiveConnections returns a new ServerActiveConnections instrument. func NewServerActiveConnections( m metric.Meter, @@ -68,12 +73,15 @@ func NewServerActiveConnections( return ServerActiveConnections{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newServerActiveConnectionsOpts + } else { + opt = append(opt, newServerActiveConnectionsOpts...) + } + i, err := m.Int64UpDownCounter( "signalr.server.active_connections", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Number of connections that are currently active on the server."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return ServerActiveConnections{noop.Int64UpDownCounter{}}, err @@ -175,6 +183,11 @@ type ServerConnectionDuration struct { metric.Float64Histogram } +var newServerConnectionDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of connections on the server."), + metric.WithUnit("s"), +} + // NewServerConnectionDuration returns a new ServerConnectionDuration instrument. func NewServerConnectionDuration( m metric.Meter, @@ -185,12 +198,15 @@ func NewServerConnectionDuration( return ServerConnectionDuration{noop.Float64Histogram{}}, nil } + if len(opt) == 0 { + opt = newServerConnectionDurationOpts + } else { + opt = append(opt, newServerConnectionDurationOpts...) + } + i, err := m.Float64Histogram( "signalr.server.connection.duration", - append([]metric.Float64HistogramOption{ - metric.WithDescription("The duration of connections on the server."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ServerConnectionDuration{noop.Float64Histogram{}}, err diff --git a/semconv/v1.37.0/systemconv/metric.go b/semconv/v1.37.0/systemconv/metric.go index 6c5443e0d..9819a4a6b 100644 --- a/semconv/v1.37.0/systemconv/metric.go +++ b/semconv/v1.37.0/systemconv/metric.go @@ -256,6 +256,11 @@ type CPUFrequency struct { metric.Int64Gauge } +var newCPUFrequencyOpts = []metric.Int64GaugeOption{ + metric.WithDescription("Operating frequency of the logical CPU in Hertz."), + metric.WithUnit("Hz"), +} + // NewCPUFrequency returns a new CPUFrequency instrument. func NewCPUFrequency( m metric.Meter, @@ -266,12 +271,15 @@ func NewCPUFrequency( return CPUFrequency{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUFrequencyOpts + } else { + opt = append(opt, newCPUFrequencyOpts...) + } + i, err := m.Int64Gauge( "system.cpu.frequency", - append([]metric.Int64GaugeOption{ - metric.WithDescription("Operating frequency of the logical CPU in Hertz."), - metric.WithUnit("Hz"), - }, opt...)..., + opt..., ) if err != nil { return CPUFrequency{noop.Int64Gauge{}}, err @@ -359,6 +367,11 @@ type CPULogicalCount struct { metric.Int64UpDownCounter } +var newCPULogicalCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking."), + metric.WithUnit("{cpu}"), +} + // NewCPULogicalCount returns a new CPULogicalCount instrument. func NewCPULogicalCount( m metric.Meter, @@ -369,12 +382,15 @@ func NewCPULogicalCount( return CPULogicalCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newCPULogicalCountOpts + } else { + opt = append(opt, newCPULogicalCountOpts...) + } + i, err := m.Int64UpDownCounter( "system.cpu.logical.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return CPULogicalCount{noop.Int64UpDownCounter{}}, err @@ -449,6 +465,11 @@ type CPUPhysicalCount struct { metric.Int64UpDownCounter } +var newCPUPhysicalCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Reports the number of actual physical processor cores on the hardware."), + metric.WithUnit("{cpu}"), +} + // NewCPUPhysicalCount returns a new CPUPhysicalCount instrument. func NewCPUPhysicalCount( m metric.Meter, @@ -459,12 +480,15 @@ func NewCPUPhysicalCount( return CPUPhysicalCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newCPUPhysicalCountOpts + } else { + opt = append(opt, newCPUPhysicalCountOpts...) + } + i, err := m.Int64UpDownCounter( "system.cpu.physical.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Reports the number of actual physical processor cores on the hardware."), - metric.WithUnit("{cpu}"), - }, opt...)..., + opt..., ) if err != nil { return CPUPhysicalCount{noop.Int64UpDownCounter{}}, err @@ -539,6 +563,11 @@ type CPUTime struct { metric.Float64ObservableCounter } +var newCPUTimeOpts = []metric.Float64ObservableCounterOption{ + metric.WithDescription("Seconds each logical CPU spent on each mode."), + metric.WithUnit("s"), +} + // NewCPUTime returns a new CPUTime instrument. func NewCPUTime( m metric.Meter, @@ -549,12 +578,15 @@ func NewCPUTime( return CPUTime{noop.Float64ObservableCounter{}}, nil } + if len(opt) == 0 { + opt = newCPUTimeOpts + } else { + opt = append(opt, newCPUTimeOpts...) + } + i, err := m.Float64ObservableCounter( "system.cpu.time", - append([]metric.Float64ObservableCounterOption{ - metric.WithDescription("Seconds each logical CPU spent on each mode."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return CPUTime{noop.Float64ObservableCounter{}}, err @@ -603,6 +635,11 @@ type CPUUtilization struct { metric.Int64Gauge } +var newCPUUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time."), + metric.WithUnit("1"), +} + // NewCPUUtilization returns a new CPUUtilization instrument. func NewCPUUtilization( m metric.Meter, @@ -613,12 +650,15 @@ func NewCPUUtilization( return CPUUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newCPUUtilizationOpts + } else { + opt = append(opt, newCPUUtilizationOpts...) + } + i, err := m.Int64Gauge( "system.cpu.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return CPUUtilization{noop.Int64Gauge{}}, err @@ -710,6 +750,11 @@ type DiskIO struct { metric.Int64Counter } +var newDiskIOOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("By"), +} + // NewDiskIO returns a new DiskIO instrument. func NewDiskIO( m metric.Meter, @@ -720,12 +765,15 @@ func NewDiskIO( return DiskIO{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskIOOpts + } else { + opt = append(opt, newDiskIOOpts...) + } + i, err := m.Int64Counter( "system.disk.io", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return DiskIO{noop.Int64Counter{}}, err @@ -818,6 +866,11 @@ type DiskIOTime struct { metric.Float64Counter } +var newDiskIOTimeOpts = []metric.Float64CounterOption{ + metric.WithDescription("Time disk spent activated."), + metric.WithUnit("s"), +} + // NewDiskIOTime returns a new DiskIOTime instrument. func NewDiskIOTime( m metric.Meter, @@ -828,12 +881,15 @@ func NewDiskIOTime( return DiskIOTime{noop.Float64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskIOTimeOpts + } else { + opt = append(opt, newDiskIOTimeOpts...) + } + i, err := m.Float64Counter( "system.disk.io_time", - append([]metric.Float64CounterOption{ - metric.WithDescription("Time disk spent activated."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return DiskIOTime{noop.Float64Counter{}}, err @@ -944,6 +1000,11 @@ type DiskLimit struct { metric.Int64UpDownCounter } +var newDiskLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The total storage capacity of the disk."), + metric.WithUnit("By"), +} + // NewDiskLimit returns a new DiskLimit instrument. func NewDiskLimit( m metric.Meter, @@ -954,12 +1015,15 @@ func NewDiskLimit( return DiskLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newDiskLimitOpts + } else { + opt = append(opt, newDiskLimitOpts...) + } + i, err := m.Int64UpDownCounter( "system.disk.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The total storage capacity of the disk."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return DiskLimit{noop.Int64UpDownCounter{}}, err @@ -1045,6 +1109,11 @@ type DiskMerged struct { metric.Int64Counter } +var newDiskMergedOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{operation}"), +} + // NewDiskMerged returns a new DiskMerged instrument. func NewDiskMerged( m metric.Meter, @@ -1055,12 +1124,15 @@ func NewDiskMerged( return DiskMerged{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskMergedOpts + } else { + opt = append(opt, newDiskMergedOpts...) + } + i, err := m.Int64Counter( "system.disk.merged", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{operation}"), - }, opt...)..., + opt..., ) if err != nil { return DiskMerged{noop.Int64Counter{}}, err @@ -1153,6 +1225,11 @@ type DiskOperationTime struct { metric.Float64Counter } +var newDiskOperationTimeOpts = []metric.Float64CounterOption{ + metric.WithDescription("Sum of the time each operation took to complete."), + metric.WithUnit("s"), +} + // NewDiskOperationTime returns a new DiskOperationTime instrument. func NewDiskOperationTime( m metric.Meter, @@ -1163,12 +1240,15 @@ func NewDiskOperationTime( return DiskOperationTime{noop.Float64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskOperationTimeOpts + } else { + opt = append(opt, newDiskOperationTimeOpts...) + } + i, err := m.Float64Counter( "system.disk.operation_time", - append([]metric.Float64CounterOption{ - metric.WithDescription("Sum of the time each operation took to complete."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return DiskOperationTime{noop.Float64Counter{}}, err @@ -1280,6 +1360,11 @@ type DiskOperations struct { metric.Int64Counter } +var newDiskOperationsOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{operation}"), +} + // NewDiskOperations returns a new DiskOperations instrument. func NewDiskOperations( m metric.Meter, @@ -1290,12 +1375,15 @@ func NewDiskOperations( return DiskOperations{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newDiskOperationsOpts + } else { + opt = append(opt, newDiskOperationsOpts...) + } + i, err := m.Int64Counter( "system.disk.operations", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{operation}"), - }, opt...)..., + opt..., ) if err != nil { return DiskOperations{noop.Int64Counter{}}, err @@ -1388,6 +1476,11 @@ type FilesystemLimit struct { metric.Int64UpDownCounter } +var newFilesystemLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The total storage capacity of the filesystem."), + metric.WithUnit("By"), +} + // NewFilesystemLimit returns a new FilesystemLimit instrument. func NewFilesystemLimit( m metric.Meter, @@ -1398,12 +1491,15 @@ func NewFilesystemLimit( return FilesystemLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newFilesystemLimitOpts + } else { + opt = append(opt, newFilesystemLimitOpts...) + } + i, err := m.Int64UpDownCounter( "system.filesystem.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The total storage capacity of the filesystem."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemLimit{noop.Int64UpDownCounter{}}, err @@ -1512,6 +1608,11 @@ type FilesystemUsage struct { metric.Int64UpDownCounter } +var newFilesystemUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Reports a filesystem's space usage across different states."), + metric.WithUnit("By"), +} + // NewFilesystemUsage returns a new FilesystemUsage instrument. func NewFilesystemUsage( m metric.Meter, @@ -1522,12 +1623,15 @@ func NewFilesystemUsage( return FilesystemUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newFilesystemUsageOpts + } else { + opt = append(opt, newFilesystemUsageOpts...) + } + i, err := m.Int64UpDownCounter( "system.filesystem.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Reports a filesystem's space usage across different states."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemUsage{noop.Int64UpDownCounter{}}, err @@ -1653,6 +1757,11 @@ type FilesystemUtilization struct { metric.Int64Gauge } +var newFilesystemUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("TODO."), + metric.WithUnit("1"), +} + // NewFilesystemUtilization returns a new FilesystemUtilization instrument. func NewFilesystemUtilization( m metric.Meter, @@ -1663,12 +1772,15 @@ func NewFilesystemUtilization( return FilesystemUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newFilesystemUtilizationOpts + } else { + opt = append(opt, newFilesystemUtilizationOpts...) + } + i, err := m.Int64Gauge( "system.filesystem.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("TODO."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return FilesystemUtilization{noop.Int64Gauge{}}, err @@ -1784,6 +1896,11 @@ type LinuxMemoryAvailable struct { metric.Int64UpDownCounter } +var newLinuxMemoryAvailableOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("An estimate of how much memory is available for starting new applications, without causing swapping."), + metric.WithUnit("By"), +} + // NewLinuxMemoryAvailable returns a new LinuxMemoryAvailable instrument. func NewLinuxMemoryAvailable( m metric.Meter, @@ -1794,12 +1911,15 @@ func NewLinuxMemoryAvailable( return LinuxMemoryAvailable{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newLinuxMemoryAvailableOpts + } else { + opt = append(opt, newLinuxMemoryAvailableOpts...) + } + i, err := m.Int64UpDownCounter( "system.linux.memory.available", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("An estimate of how much memory is available for starting new applications, without causing swapping."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return LinuxMemoryAvailable{noop.Int64UpDownCounter{}}, err @@ -1889,6 +2009,11 @@ type LinuxMemorySlabUsage struct { metric.Int64UpDownCounter } +var newLinuxMemorySlabUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Reports the memory used by the Linux kernel for managing caches of frequently used objects."), + metric.WithUnit("By"), +} + // NewLinuxMemorySlabUsage returns a new LinuxMemorySlabUsage instrument. func NewLinuxMemorySlabUsage( m metric.Meter, @@ -1899,12 +2024,15 @@ func NewLinuxMemorySlabUsage( return LinuxMemorySlabUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newLinuxMemorySlabUsageOpts + } else { + opt = append(opt, newLinuxMemorySlabUsageOpts...) + } + i, err := m.Int64UpDownCounter( "system.linux.memory.slab.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Reports the memory used by the Linux kernel for managing caches of frequently used objects."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return LinuxMemorySlabUsage{noop.Int64UpDownCounter{}}, err @@ -2010,6 +2138,11 @@ type MemoryLimit struct { metric.Int64UpDownCounter } +var newMemoryLimitOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Total virtual memory available in the system."), + metric.WithUnit("By"), +} + // NewMemoryLimit returns a new MemoryLimit instrument. func NewMemoryLimit( m metric.Meter, @@ -2020,12 +2153,15 @@ func NewMemoryLimit( return MemoryLimit{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryLimitOpts + } else { + opt = append(opt, newMemoryLimitOpts...) + } + i, err := m.Int64UpDownCounter( "system.memory.limit", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Total virtual memory available in the system."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryLimit{noop.Int64UpDownCounter{}}, err @@ -2094,6 +2230,11 @@ type MemoryShared struct { metric.Int64UpDownCounter } +var newMemorySharedOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Shared memory used (mostly by tmpfs)."), + metric.WithUnit("By"), +} + // NewMemoryShared returns a new MemoryShared instrument. func NewMemoryShared( m metric.Meter, @@ -2104,12 +2245,15 @@ func NewMemoryShared( return MemoryShared{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemorySharedOpts + } else { + opt = append(opt, newMemorySharedOpts...) + } + i, err := m.Int64UpDownCounter( "system.memory.shared", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Shared memory used (mostly by tmpfs)."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryShared{noop.Int64UpDownCounter{}}, err @@ -2190,6 +2334,11 @@ type MemoryUsage struct { metric.Int64ObservableUpDownCounter } +var newMemoryUsageOpts = []metric.Int64ObservableUpDownCounterOption{ + metric.WithDescription("Reports memory in use by state."), + metric.WithUnit("By"), +} + // NewMemoryUsage returns a new MemoryUsage instrument. func NewMemoryUsage( m metric.Meter, @@ -2200,12 +2349,15 @@ func NewMemoryUsage( return MemoryUsage{noop.Int64ObservableUpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newMemoryUsageOpts + } else { + opt = append(opt, newMemoryUsageOpts...) + } + i, err := m.Int64ObservableUpDownCounter( "system.memory.usage", - append([]metric.Int64ObservableUpDownCounterOption{ - metric.WithDescription("Reports memory in use by state."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return MemoryUsage{noop.Int64ObservableUpDownCounter{}}, err @@ -2245,6 +2397,11 @@ type MemoryUtilization struct { metric.Float64ObservableGauge } +var newMemoryUtilizationOpts = []metric.Float64ObservableGaugeOption{ + metric.WithDescription("TODO."), + metric.WithUnit("1"), +} + // NewMemoryUtilization returns a new MemoryUtilization instrument. func NewMemoryUtilization( m metric.Meter, @@ -2255,12 +2412,15 @@ func NewMemoryUtilization( return MemoryUtilization{noop.Float64ObservableGauge{}}, nil } + if len(opt) == 0 { + opt = newMemoryUtilizationOpts + } else { + opt = append(opt, newMemoryUtilizationOpts...) + } + i, err := m.Float64ObservableGauge( "system.memory.utilization", - append([]metric.Float64ObservableGaugeOption{ - metric.WithDescription("TODO."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return MemoryUtilization{noop.Float64ObservableGauge{}}, err @@ -2301,6 +2461,11 @@ type NetworkConnectionCount struct { metric.Int64UpDownCounter } +var newNetworkConnectionCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{connection}"), +} + // NewNetworkConnectionCount returns a new NetworkConnectionCount instrument. func NewNetworkConnectionCount( m metric.Meter, @@ -2311,12 +2476,15 @@ func NewNetworkConnectionCount( return NetworkConnectionCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newNetworkConnectionCountOpts + } else { + opt = append(opt, newNetworkConnectionCountOpts...) + } + i, err := m.Int64UpDownCounter( "system.network.connection.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{connection}"), - }, opt...)..., + opt..., ) if err != nil { return NetworkConnectionCount{noop.Int64UpDownCounter{}}, err @@ -2421,6 +2589,11 @@ type NetworkErrors struct { metric.Int64Counter } +var newNetworkErrorsOpts = []metric.Int64CounterOption{ + metric.WithDescription("Count of network errors detected."), + metric.WithUnit("{error}"), +} + // NewNetworkErrors returns a new NetworkErrors instrument. func NewNetworkErrors( m metric.Meter, @@ -2431,12 +2604,15 @@ func NewNetworkErrors( return NetworkErrors{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkErrorsOpts + } else { + opt = append(opt, newNetworkErrorsOpts...) + } + i, err := m.Int64Counter( "system.network.errors", - append([]metric.Int64CounterOption{ - metric.WithDescription("Count of network errors detected."), - metric.WithUnit("{error}"), - }, opt...)..., + opt..., ) if err != nil { return NetworkErrors{noop.Int64Counter{}}, err @@ -2552,6 +2728,11 @@ type NetworkIO struct { metric.Int64ObservableCounter } +var newNetworkIOOpts = []metric.Int64ObservableCounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("By"), +} + // NewNetworkIO returns a new NetworkIO instrument. func NewNetworkIO( m metric.Meter, @@ -2562,12 +2743,15 @@ func NewNetworkIO( return NetworkIO{noop.Int64ObservableCounter{}}, nil } + if len(opt) == 0 { + opt = newNetworkIOOpts + } else { + opt = append(opt, newNetworkIOOpts...) + } + i, err := m.Int64ObservableCounter( "system.network.io", - append([]metric.Int64ObservableCounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return NetworkIO{noop.Int64ObservableCounter{}}, err @@ -2616,6 +2800,11 @@ type NetworkPacketCount struct { metric.Int64Counter } +var newNetworkPacketCountOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{packet}"), +} + // NewNetworkPacketCount returns a new NetworkPacketCount instrument. func NewNetworkPacketCount( m metric.Meter, @@ -2626,12 +2815,15 @@ func NewNetworkPacketCount( return NetworkPacketCount{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkPacketCountOpts + } else { + opt = append(opt, newNetworkPacketCountOpts...) + } + i, err := m.Int64Counter( "system.network.packet.count", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{packet}"), - }, opt...)..., + opt..., ) if err != nil { return NetworkPacketCount{noop.Int64Counter{}}, err @@ -2725,6 +2917,11 @@ type NetworkPacketDropped struct { metric.Int64Counter } +var newNetworkPacketDroppedOpts = []metric.Int64CounterOption{ + metric.WithDescription("Count of packets that are dropped or discarded even though there was no error."), + metric.WithUnit("{packet}"), +} + // NewNetworkPacketDropped returns a new NetworkPacketDropped instrument. func NewNetworkPacketDropped( m metric.Meter, @@ -2735,12 +2932,15 @@ func NewNetworkPacketDropped( return NetworkPacketDropped{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newNetworkPacketDroppedOpts + } else { + opt = append(opt, newNetworkPacketDroppedOpts...) + } + i, err := m.Int64Counter( "system.network.packet.dropped", - append([]metric.Int64CounterOption{ - metric.WithDescription("Count of packets that are dropped or discarded even though there was no error."), - metric.WithUnit("{packet}"), - }, opt...)..., + opt..., ) if err != nil { return NetworkPacketDropped{noop.Int64Counter{}}, err @@ -2856,6 +3056,11 @@ type PagingFaults struct { metric.Int64Counter } +var newPagingFaultsOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{fault}"), +} + // NewPagingFaults returns a new PagingFaults instrument. func NewPagingFaults( m metric.Meter, @@ -2866,12 +3071,15 @@ func NewPagingFaults( return PagingFaults{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPagingFaultsOpts + } else { + opt = append(opt, newPagingFaultsOpts...) + } + i, err := m.Int64Counter( "system.paging.faults", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{fault}"), - }, opt...)..., + opt..., ) if err != nil { return PagingFaults{noop.Int64Counter{}}, err @@ -2957,6 +3165,11 @@ type PagingOperations struct { metric.Int64Counter } +var newPagingOperationsOpts = []metric.Int64CounterOption{ + metric.WithDescription("TODO."), + metric.WithUnit("{operation}"), +} + // NewPagingOperations returns a new PagingOperations instrument. func NewPagingOperations( m metric.Meter, @@ -2967,12 +3180,15 @@ func NewPagingOperations( return PagingOperations{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newPagingOperationsOpts + } else { + opt = append(opt, newPagingOperationsOpts...) + } + i, err := m.Int64Counter( "system.paging.operations", - append([]metric.Int64CounterOption{ - metric.WithDescription("TODO."), - metric.WithUnit("{operation}"), - }, opt...)..., + opt..., ) if err != nil { return PagingOperations{noop.Int64Counter{}}, err @@ -3066,6 +3282,11 @@ type PagingUsage struct { metric.Int64UpDownCounter } +var newPagingUsageOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Unix swap or windows pagefile usage."), + metric.WithUnit("By"), +} + // NewPagingUsage returns a new PagingUsage instrument. func NewPagingUsage( m metric.Meter, @@ -3076,12 +3297,15 @@ func NewPagingUsage( return PagingUsage{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newPagingUsageOpts + } else { + opt = append(opt, newPagingUsageOpts...) + } + i, err := m.Int64UpDownCounter( "system.paging.usage", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Unix swap or windows pagefile usage."), - metric.WithUnit("By"), - }, opt...)..., + opt..., ) if err != nil { return PagingUsage{noop.Int64UpDownCounter{}}, err @@ -3174,6 +3398,11 @@ type PagingUtilization struct { metric.Int64Gauge } +var newPagingUtilizationOpts = []metric.Int64GaugeOption{ + metric.WithDescription("TODO."), + metric.WithUnit("1"), +} + // NewPagingUtilization returns a new PagingUtilization instrument. func NewPagingUtilization( m metric.Meter, @@ -3184,12 +3413,15 @@ func NewPagingUtilization( return PagingUtilization{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newPagingUtilizationOpts + } else { + opt = append(opt, newPagingUtilizationOpts...) + } + i, err := m.Int64Gauge( "system.paging.utilization", - append([]metric.Int64GaugeOption{ - metric.WithDescription("TODO."), - metric.WithUnit("1"), - }, opt...)..., + opt..., ) if err != nil { return PagingUtilization{noop.Int64Gauge{}}, err @@ -3282,6 +3514,11 @@ type ProcessCount struct { metric.Int64UpDownCounter } +var newProcessCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Total number of processes in each state."), + metric.WithUnit("{process}"), +} + // NewProcessCount returns a new ProcessCount instrument. func NewProcessCount( m metric.Meter, @@ -3292,12 +3529,15 @@ func NewProcessCount( return ProcessCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newProcessCountOpts + } else { + opt = append(opt, newProcessCountOpts...) + } + i, err := m.Int64UpDownCounter( "system.process.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("Total number of processes in each state."), - metric.WithUnit("{process}"), - }, opt...)..., + opt..., ) if err != nil { return ProcessCount{noop.Int64UpDownCounter{}}, err @@ -3387,6 +3627,11 @@ type ProcessCreated struct { metric.Int64Counter } +var newProcessCreatedOpts = []metric.Int64CounterOption{ + metric.WithDescription("Total number of processes created over uptime of the host."), + metric.WithUnit("{process}"), +} + // NewProcessCreated returns a new ProcessCreated instrument. func NewProcessCreated( m metric.Meter, @@ -3397,12 +3642,15 @@ func NewProcessCreated( return ProcessCreated{noop.Int64Counter{}}, nil } + if len(opt) == 0 { + opt = newProcessCreatedOpts + } else { + opt = append(opt, newProcessCreatedOpts...) + } + i, err := m.Int64Counter( "system.process.created", - append([]metric.Int64CounterOption{ - metric.WithDescription("Total number of processes created over uptime of the host."), - metric.WithUnit("{process}"), - }, opt...)..., + opt..., ) if err != nil { return ProcessCreated{noop.Int64Counter{}}, err @@ -3471,6 +3719,11 @@ type Uptime struct { metric.Float64Gauge } +var newUptimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time the system has been running."), + metric.WithUnit("s"), +} + // NewUptime returns a new Uptime instrument. func NewUptime( m metric.Meter, @@ -3481,12 +3734,15 @@ func NewUptime( return Uptime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newUptimeOpts + } else { + opt = append(opt, newUptimeOpts...) + } + i, err := m.Float64Gauge( "system.uptime", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time the system has been running."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return Uptime{noop.Float64Gauge{}}, err diff --git a/semconv/v1.37.0/vcsconv/metric.go b/semconv/v1.37.0/vcsconv/metric.go index a8c99213d..61c69b467 100644 --- a/semconv/v1.37.0/vcsconv/metric.go +++ b/semconv/v1.37.0/vcsconv/metric.go @@ -153,6 +153,11 @@ type ChangeCount struct { metric.Int64UpDownCounter } +var newChangeCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)."), + metric.WithUnit("{change}"), +} + // NewChangeCount returns a new ChangeCount instrument. func NewChangeCount( m metric.Meter, @@ -163,12 +168,15 @@ func NewChangeCount( return ChangeCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newChangeCountOpts + } else { + opt = append(opt, newChangeCountOpts...) + } + i, err := m.Int64UpDownCounter( "vcs.change.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)."), - metric.WithUnit("{change}"), - }, opt...)..., + opt..., ) if err != nil { return ChangeCount{noop.Int64UpDownCounter{}}, err @@ -285,6 +293,11 @@ type ChangeDuration struct { metric.Float64Gauge } +var newChangeDurationOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The time duration a change (pull request/merge request/changelist) has been in a given state."), + metric.WithUnit("s"), +} + // NewChangeDuration returns a new ChangeDuration instrument. func NewChangeDuration( m metric.Meter, @@ -295,12 +308,15 @@ func NewChangeDuration( return ChangeDuration{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newChangeDurationOpts + } else { + opt = append(opt, newChangeDurationOpts...) + } + i, err := m.Float64Gauge( "vcs.change.duration", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The time duration a change (pull request/merge request/changelist) has been in a given state."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ChangeDuration{noop.Float64Gauge{}}, err @@ -423,6 +439,11 @@ type ChangeTimeToApproval struct { metric.Float64Gauge } +var newChangeTimeToApprovalOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval."), + metric.WithUnit("s"), +} + // NewChangeTimeToApproval returns a new ChangeTimeToApproval instrument. func NewChangeTimeToApproval( m metric.Meter, @@ -433,12 +454,15 @@ func NewChangeTimeToApproval( return ChangeTimeToApproval{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newChangeTimeToApprovalOpts + } else { + opt = append(opt, newChangeTimeToApprovalOpts...) + } + i, err := m.Float64Gauge( "vcs.change.time_to_approval", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ChangeTimeToApproval{noop.Float64Gauge{}}, err @@ -585,6 +609,11 @@ type ChangeTimeToMerge struct { metric.Float64Gauge } +var newChangeTimeToMergeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref."), + metric.WithUnit("s"), +} + // NewChangeTimeToMerge returns a new ChangeTimeToMerge instrument. func NewChangeTimeToMerge( m metric.Meter, @@ -595,12 +624,15 @@ func NewChangeTimeToMerge( return ChangeTimeToMerge{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newChangeTimeToMergeOpts + } else { + opt = append(opt, newChangeTimeToMergeOpts...) + } + i, err := m.Float64Gauge( "vcs.change.time_to_merge", - append([]metric.Float64GaugeOption{ - metric.WithDescription("The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return ChangeTimeToMerge{noop.Float64Gauge{}}, err @@ -746,6 +778,11 @@ type ContributorCount struct { metric.Int64Gauge } +var newContributorCountOpts = []metric.Int64GaugeOption{ + metric.WithDescription("The number of unique contributors to a repository."), + metric.WithUnit("{contributor}"), +} + // NewContributorCount returns a new ContributorCount instrument. func NewContributorCount( m metric.Meter, @@ -756,12 +793,15 @@ func NewContributorCount( return ContributorCount{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newContributorCountOpts + } else { + opt = append(opt, newContributorCountOpts...) + } + i, err := m.Int64Gauge( "vcs.contributor.count", - append([]metric.Int64GaugeOption{ - metric.WithDescription("The number of unique contributors to a repository."), - metric.WithUnit("{contributor}"), - }, opt...)..., + opt..., ) if err != nil { return ContributorCount{noop.Int64Gauge{}}, err @@ -872,6 +912,11 @@ type RefCount struct { metric.Int64UpDownCounter } +var newRefCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of refs of type branch or tag in a repository."), + metric.WithUnit("{ref}"), +} + // NewRefCount returns a new RefCount instrument. func NewRefCount( m metric.Meter, @@ -882,12 +927,15 @@ func NewRefCount( return RefCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newRefCountOpts + } else { + opt = append(opt, newRefCountOpts...) + } + i, err := m.Int64UpDownCounter( "vcs.ref.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of refs of type branch or tag in a repository."), - metric.WithUnit("{ref}"), - }, opt...)..., + opt..., ) if err != nil { return RefCount{noop.Int64UpDownCounter{}}, err @@ -1005,6 +1053,11 @@ type RefLinesDelta struct { metric.Int64Gauge } +var newRefLinesDeltaOpts = []metric.Int64GaugeOption{ + metric.WithDescription("The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute."), + metric.WithUnit("{line}"), +} + // NewRefLinesDelta returns a new RefLinesDelta instrument. func NewRefLinesDelta( m metric.Meter, @@ -1015,12 +1068,15 @@ func NewRefLinesDelta( return RefLinesDelta{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newRefLinesDeltaOpts + } else { + opt = append(opt, newRefLinesDeltaOpts...) + } + i, err := m.Int64Gauge( "vcs.ref.lines_delta", - append([]metric.Int64GaugeOption{ - metric.WithDescription("The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute."), - metric.WithUnit("{line}"), - }, opt...)..., + opt..., ) if err != nil { return RefLinesDelta{noop.Int64Gauge{}}, err @@ -1181,6 +1237,11 @@ type RefRevisionsDelta struct { metric.Int64Gauge } +var newRefRevisionsDeltaOpts = []metric.Int64GaugeOption{ + metric.WithDescription("The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute."), + metric.WithUnit("{revision}"), +} + // NewRefRevisionsDelta returns a new RefRevisionsDelta instrument. func NewRefRevisionsDelta( m metric.Meter, @@ -1191,12 +1252,15 @@ func NewRefRevisionsDelta( return RefRevisionsDelta{noop.Int64Gauge{}}, nil } + if len(opt) == 0 { + opt = newRefRevisionsDeltaOpts + } else { + opt = append(opt, newRefRevisionsDeltaOpts...) + } + i, err := m.Int64Gauge( "vcs.ref.revisions_delta", - append([]metric.Int64GaugeOption{ - metric.WithDescription("The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute."), - metric.WithUnit("{revision}"), - }, opt...)..., + opt..., ) if err != nil { return RefRevisionsDelta{noop.Int64Gauge{}}, err @@ -1352,6 +1416,11 @@ type RefTime struct { metric.Float64Gauge } +var newRefTimeOpts = []metric.Float64GaugeOption{ + metric.WithDescription("Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`."), + metric.WithUnit("s"), +} + // NewRefTime returns a new RefTime instrument. func NewRefTime( m metric.Meter, @@ -1362,12 +1431,15 @@ func NewRefTime( return RefTime{noop.Float64Gauge{}}, nil } + if len(opt) == 0 { + opt = newRefTimeOpts + } else { + opt = append(opt, newRefTimeOpts...) + } + i, err := m.Float64Gauge( "vcs.ref.time", - append([]metric.Float64GaugeOption{ - metric.WithDescription("Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`."), - metric.WithUnit("s"), - }, opt...)..., + opt..., ) if err != nil { return RefTime{noop.Float64Gauge{}}, err @@ -1489,6 +1561,11 @@ type RepositoryCount struct { metric.Int64UpDownCounter } +var newRepositoryCountOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("The number of repositories in an organization."), + metric.WithUnit("{repository}"), +} + // NewRepositoryCount returns a new RepositoryCount instrument. func NewRepositoryCount( m metric.Meter, @@ -1499,12 +1576,15 @@ func NewRepositoryCount( return RepositoryCount{noop.Int64UpDownCounter{}}, nil } + if len(opt) == 0 { + opt = newRepositoryCountOpts + } else { + opt = append(opt, newRepositoryCountOpts...) + } + i, err := m.Int64UpDownCounter( "vcs.repository.count", - append([]metric.Int64UpDownCounterOption{ - metric.WithDescription("The number of repositories in an organization."), - metric.WithUnit("{repository}"), - }, opt...)..., + opt..., ) if err != nil { return RepositoryCount{noop.Int64UpDownCounter{}}, err