Debian Codegraph @

semconv/v1.38.0/k8sconv/metric.go

raw
1 // Code generated from semantic convention specification. DO NOT EDIT.
2
3 // Copyright The OpenTelemetry Authors
4 // SPDX-License-Identifier: Apache-2.0
5
6 // Package k8sconv provides types and functionality for OpenTelemetry semantic
7 // conventions in the "k8s" namespace.
8 package k8sconv
9
10 import (
11 "context"
12 "sync"
13
14 "go.opentelemetry.io/otel/attribute"
15 "go.opentelemetry.io/otel/metric"
16 "go.opentelemetry.io/otel/metric/noop"
17 )
18
19 var (
20 addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }}
21 recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }}
22 )
23
24 // ContainerStatusReasonAttr is an attribute conforming to the
25 // k8s.container.status.reason semantic conventions. It represents the reason for
26 // the container state. Corresponds to the `reason` field of the:
27 // [K8s ContainerStateWaiting] or [K8s ContainerStateTerminated].
28 //
29 // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core
30 // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core
31 type ContainerStatusReasonAttr string
32
33 var (
34 // ContainerStatusReasonContainerCreating is the container is being created.
35 ContainerStatusReasonContainerCreating ContainerStatusReasonAttr = "ContainerCreating"
36 // ContainerStatusReasonCrashLoopBackOff is the container is in a crash loop
37 // back off state.
38 ContainerStatusReasonCrashLoopBackOff ContainerStatusReasonAttr = "CrashLoopBackOff"
39 // ContainerStatusReasonCreateContainerConfigError is the there was an error
40 // creating the container configuration.
41 ContainerStatusReasonCreateContainerConfigError ContainerStatusReasonAttr = "CreateContainerConfigError"
42 // ContainerStatusReasonErrImagePull is the there was an error pulling the
43 // container image.
44 ContainerStatusReasonErrImagePull ContainerStatusReasonAttr = "ErrImagePull"
45 // ContainerStatusReasonImagePullBackOff is the container image pull is in back
46 // off state.
47 ContainerStatusReasonImagePullBackOff ContainerStatusReasonAttr = "ImagePullBackOff"
48 // ContainerStatusReasonOomKilled is the container was killed due to out of
49 // memory.
50 ContainerStatusReasonOomKilled ContainerStatusReasonAttr = "OOMKilled"
51 // ContainerStatusReasonCompleted is the container has completed execution.
52 ContainerStatusReasonCompleted ContainerStatusReasonAttr = "Completed"
53 // ContainerStatusReasonError is the there was an error with the container.
54 ContainerStatusReasonError ContainerStatusReasonAttr = "Error"
55 // ContainerStatusReasonContainerCannotRun is the container cannot run.
56 ContainerStatusReasonContainerCannotRun ContainerStatusReasonAttr = "ContainerCannotRun"
57 )
58
59 // ContainerStatusStateAttr is an attribute conforming to the
60 // k8s.container.status.state semantic conventions. It represents the state of
61 // the container. [K8s ContainerState].
62 //
63 // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core
64 type ContainerStatusStateAttr string
65
66 var (
67 // ContainerStatusStateTerminated is the container has terminated.
68 ContainerStatusStateTerminated ContainerStatusStateAttr = "terminated"
69 // ContainerStatusStateRunning is the container is running.
70 ContainerStatusStateRunning ContainerStatusStateAttr = "running"
71 // ContainerStatusStateWaiting is the container is waiting.
72 ContainerStatusStateWaiting ContainerStatusStateAttr = "waiting"
73 )
74
75 // NamespacePhaseAttr is an attribute conforming to the k8s.namespace.phase
76 // semantic conventions. It represents the phase of the K8s namespace.
77 type NamespacePhaseAttr string
78
79 var (
80 // NamespacePhaseActive is the active namespace phase as described by [K8s API]
81 // .
82 //
83 // [K8s API]: https://pkg.go.dev/k8s.io/[email protected]/core/v1#NamespacePhase
84 NamespacePhaseActive NamespacePhaseAttr = "active"
85 // NamespacePhaseTerminating is the terminating namespace phase as described by
86 // [K8s API].
87 //
88 // [K8s API]: https://pkg.go.dev/k8s.io/[email protected]/core/v1#NamespacePhase
89 NamespacePhaseTerminating NamespacePhaseAttr = "terminating"
90 )
91
92 // NodeConditionStatusAttr is an attribute conforming to the
93 // k8s.node.condition.status semantic conventions. It represents the status of
94 // the condition, one of True, False, Unknown.
95 type NodeConditionStatusAttr string
96
97 var (
98 // NodeConditionStatusConditionTrue is the standardized value "true" of
99 // NodeConditionStatusAttr.
100 NodeConditionStatusConditionTrue NodeConditionStatusAttr = "true"
101 // NodeConditionStatusConditionFalse is the standardized value "false" of
102 // NodeConditionStatusAttr.
103 NodeConditionStatusConditionFalse NodeConditionStatusAttr = "false"
104 // NodeConditionStatusConditionUnknown is the standardized value "unknown" of
105 // NodeConditionStatusAttr.
106 NodeConditionStatusConditionUnknown NodeConditionStatusAttr = "unknown"
107 )
108
109 // NodeConditionTypeAttr is an attribute conforming to the
110 // k8s.node.condition.type semantic conventions. It represents the condition type
111 // of a K8s Node.
112 type NodeConditionTypeAttr string
113
114 var (
115 // NodeConditionTypeReady is the node is healthy and ready to accept pods.
116 NodeConditionTypeReady NodeConditionTypeAttr = "Ready"
117 // NodeConditionTypeDiskPressure is the pressure exists on the disk size—that
118 // is, if the disk capacity is low.
119 NodeConditionTypeDiskPressure NodeConditionTypeAttr = "DiskPressure"
120 // NodeConditionTypeMemoryPressure is the pressure exists on the node
121 // memory—that is, if the node memory is low.
122 NodeConditionTypeMemoryPressure NodeConditionTypeAttr = "MemoryPressure"
123 // NodeConditionTypePIDPressure is the pressure exists on the processes—that
124 // is, if there are too many processes on the node.
125 NodeConditionTypePIDPressure NodeConditionTypeAttr = "PIDPressure"
126 // NodeConditionTypeNetworkUnavailable is the network for the node is not
127 // correctly configured.
128 NodeConditionTypeNetworkUnavailable NodeConditionTypeAttr = "NetworkUnavailable"
129 )
130
131 // PodStatusPhaseAttr is an attribute conforming to the k8s.pod.status.phase
132 // semantic conventions. It represents the phase for the pod. Corresponds to the
133 // `phase` field of the: [K8s PodStatus].
134 //
135 // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core
136 type PodStatusPhaseAttr string
137
138 var (
139 // PodStatusPhasePending is the pod has been accepted by the system, but one or
140 // more of the containers has not been started. This includes time before being
141 // bound to a node, as well as time spent pulling images onto the host.
142 PodStatusPhasePending PodStatusPhaseAttr = "Pending"
143 // PodStatusPhaseRunning is the pod has been bound to a node and all of the
144 // containers have been started. At least one container is still running or is
145 // in the process of being restarted.
146 PodStatusPhaseRunning PodStatusPhaseAttr = "Running"
147 // PodStatusPhaseSucceeded is the all containers in the pod have voluntarily
148 // terminated with a container exit code of 0, and the system is not going to
149 // restart any of these containers.
150 PodStatusPhaseSucceeded PodStatusPhaseAttr = "Succeeded"
151 // PodStatusPhaseFailed is the all containers in the pod have terminated, and at
152 // least one container has terminated in a failure (exited with a non-zero exit
153 // code or was stopped by the system).
154 PodStatusPhaseFailed PodStatusPhaseAttr = "Failed"
155 // PodStatusPhaseUnknown is the for some reason the state of the pod could not
156 // be obtained, typically due to an error in communicating with the host of the
157 // pod.
158 PodStatusPhaseUnknown PodStatusPhaseAttr = "Unknown"
159 )
160
161 // PodStatusReasonAttr is an attribute conforming to the k8s.pod.status.reason
162 // semantic conventions. It represents the reason for the pod state. Corresponds
163 // to the `reason` field of the: [K8s PodStatus].
164 //
165 // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core
166 type PodStatusReasonAttr string
167
168 var (
169 // PodStatusReasonEvicted is the pod is evicted.
170 PodStatusReasonEvicted PodStatusReasonAttr = "Evicted"
171 // PodStatusReasonNodeAffinity is the pod is in a status because of its node
172 // affinity.
173 PodStatusReasonNodeAffinity PodStatusReasonAttr = "NodeAffinity"
174 // PodStatusReasonNodeLost is the reason on a pod when its state cannot be
175 // confirmed as kubelet is unresponsive on the node it is (was) running.
176 PodStatusReasonNodeLost PodStatusReasonAttr = "NodeLost"
177 // PodStatusReasonShutdown is the node is shutdown.
178 PodStatusReasonShutdown PodStatusReasonAttr = "Shutdown"
179 // PodStatusReasonUnexpectedAdmissionError is the pod was rejected admission to
180 // the node because of an error during admission that could not be categorized.
181 PodStatusReasonUnexpectedAdmissionError PodStatusReasonAttr = "UnexpectedAdmissionError"
182 )
183
184 // VolumeTypeAttr is an attribute conforming to the k8s.volume.type semantic
185 // conventions. It represents the type of the K8s volume.
186 type VolumeTypeAttr string
187
188 var (
189 // VolumeTypePersistentVolumeClaim is a [persistentVolumeClaim] volume.
190 //
191 // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim
192 VolumeTypePersistentVolumeClaim VolumeTypeAttr = "persistentVolumeClaim"
193 // VolumeTypeConfigMap is a [configMap] volume.
194 //
195 // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap
196 VolumeTypeConfigMap VolumeTypeAttr = "configMap"
197 // VolumeTypeDownwardAPI is a [downwardAPI] volume.
198 //
199 // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi
200 VolumeTypeDownwardAPI VolumeTypeAttr = "downwardAPI"
201 // VolumeTypeEmptyDir is an [emptyDir] volume.
202 //
203 // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir
204 VolumeTypeEmptyDir VolumeTypeAttr = "emptyDir"
205 // VolumeTypeSecret is a [secret] volume.
206 //
207 // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret
208 VolumeTypeSecret VolumeTypeAttr = "secret"
209 // VolumeTypeLocal is a [local] volume.
210 //
211 // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local
212 VolumeTypeLocal VolumeTypeAttr = "local"
213 )
214
215 // NetworkIODirectionAttr is an attribute conforming to the network.io.direction
216 // semantic conventions. It represents the network IO operation direction.
217 type NetworkIODirectionAttr string
218
219 var (
220 // NetworkIODirectionTransmit is the standardized value "transmit" of
221 // NetworkIODirectionAttr.
222 NetworkIODirectionTransmit NetworkIODirectionAttr = "transmit"
223 // NetworkIODirectionReceive is the standardized value "receive" of
224 // NetworkIODirectionAttr.
225 NetworkIODirectionReceive NetworkIODirectionAttr = "receive"
226 )
227
228 // SystemPagingFaultTypeAttr is an attribute conforming to the
229 // system.paging.fault.type semantic conventions. It represents the paging fault
230 // type.
231 type SystemPagingFaultTypeAttr string
232
233 var (
234 // SystemPagingFaultTypeMajor is the standardized value "major" of
235 // SystemPagingFaultTypeAttr.
236 SystemPagingFaultTypeMajor SystemPagingFaultTypeAttr = "major"
237 // SystemPagingFaultTypeMinor is the standardized value "minor" of
238 // SystemPagingFaultTypeAttr.
239 SystemPagingFaultTypeMinor SystemPagingFaultTypeAttr = "minor"
240 )
241
242 // ContainerCPULimit is an instrument used to record metric values conforming to
243 // the "k8s.container.cpu.limit" semantic conventions. It represents the maximum
244 // CPU resource limit set for the container.
245 type ContainerCPULimit struct {
246 metric.Int64UpDownCounter
247 }
248
249 var newContainerCPULimitOpts = []metric.Int64UpDownCounterOption{
250 metric.WithDescription("Maximum CPU resource limit set for the container."),
251 metric.WithUnit("{cpu}"),
252 }
253
254 // NewContainerCPULimit returns a new ContainerCPULimit instrument.
255 func NewContainerCPULimit(
256 m metric.Meter,
257 opt ...metric.Int64UpDownCounterOption,
258 ) (ContainerCPULimit, error) {
259 // Check if the meter is nil.
260 if m == nil {
261 return ContainerCPULimit{noop.Int64UpDownCounter{}}, nil
262 }
263
264 if len(opt) == 0 {
265 opt = newContainerCPULimitOpts
266 } else {
267 opt = append(opt, newContainerCPULimitOpts...)
268 }
269
270 i, err := m.Int64UpDownCounter(
271 "k8s.container.cpu.limit",
272 opt...,
273 )
274 if err != nil {
275 return ContainerCPULimit{noop.Int64UpDownCounter{}}, err
276 }
277 return ContainerCPULimit{i}, nil
278 }
279
280 // Inst returns the underlying metric instrument.
281 func (m ContainerCPULimit) Inst() metric.Int64UpDownCounter {
282 return m.Int64UpDownCounter
283 }
284
285 // Name returns the semantic convention name of the instrument.
286 func (ContainerCPULimit) Name() string {
287 return "k8s.container.cpu.limit"
288 }
289
290 // Unit returns the semantic convention unit of the instrument
291 func (ContainerCPULimit) Unit() string {
292 return "{cpu}"
293 }
294
295 // Description returns the semantic convention description of the instrument
296 func (ContainerCPULimit) Description() string {
297 return "Maximum CPU resource limit set for the container."
298 }
299
300 // Add adds incr to the existing count for attrs.
301 //
302 // See
303 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
304 // for details.
305 func (m ContainerCPULimit) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
306 if len(attrs) == 0 {
307 m.Int64UpDownCounter.Add(ctx, incr)
308 return
309 }
310
311 o := addOptPool.Get().(*[]metric.AddOption)
312 defer func() {
313 *o = (*o)[:0]
314 addOptPool.Put(o)
315 }()
316
317 *o = append(*o, metric.WithAttributes(attrs...))
318 m.Int64UpDownCounter.Add(ctx, incr, *o...)
319 }
320
321 // AddSet adds incr to the existing count for set.
322 //
323 // See
324 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
325 // for details.
326 func (m ContainerCPULimit) AddSet(ctx context.Context, incr int64, set attribute.Set) {
327 if set.Len() == 0 {
328 m.Int64UpDownCounter.Add(ctx, incr)
329 return
330 }
331
332 o := addOptPool.Get().(*[]metric.AddOption)
333 defer func() {
334 *o = (*o)[:0]
335 addOptPool.Put(o)
336 }()
337
338 *o = append(*o, metric.WithAttributeSet(set))
339 m.Int64UpDownCounter.Add(ctx, incr, *o...)
340 }
341
342 // ContainerCPULimitUtilization is an instrument used to record metric values
343 // conforming to the "k8s.container.cpu.limit_utilization" semantic conventions.
344 // It represents the ratio of container CPU usage to its CPU limit.
345 type ContainerCPULimitUtilization struct {
346 metric.Int64Gauge
347 }
348
349 var newContainerCPULimitUtilizationOpts = []metric.Int64GaugeOption{
350 metric.WithDescription("The ratio of container CPU usage to its CPU limit."),
351 metric.WithUnit("1"),
352 }
353
354 // NewContainerCPULimitUtilization returns a new ContainerCPULimitUtilization
355 // instrument.
356 func NewContainerCPULimitUtilization(
357 m metric.Meter,
358 opt ...metric.Int64GaugeOption,
359 ) (ContainerCPULimitUtilization, error) {
360 // Check if the meter is nil.
361 if m == nil {
362 return ContainerCPULimitUtilization{noop.Int64Gauge{}}, nil
363 }
364
365 if len(opt) == 0 {
366 opt = newContainerCPULimitUtilizationOpts
367 } else {
368 opt = append(opt, newContainerCPULimitUtilizationOpts...)
369 }
370
371 i, err := m.Int64Gauge(
372 "k8s.container.cpu.limit_utilization",
373 opt...,
374 )
375 if err != nil {
376 return ContainerCPULimitUtilization{noop.Int64Gauge{}}, err
377 }
378 return ContainerCPULimitUtilization{i}, nil
379 }
380
381 // Inst returns the underlying metric instrument.
382 func (m ContainerCPULimitUtilization) Inst() metric.Int64Gauge {
383 return m.Int64Gauge
384 }
385
386 // Name returns the semantic convention name of the instrument.
387 func (ContainerCPULimitUtilization) Name() string {
388 return "k8s.container.cpu.limit_utilization"
389 }
390
391 // Unit returns the semantic convention unit of the instrument
392 func (ContainerCPULimitUtilization) Unit() string {
393 return "1"
394 }
395
396 // Description returns the semantic convention description of the instrument
397 func (ContainerCPULimitUtilization) Description() string {
398 return "The ratio of container CPU usage to its CPU limit."
399 }
400
401 // Record records val to the current distribution for attrs.
402 //
403 // The value range is [0.0,1.0]. A value of 1.0 means the container is using 100%
404 // of its CPU limit. If the CPU limit is not set, this metric SHOULD NOT be
405 // emitted for that container.
406 func (m ContainerCPULimitUtilization) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
407 if len(attrs) == 0 {
408 m.Int64Gauge.Record(ctx, val)
409 return
410 }
411
412 o := recOptPool.Get().(*[]metric.RecordOption)
413 defer func() {
414 *o = (*o)[:0]
415 recOptPool.Put(o)
416 }()
417
418 *o = append(*o, metric.WithAttributes(attrs...))
419 m.Int64Gauge.Record(ctx, val, *o...)
420 }
421
422 // RecordSet records val to the current distribution for set.
423 //
424 // The value range is [0.0,1.0]. A value of 1.0 means the container is using 100%
425 // of its CPU limit. If the CPU limit is not set, this metric SHOULD NOT be
426 // emitted for that container.
427 func (m ContainerCPULimitUtilization) RecordSet(ctx context.Context, val int64, set attribute.Set) {
428 if set.Len() == 0 {
429 m.Int64Gauge.Record(ctx, val)
430 return
431 }
432
433 o := recOptPool.Get().(*[]metric.RecordOption)
434 defer func() {
435 *o = (*o)[:0]
436 recOptPool.Put(o)
437 }()
438
439 *o = append(*o, metric.WithAttributeSet(set))
440 m.Int64Gauge.Record(ctx, val, *o...)
441 }
442
443 // ContainerCPURequest is an instrument used to record metric values conforming
444 // to the "k8s.container.cpu.request" semantic conventions. It represents the CPU
445 // resource requested for the container.
446 type ContainerCPURequest struct {
447 metric.Int64UpDownCounter
448 }
449
450 var newContainerCPURequestOpts = []metric.Int64UpDownCounterOption{
451 metric.WithDescription("CPU resource requested for the container."),
452 metric.WithUnit("{cpu}"),
453 }
454
455 // NewContainerCPURequest returns a new ContainerCPURequest instrument.
456 func NewContainerCPURequest(
457 m metric.Meter,
458 opt ...metric.Int64UpDownCounterOption,
459 ) (ContainerCPURequest, error) {
460 // Check if the meter is nil.
461 if m == nil {
462 return ContainerCPURequest{noop.Int64UpDownCounter{}}, nil
463 }
464
465 if len(opt) == 0 {
466 opt = newContainerCPURequestOpts
467 } else {
468 opt = append(opt, newContainerCPURequestOpts...)
469 }
470
471 i, err := m.Int64UpDownCounter(
472 "k8s.container.cpu.request",
473 opt...,
474 )
475 if err != nil {
476 return ContainerCPURequest{noop.Int64UpDownCounter{}}, err
477 }
478 return ContainerCPURequest{i}, nil
479 }
480
481 // Inst returns the underlying metric instrument.
482 func (m ContainerCPURequest) Inst() metric.Int64UpDownCounter {
483 return m.Int64UpDownCounter
484 }
485
486 // Name returns the semantic convention name of the instrument.
487 func (ContainerCPURequest) Name() string {
488 return "k8s.container.cpu.request"
489 }
490
491 // Unit returns the semantic convention unit of the instrument
492 func (ContainerCPURequest) Unit() string {
493 return "{cpu}"
494 }
495
496 // Description returns the semantic convention description of the instrument
497 func (ContainerCPURequest) Description() string {
498 return "CPU resource requested for the container."
499 }
500
501 // Add adds incr to the existing count for attrs.
502 //
503 // See
504 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
505 // for details.
506 func (m ContainerCPURequest) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
507 if len(attrs) == 0 {
508 m.Int64UpDownCounter.Add(ctx, incr)
509 return
510 }
511
512 o := addOptPool.Get().(*[]metric.AddOption)
513 defer func() {
514 *o = (*o)[:0]
515 addOptPool.Put(o)
516 }()
517
518 *o = append(*o, metric.WithAttributes(attrs...))
519 m.Int64UpDownCounter.Add(ctx, incr, *o...)
520 }
521
522 // AddSet adds incr to the existing count for set.
523 //
524 // See
525 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
526 // for details.
527 func (m ContainerCPURequest) AddSet(ctx context.Context, incr int64, set attribute.Set) {
528 if set.Len() == 0 {
529 m.Int64UpDownCounter.Add(ctx, incr)
530 return
531 }
532
533 o := addOptPool.Get().(*[]metric.AddOption)
534 defer func() {
535 *o = (*o)[:0]
536 addOptPool.Put(o)
537 }()
538
539 *o = append(*o, metric.WithAttributeSet(set))
540 m.Int64UpDownCounter.Add(ctx, incr, *o...)
541 }
542
543 // ContainerCPURequestUtilization is an instrument used to record metric values
544 // conforming to the "k8s.container.cpu.request_utilization" semantic
545 // conventions. It represents the ratio of container CPU usage to its CPU
546 // request.
547 type ContainerCPURequestUtilization struct {
548 metric.Int64Gauge
549 }
550
551 var newContainerCPURequestUtilizationOpts = []metric.Int64GaugeOption{
552 metric.WithDescription("The ratio of container CPU usage to its CPU request."),
553 metric.WithUnit("1"),
554 }
555
556 // NewContainerCPURequestUtilization returns a new ContainerCPURequestUtilization
557 // instrument.
558 func NewContainerCPURequestUtilization(
559 m metric.Meter,
560 opt ...metric.Int64GaugeOption,
561 ) (ContainerCPURequestUtilization, error) {
562 // Check if the meter is nil.
563 if m == nil {
564 return ContainerCPURequestUtilization{noop.Int64Gauge{}}, nil
565 }
566
567 if len(opt) == 0 {
568 opt = newContainerCPURequestUtilizationOpts
569 } else {
570 opt = append(opt, newContainerCPURequestUtilizationOpts...)
571 }
572
573 i, err := m.Int64Gauge(
574 "k8s.container.cpu.request_utilization",
575 opt...,
576 )
577 if err != nil {
578 return ContainerCPURequestUtilization{noop.Int64Gauge{}}, err
579 }
580 return ContainerCPURequestUtilization{i}, nil
581 }
582
583 // Inst returns the underlying metric instrument.
584 func (m ContainerCPURequestUtilization) Inst() metric.Int64Gauge {
585 return m.Int64Gauge
586 }
587
588 // Name returns the semantic convention name of the instrument.
589 func (ContainerCPURequestUtilization) Name() string {
590 return "k8s.container.cpu.request_utilization"
591 }
592
593 // Unit returns the semantic convention unit of the instrument
594 func (ContainerCPURequestUtilization) Unit() string {
595 return "1"
596 }
597
598 // Description returns the semantic convention description of the instrument
599 func (ContainerCPURequestUtilization) Description() string {
600 return "The ratio of container CPU usage to its CPU request."
601 }
602
603 // Record records val to the current distribution for attrs.
604 func (m ContainerCPURequestUtilization) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
605 if len(attrs) == 0 {
606 m.Int64Gauge.Record(ctx, val)
607 return
608 }
609
610 o := recOptPool.Get().(*[]metric.RecordOption)
611 defer func() {
612 *o = (*o)[:0]
613 recOptPool.Put(o)
614 }()
615
616 *o = append(*o, metric.WithAttributes(attrs...))
617 m.Int64Gauge.Record(ctx, val, *o...)
618 }
619
620 // RecordSet records val to the current distribution for set.
621 func (m ContainerCPURequestUtilization) RecordSet(ctx context.Context, val int64, set attribute.Set) {
622 if set.Len() == 0 {
623 m.Int64Gauge.Record(ctx, val)
624 return
625 }
626
627 o := recOptPool.Get().(*[]metric.RecordOption)
628 defer func() {
629 *o = (*o)[:0]
630 recOptPool.Put(o)
631 }()
632
633 *o = append(*o, metric.WithAttributeSet(set))
634 m.Int64Gauge.Record(ctx, val, *o...)
635 }
636
637 // ContainerEphemeralStorageLimit is an instrument used to record metric values
638 // conforming to the "k8s.container.ephemeral_storage.limit" semantic
639 // conventions. It represents the maximum ephemeral storage resource limit set
640 // for the container.
641 type ContainerEphemeralStorageLimit struct {
642 metric.Int64UpDownCounter
643 }
644
645 var newContainerEphemeralStorageLimitOpts = []metric.Int64UpDownCounterOption{
646 metric.WithDescription("Maximum ephemeral storage resource limit set for the container."),
647 metric.WithUnit("By"),
648 }
649
650 // NewContainerEphemeralStorageLimit returns a new ContainerEphemeralStorageLimit
651 // instrument.
652 func NewContainerEphemeralStorageLimit(
653 m metric.Meter,
654 opt ...metric.Int64UpDownCounterOption,
655 ) (ContainerEphemeralStorageLimit, error) {
656 // Check if the meter is nil.
657 if m == nil {
658 return ContainerEphemeralStorageLimit{noop.Int64UpDownCounter{}}, nil
659 }
660
661 if len(opt) == 0 {
662 opt = newContainerEphemeralStorageLimitOpts
663 } else {
664 opt = append(opt, newContainerEphemeralStorageLimitOpts...)
665 }
666
667 i, err := m.Int64UpDownCounter(
668 "k8s.container.ephemeral_storage.limit",
669 opt...,
670 )
671 if err != nil {
672 return ContainerEphemeralStorageLimit{noop.Int64UpDownCounter{}}, err
673 }
674 return ContainerEphemeralStorageLimit{i}, nil
675 }
676
677 // Inst returns the underlying metric instrument.
678 func (m ContainerEphemeralStorageLimit) Inst() metric.Int64UpDownCounter {
679 return m.Int64UpDownCounter
680 }
681
682 // Name returns the semantic convention name of the instrument.
683 func (ContainerEphemeralStorageLimit) Name() string {
684 return "k8s.container.ephemeral_storage.limit"
685 }
686
687 // Unit returns the semantic convention unit of the instrument
688 func (ContainerEphemeralStorageLimit) Unit() string {
689 return "By"
690 }
691
692 // Description returns the semantic convention description of the instrument
693 func (ContainerEphemeralStorageLimit) Description() string {
694 return "Maximum ephemeral storage resource limit set for the container."
695 }
696
697 // Add adds incr to the existing count for attrs.
698 //
699 // See
700 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
701 // for details.
702 func (m ContainerEphemeralStorageLimit) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
703 if len(attrs) == 0 {
704 m.Int64UpDownCounter.Add(ctx, incr)
705 return
706 }
707
708 o := addOptPool.Get().(*[]metric.AddOption)
709 defer func() {
710 *o = (*o)[:0]
711 addOptPool.Put(o)
712 }()
713
714 *o = append(*o, metric.WithAttributes(attrs...))
715 m.Int64UpDownCounter.Add(ctx, incr, *o...)
716 }
717
718 // AddSet adds incr to the existing count for set.
719 //
720 // See
721 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
722 // for details.
723 func (m ContainerEphemeralStorageLimit) AddSet(ctx context.Context, incr int64, set attribute.Set) {
724 if set.Len() == 0 {
725 m.Int64UpDownCounter.Add(ctx, incr)
726 return
727 }
728
729 o := addOptPool.Get().(*[]metric.AddOption)
730 defer func() {
731 *o = (*o)[:0]
732 addOptPool.Put(o)
733 }()
734
735 *o = append(*o, metric.WithAttributeSet(set))
736 m.Int64UpDownCounter.Add(ctx, incr, *o...)
737 }
738
739 // ContainerEphemeralStorageRequest is an instrument used to record metric values
740 // conforming to the "k8s.container.ephemeral_storage.request" semantic
741 // conventions. It represents the ephemeral storage resource requested for the
742 // container.
743 type ContainerEphemeralStorageRequest struct {
744 metric.Int64UpDownCounter
745 }
746
747 var newContainerEphemeralStorageRequestOpts = []metric.Int64UpDownCounterOption{
748 metric.WithDescription("Ephemeral storage resource requested for the container."),
749 metric.WithUnit("By"),
750 }
751
752 // NewContainerEphemeralStorageRequest returns a new
753 // ContainerEphemeralStorageRequest instrument.
754 func NewContainerEphemeralStorageRequest(
755 m metric.Meter,
756 opt ...metric.Int64UpDownCounterOption,
757 ) (ContainerEphemeralStorageRequest, error) {
758 // Check if the meter is nil.
759 if m == nil {
760 return ContainerEphemeralStorageRequest{noop.Int64UpDownCounter{}}, nil
761 }
762
763 if len(opt) == 0 {
764 opt = newContainerEphemeralStorageRequestOpts
765 } else {
766 opt = append(opt, newContainerEphemeralStorageRequestOpts...)
767 }
768
769 i, err := m.Int64UpDownCounter(
770 "k8s.container.ephemeral_storage.request",
771 opt...,
772 )
773 if err != nil {
774 return ContainerEphemeralStorageRequest{noop.Int64UpDownCounter{}}, err
775 }
776 return ContainerEphemeralStorageRequest{i}, nil
777 }
778
779 // Inst returns the underlying metric instrument.
780 func (m ContainerEphemeralStorageRequest) Inst() metric.Int64UpDownCounter {
781 return m.Int64UpDownCounter
782 }
783
784 // Name returns the semantic convention name of the instrument.
785 func (ContainerEphemeralStorageRequest) Name() string {
786 return "k8s.container.ephemeral_storage.request"
787 }
788
789 // Unit returns the semantic convention unit of the instrument
790 func (ContainerEphemeralStorageRequest) Unit() string {
791 return "By"
792 }
793
794 // Description returns the semantic convention description of the instrument
795 func (ContainerEphemeralStorageRequest) Description() string {
796 return "Ephemeral storage resource requested for the container."
797 }
798
799 // Add adds incr to the existing count for attrs.
800 //
801 // See
802 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
803 // for details.
804 func (m ContainerEphemeralStorageRequest) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
805 if len(attrs) == 0 {
806 m.Int64UpDownCounter.Add(ctx, incr)
807 return
808 }
809
810 o := addOptPool.Get().(*[]metric.AddOption)
811 defer func() {
812 *o = (*o)[:0]
813 addOptPool.Put(o)
814 }()
815
816 *o = append(*o, metric.WithAttributes(attrs...))
817 m.Int64UpDownCounter.Add(ctx, incr, *o...)
818 }
819
820 // AddSet adds incr to the existing count for set.
821 //
822 // See
823 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
824 // for details.
825 func (m ContainerEphemeralStorageRequest) AddSet(ctx context.Context, incr int64, set attribute.Set) {
826 if set.Len() == 0 {
827 m.Int64UpDownCounter.Add(ctx, incr)
828 return
829 }
830
831 o := addOptPool.Get().(*[]metric.AddOption)
832 defer func() {
833 *o = (*o)[:0]
834 addOptPool.Put(o)
835 }()
836
837 *o = append(*o, metric.WithAttributeSet(set))
838 m.Int64UpDownCounter.Add(ctx, incr, *o...)
839 }
840
841 // ContainerMemoryLimit is an instrument used to record metric values conforming
842 // to the "k8s.container.memory.limit" semantic conventions. It represents the
843 // maximum memory resource limit set for the container.
844 type ContainerMemoryLimit struct {
845 metric.Int64UpDownCounter
846 }
847
848 var newContainerMemoryLimitOpts = []metric.Int64UpDownCounterOption{
849 metric.WithDescription("Maximum memory resource limit set for the container."),
850 metric.WithUnit("By"),
851 }
852
853 // NewContainerMemoryLimit returns a new ContainerMemoryLimit instrument.
854 func NewContainerMemoryLimit(
855 m metric.Meter,
856 opt ...metric.Int64UpDownCounterOption,
857 ) (ContainerMemoryLimit, error) {
858 // Check if the meter is nil.
859 if m == nil {
860 return ContainerMemoryLimit{noop.Int64UpDownCounter{}}, nil
861 }
862
863 if len(opt) == 0 {
864 opt = newContainerMemoryLimitOpts
865 } else {
866 opt = append(opt, newContainerMemoryLimitOpts...)
867 }
868
869 i, err := m.Int64UpDownCounter(
870 "k8s.container.memory.limit",
871 opt...,
872 )
873 if err != nil {
874 return ContainerMemoryLimit{noop.Int64UpDownCounter{}}, err
875 }
876 return ContainerMemoryLimit{i}, nil
877 }
878
879 // Inst returns the underlying metric instrument.
880 func (m ContainerMemoryLimit) Inst() metric.Int64UpDownCounter {
881 return m.Int64UpDownCounter
882 }
883
884 // Name returns the semantic convention name of the instrument.
885 func (ContainerMemoryLimit) Name() string {
886 return "k8s.container.memory.limit"
887 }
888
889 // Unit returns the semantic convention unit of the instrument
890 func (ContainerMemoryLimit) Unit() string {
891 return "By"
892 }
893
894 // Description returns the semantic convention description of the instrument
895 func (ContainerMemoryLimit) Description() string {
896 return "Maximum memory resource limit set for the container."
897 }
898
899 // Add adds incr to the existing count for attrs.
900 //
901 // See
902 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
903 // for details.
904 func (m ContainerMemoryLimit) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
905 if len(attrs) == 0 {
906 m.Int64UpDownCounter.Add(ctx, incr)
907 return
908 }
909
910 o := addOptPool.Get().(*[]metric.AddOption)
911 defer func() {
912 *o = (*o)[:0]
913 addOptPool.Put(o)
914 }()
915
916 *o = append(*o, metric.WithAttributes(attrs...))
917 m.Int64UpDownCounter.Add(ctx, incr, *o...)
918 }
919
920 // AddSet adds incr to the existing count for set.
921 //
922 // See
923 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
924 // for details.
925 func (m ContainerMemoryLimit) AddSet(ctx context.Context, incr int64, set attribute.Set) {
926 if set.Len() == 0 {
927 m.Int64UpDownCounter.Add(ctx, incr)
928 return
929 }
930
931 o := addOptPool.Get().(*[]metric.AddOption)
932 defer func() {
933 *o = (*o)[:0]
934 addOptPool.Put(o)
935 }()
936
937 *o = append(*o, metric.WithAttributeSet(set))
938 m.Int64UpDownCounter.Add(ctx, incr, *o...)
939 }
940
941 // ContainerMemoryRequest is an instrument used to record metric values
942 // conforming to the "k8s.container.memory.request" semantic conventions. It
943 // represents the memory resource requested for the container.
944 type ContainerMemoryRequest struct {
945 metric.Int64UpDownCounter
946 }
947
948 var newContainerMemoryRequestOpts = []metric.Int64UpDownCounterOption{
949 metric.WithDescription("Memory resource requested for the container."),
950 metric.WithUnit("By"),
951 }
952
953 // NewContainerMemoryRequest returns a new ContainerMemoryRequest instrument.
954 func NewContainerMemoryRequest(
955 m metric.Meter,
956 opt ...metric.Int64UpDownCounterOption,
957 ) (ContainerMemoryRequest, error) {
958 // Check if the meter is nil.
959 if m == nil {
960 return ContainerMemoryRequest{noop.Int64UpDownCounter{}}, nil
961 }
962
963 if len(opt) == 0 {
964 opt = newContainerMemoryRequestOpts
965 } else {
966 opt = append(opt, newContainerMemoryRequestOpts...)
967 }
968
969 i, err := m.Int64UpDownCounter(
970 "k8s.container.memory.request",
971 opt...,
972 )
973 if err != nil {
974 return ContainerMemoryRequest{noop.Int64UpDownCounter{}}, err
975 }
976 return ContainerMemoryRequest{i}, nil
977 }
978
979 // Inst returns the underlying metric instrument.
980 func (m ContainerMemoryRequest) Inst() metric.Int64UpDownCounter {
981 return m.Int64UpDownCounter
982 }
983
984 // Name returns the semantic convention name of the instrument.
985 func (ContainerMemoryRequest) Name() string {
986 return "k8s.container.memory.request"
987 }
988
989 // Unit returns the semantic convention unit of the instrument
990 func (ContainerMemoryRequest) Unit() string {
991 return "By"
992 }
993
994 // Description returns the semantic convention description of the instrument
995 func (ContainerMemoryRequest) Description() string {
996 return "Memory resource requested for the container."
997 }
998
999 // Add adds incr to the existing count for attrs.
1000 //
1001 // See
1002 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1003 // for details.
1004 func (m ContainerMemoryRequest) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1005 if len(attrs) == 0 {
1006 m.Int64UpDownCounter.Add(ctx, incr)
1007 return
1008 }
1009
1010 o := addOptPool.Get().(*[]metric.AddOption)
1011 defer func() {
1012 *o = (*o)[:0]
1013 addOptPool.Put(o)
1014 }()
1015
1016 *o = append(*o, metric.WithAttributes(attrs...))
1017 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1018 }
1019
1020 // AddSet adds incr to the existing count for set.
1021 //
1022 // See
1023 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1024 // for details.
1025 func (m ContainerMemoryRequest) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1026 if set.Len() == 0 {
1027 m.Int64UpDownCounter.Add(ctx, incr)
1028 return
1029 }
1030
1031 o := addOptPool.Get().(*[]metric.AddOption)
1032 defer func() {
1033 *o = (*o)[:0]
1034 addOptPool.Put(o)
1035 }()
1036
1037 *o = append(*o, metric.WithAttributeSet(set))
1038 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1039 }
1040
1041 // ContainerReady is an instrument used to record metric values conforming to the
1042 // "k8s.container.ready" semantic conventions. It represents the indicates
1043 // whether the container is currently marked as ready to accept traffic, based on
1044 // its readiness probe (1 = ready, 0 = not ready).
1045 type ContainerReady struct {
1046 metric.Int64UpDownCounter
1047 }
1048
1049 var newContainerReadyOpts = []metric.Int64UpDownCounterOption{
1050 metric.WithDescription("Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)."),
1051 metric.WithUnit("{container}"),
1052 }
1053
1054 // NewContainerReady returns a new ContainerReady instrument.
1055 func NewContainerReady(
1056 m metric.Meter,
1057 opt ...metric.Int64UpDownCounterOption,
1058 ) (ContainerReady, error) {
1059 // Check if the meter is nil.
1060 if m == nil {
1061 return ContainerReady{noop.Int64UpDownCounter{}}, nil
1062 }
1063
1064 if len(opt) == 0 {
1065 opt = newContainerReadyOpts
1066 } else {
1067 opt = append(opt, newContainerReadyOpts...)
1068 }
1069
1070 i, err := m.Int64UpDownCounter(
1071 "k8s.container.ready",
1072 opt...,
1073 )
1074 if err != nil {
1075 return ContainerReady{noop.Int64UpDownCounter{}}, err
1076 }
1077 return ContainerReady{i}, nil
1078 }
1079
1080 // Inst returns the underlying metric instrument.
1081 func (m ContainerReady) Inst() metric.Int64UpDownCounter {
1082 return m.Int64UpDownCounter
1083 }
1084
1085 // Name returns the semantic convention name of the instrument.
1086 func (ContainerReady) Name() string {
1087 return "k8s.container.ready"
1088 }
1089
1090 // Unit returns the semantic convention unit of the instrument
1091 func (ContainerReady) Unit() string {
1092 return "{container}"
1093 }
1094
1095 // Description returns the semantic convention description of the instrument
1096 func (ContainerReady) Description() string {
1097 return "Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)."
1098 }
1099
1100 // Add adds incr to the existing count for attrs.
1101 //
1102 // This metric SHOULD reflect the value of the `ready` field in the
1103 // [K8s ContainerStatus].
1104 //
1105 // [K8s ContainerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatus-v1-core
1106 func (m ContainerReady) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1107 if len(attrs) == 0 {
1108 m.Int64UpDownCounter.Add(ctx, incr)
1109 return
1110 }
1111
1112 o := addOptPool.Get().(*[]metric.AddOption)
1113 defer func() {
1114 *o = (*o)[:0]
1115 addOptPool.Put(o)
1116 }()
1117
1118 *o = append(*o, metric.WithAttributes(attrs...))
1119 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1120 }
1121
1122 // AddSet adds incr to the existing count for set.
1123 //
1124 // This metric SHOULD reflect the value of the `ready` field in the
1125 // [K8s ContainerStatus].
1126 //
1127 // [K8s ContainerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatus-v1-core
1128 func (m ContainerReady) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1129 if set.Len() == 0 {
1130 m.Int64UpDownCounter.Add(ctx, incr)
1131 return
1132 }
1133
1134 o := addOptPool.Get().(*[]metric.AddOption)
1135 defer func() {
1136 *o = (*o)[:0]
1137 addOptPool.Put(o)
1138 }()
1139
1140 *o = append(*o, metric.WithAttributeSet(set))
1141 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1142 }
1143
1144 // ContainerRestartCount is an instrument used to record metric values conforming
1145 // to the "k8s.container.restart.count" semantic conventions. It represents the
1146 // describes how many times the container has restarted (since the last counter
1147 // reset).
1148 type ContainerRestartCount struct {
1149 metric.Int64UpDownCounter
1150 }
1151
1152 var newContainerRestartCountOpts = []metric.Int64UpDownCounterOption{
1153 metric.WithDescription("Describes how many times the container has restarted (since the last counter reset)."),
1154 metric.WithUnit("{restart}"),
1155 }
1156
1157 // NewContainerRestartCount returns a new ContainerRestartCount instrument.
1158 func NewContainerRestartCount(
1159 m metric.Meter,
1160 opt ...metric.Int64UpDownCounterOption,
1161 ) (ContainerRestartCount, error) {
1162 // Check if the meter is nil.
1163 if m == nil {
1164 return ContainerRestartCount{noop.Int64UpDownCounter{}}, nil
1165 }
1166
1167 if len(opt) == 0 {
1168 opt = newContainerRestartCountOpts
1169 } else {
1170 opt = append(opt, newContainerRestartCountOpts...)
1171 }
1172
1173 i, err := m.Int64UpDownCounter(
1174 "k8s.container.restart.count",
1175 opt...,
1176 )
1177 if err != nil {
1178 return ContainerRestartCount{noop.Int64UpDownCounter{}}, err
1179 }
1180 return ContainerRestartCount{i}, nil
1181 }
1182
1183 // Inst returns the underlying metric instrument.
1184 func (m ContainerRestartCount) Inst() metric.Int64UpDownCounter {
1185 return m.Int64UpDownCounter
1186 }
1187
1188 // Name returns the semantic convention name of the instrument.
1189 func (ContainerRestartCount) Name() string {
1190 return "k8s.container.restart.count"
1191 }
1192
1193 // Unit returns the semantic convention unit of the instrument
1194 func (ContainerRestartCount) Unit() string {
1195 return "{restart}"
1196 }
1197
1198 // Description returns the semantic convention description of the instrument
1199 func (ContainerRestartCount) Description() string {
1200 return "Describes how many times the container has restarted (since the last counter reset)."
1201 }
1202
1203 // Add adds incr to the existing count for attrs.
1204 //
1205 // This value is pulled directly from the K8s API and the value can go
1206 // indefinitely high and be reset to 0
1207 // at any time depending on how your kubelet is configured to prune dead
1208 // containers.
1209 // It is best to not depend too much on the exact value but rather look at it as
1210 // either == 0, in which case you can conclude there were no restarts in the
1211 // recent past, or > 0, in which case
1212 // you can conclude there were restarts in the recent past, and not try and
1213 // analyze the value beyond that.
1214 func (m ContainerRestartCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1215 if len(attrs) == 0 {
1216 m.Int64UpDownCounter.Add(ctx, incr)
1217 return
1218 }
1219
1220 o := addOptPool.Get().(*[]metric.AddOption)
1221 defer func() {
1222 *o = (*o)[:0]
1223 addOptPool.Put(o)
1224 }()
1225
1226 *o = append(*o, metric.WithAttributes(attrs...))
1227 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1228 }
1229
1230 // AddSet adds incr to the existing count for set.
1231 //
1232 // This value is pulled directly from the K8s API and the value can go
1233 // indefinitely high and be reset to 0
1234 // at any time depending on how your kubelet is configured to prune dead
1235 // containers.
1236 // It is best to not depend too much on the exact value but rather look at it as
1237 // either == 0, in which case you can conclude there were no restarts in the
1238 // recent past, or > 0, in which case
1239 // you can conclude there were restarts in the recent past, and not try and
1240 // analyze the value beyond that.
1241 func (m ContainerRestartCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1242 if set.Len() == 0 {
1243 m.Int64UpDownCounter.Add(ctx, incr)
1244 return
1245 }
1246
1247 o := addOptPool.Get().(*[]metric.AddOption)
1248 defer func() {
1249 *o = (*o)[:0]
1250 addOptPool.Put(o)
1251 }()
1252
1253 *o = append(*o, metric.WithAttributeSet(set))
1254 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1255 }
1256
1257 // ContainerStatusReason is an instrument used to record metric values conforming
1258 // to the "k8s.container.status.reason" semantic conventions. It represents the
1259 // describes the number of K8s containers that are currently in a state for a
1260 // given reason.
1261 type ContainerStatusReason struct {
1262 metric.Int64UpDownCounter
1263 }
1264
1265 var newContainerStatusReasonOpts = []metric.Int64UpDownCounterOption{
1266 metric.WithDescription("Describes the number of K8s containers that are currently in a state for a given reason."),
1267 metric.WithUnit("{container}"),
1268 }
1269
1270 // NewContainerStatusReason returns a new ContainerStatusReason instrument.
1271 func NewContainerStatusReason(
1272 m metric.Meter,
1273 opt ...metric.Int64UpDownCounterOption,
1274 ) (ContainerStatusReason, error) {
1275 // Check if the meter is nil.
1276 if m == nil {
1277 return ContainerStatusReason{noop.Int64UpDownCounter{}}, nil
1278 }
1279
1280 if len(opt) == 0 {
1281 opt = newContainerStatusReasonOpts
1282 } else {
1283 opt = append(opt, newContainerStatusReasonOpts...)
1284 }
1285
1286 i, err := m.Int64UpDownCounter(
1287 "k8s.container.status.reason",
1288 opt...,
1289 )
1290 if err != nil {
1291 return ContainerStatusReason{noop.Int64UpDownCounter{}}, err
1292 }
1293 return ContainerStatusReason{i}, nil
1294 }
1295
1296 // Inst returns the underlying metric instrument.
1297 func (m ContainerStatusReason) Inst() metric.Int64UpDownCounter {
1298 return m.Int64UpDownCounter
1299 }
1300
1301 // Name returns the semantic convention name of the instrument.
1302 func (ContainerStatusReason) Name() string {
1303 return "k8s.container.status.reason"
1304 }
1305
1306 // Unit returns the semantic convention unit of the instrument
1307 func (ContainerStatusReason) Unit() string {
1308 return "{container}"
1309 }
1310
1311 // Description returns the semantic convention description of the instrument
1312 func (ContainerStatusReason) Description() string {
1313 return "Describes the number of K8s containers that are currently in a state for a given reason."
1314 }
1315
1316 // Add adds incr to the existing count for attrs.
1317 //
1318 // The containerStatusReason is the the reason for the container state.
1319 // Corresponds to the `reason` field of the: [K8s ContainerStateWaiting] or
1320 // [K8s ContainerStateTerminated]
1321 //
1322 // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core
1323 // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core
1324 //
1325 // All possible container state reasons will be reported at each time interval to
1326 // avoid missing metrics.
1327 // Only the value corresponding to the current state reason will be non-zero.
1328 func (m ContainerStatusReason) Add(
1329 ctx context.Context,
1330 incr int64,
1331 containerStatusReason ContainerStatusReasonAttr,
1332 attrs ...attribute.KeyValue,
1333 ) {
1334 if len(attrs) == 0 {
1335 m.Int64UpDownCounter.Add(ctx, incr)
1336 return
1337 }
1338
1339 o := addOptPool.Get().(*[]metric.AddOption)
1340 defer func() {
1341 *o = (*o)[:0]
1342 addOptPool.Put(o)
1343 }()
1344
1345 *o = append(
1346 *o,
1347 metric.WithAttributes(
1348 append(
1349 attrs,
1350 attribute.String("k8s.container.status.reason", string(containerStatusReason)),
1351 )...,
1352 ),
1353 )
1354
1355 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1356 }
1357
1358 // AddSet adds incr to the existing count for set.
1359 //
1360 // All possible container state reasons will be reported at each time interval to
1361 // avoid missing metrics.
1362 // Only the value corresponding to the current state reason will be non-zero.
1363 func (m ContainerStatusReason) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1364 if set.Len() == 0 {
1365 m.Int64UpDownCounter.Add(ctx, incr)
1366 return
1367 }
1368
1369 o := addOptPool.Get().(*[]metric.AddOption)
1370 defer func() {
1371 *o = (*o)[:0]
1372 addOptPool.Put(o)
1373 }()
1374
1375 *o = append(*o, metric.WithAttributeSet(set))
1376 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1377 }
1378
1379 // ContainerStatusState is an instrument used to record metric values conforming
1380 // to the "k8s.container.status.state" semantic conventions. It represents the
1381 // describes the number of K8s containers that are currently in a given state.
1382 type ContainerStatusState struct {
1383 metric.Int64UpDownCounter
1384 }
1385
1386 var newContainerStatusStateOpts = []metric.Int64UpDownCounterOption{
1387 metric.WithDescription("Describes the number of K8s containers that are currently in a given state."),
1388 metric.WithUnit("{container}"),
1389 }
1390
1391 // NewContainerStatusState returns a new ContainerStatusState instrument.
1392 func NewContainerStatusState(
1393 m metric.Meter,
1394 opt ...metric.Int64UpDownCounterOption,
1395 ) (ContainerStatusState, error) {
1396 // Check if the meter is nil.
1397 if m == nil {
1398 return ContainerStatusState{noop.Int64UpDownCounter{}}, nil
1399 }
1400
1401 if len(opt) == 0 {
1402 opt = newContainerStatusStateOpts
1403 } else {
1404 opt = append(opt, newContainerStatusStateOpts...)
1405 }
1406
1407 i, err := m.Int64UpDownCounter(
1408 "k8s.container.status.state",
1409 opt...,
1410 )
1411 if err != nil {
1412 return ContainerStatusState{noop.Int64UpDownCounter{}}, err
1413 }
1414 return ContainerStatusState{i}, nil
1415 }
1416
1417 // Inst returns the underlying metric instrument.
1418 func (m ContainerStatusState) Inst() metric.Int64UpDownCounter {
1419 return m.Int64UpDownCounter
1420 }
1421
1422 // Name returns the semantic convention name of the instrument.
1423 func (ContainerStatusState) Name() string {
1424 return "k8s.container.status.state"
1425 }
1426
1427 // Unit returns the semantic convention unit of the instrument
1428 func (ContainerStatusState) Unit() string {
1429 return "{container}"
1430 }
1431
1432 // Description returns the semantic convention description of the instrument
1433 func (ContainerStatusState) Description() string {
1434 return "Describes the number of K8s containers that are currently in a given state."
1435 }
1436
1437 // Add adds incr to the existing count for attrs.
1438 //
1439 // The containerStatusState is the the state of the container.
1440 // [K8s ContainerState]
1441 //
1442 // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core
1443 //
1444 // All possible container states will be reported at each time interval to avoid
1445 // missing metrics.
1446 // Only the value corresponding to the current state will be non-zero.
1447 func (m ContainerStatusState) Add(
1448 ctx context.Context,
1449 incr int64,
1450 containerStatusState ContainerStatusStateAttr,
1451 attrs ...attribute.KeyValue,
1452 ) {
1453 if len(attrs) == 0 {
1454 m.Int64UpDownCounter.Add(ctx, incr)
1455 return
1456 }
1457
1458 o := addOptPool.Get().(*[]metric.AddOption)
1459 defer func() {
1460 *o = (*o)[:0]
1461 addOptPool.Put(o)
1462 }()
1463
1464 *o = append(
1465 *o,
1466 metric.WithAttributes(
1467 append(
1468 attrs,
1469 attribute.String("k8s.container.status.state", string(containerStatusState)),
1470 )...,
1471 ),
1472 )
1473
1474 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1475 }
1476
1477 // AddSet adds incr to the existing count for set.
1478 //
1479 // All possible container states will be reported at each time interval to avoid
1480 // missing metrics.
1481 // Only the value corresponding to the current state will be non-zero.
1482 func (m ContainerStatusState) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1483 if set.Len() == 0 {
1484 m.Int64UpDownCounter.Add(ctx, incr)
1485 return
1486 }
1487
1488 o := addOptPool.Get().(*[]metric.AddOption)
1489 defer func() {
1490 *o = (*o)[:0]
1491 addOptPool.Put(o)
1492 }()
1493
1494 *o = append(*o, metric.WithAttributeSet(set))
1495 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1496 }
1497
1498 // ContainerStorageLimit is an instrument used to record metric values conforming
1499 // to the "k8s.container.storage.limit" semantic conventions. It represents the
1500 // maximum storage resource limit set for the container.
1501 type ContainerStorageLimit struct {
1502 metric.Int64UpDownCounter
1503 }
1504
1505 var newContainerStorageLimitOpts = []metric.Int64UpDownCounterOption{
1506 metric.WithDescription("Maximum storage resource limit set for the container."),
1507 metric.WithUnit("By"),
1508 }
1509
1510 // NewContainerStorageLimit returns a new ContainerStorageLimit instrument.
1511 func NewContainerStorageLimit(
1512 m metric.Meter,
1513 opt ...metric.Int64UpDownCounterOption,
1514 ) (ContainerStorageLimit, error) {
1515 // Check if the meter is nil.
1516 if m == nil {
1517 return ContainerStorageLimit{noop.Int64UpDownCounter{}}, nil
1518 }
1519
1520 if len(opt) == 0 {
1521 opt = newContainerStorageLimitOpts
1522 } else {
1523 opt = append(opt, newContainerStorageLimitOpts...)
1524 }
1525
1526 i, err := m.Int64UpDownCounter(
1527 "k8s.container.storage.limit",
1528 opt...,
1529 )
1530 if err != nil {
1531 return ContainerStorageLimit{noop.Int64UpDownCounter{}}, err
1532 }
1533 return ContainerStorageLimit{i}, nil
1534 }
1535
1536 // Inst returns the underlying metric instrument.
1537 func (m ContainerStorageLimit) Inst() metric.Int64UpDownCounter {
1538 return m.Int64UpDownCounter
1539 }
1540
1541 // Name returns the semantic convention name of the instrument.
1542 func (ContainerStorageLimit) Name() string {
1543 return "k8s.container.storage.limit"
1544 }
1545
1546 // Unit returns the semantic convention unit of the instrument
1547 func (ContainerStorageLimit) Unit() string {
1548 return "By"
1549 }
1550
1551 // Description returns the semantic convention description of the instrument
1552 func (ContainerStorageLimit) Description() string {
1553 return "Maximum storage resource limit set for the container."
1554 }
1555
1556 // Add adds incr to the existing count for attrs.
1557 //
1558 // See
1559 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1560 // for details.
1561 func (m ContainerStorageLimit) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1562 if len(attrs) == 0 {
1563 m.Int64UpDownCounter.Add(ctx, incr)
1564 return
1565 }
1566
1567 o := addOptPool.Get().(*[]metric.AddOption)
1568 defer func() {
1569 *o = (*o)[:0]
1570 addOptPool.Put(o)
1571 }()
1572
1573 *o = append(*o, metric.WithAttributes(attrs...))
1574 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1575 }
1576
1577 // AddSet adds incr to the existing count for set.
1578 //
1579 // See
1580 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1581 // for details.
1582 func (m ContainerStorageLimit) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1583 if set.Len() == 0 {
1584 m.Int64UpDownCounter.Add(ctx, incr)
1585 return
1586 }
1587
1588 o := addOptPool.Get().(*[]metric.AddOption)
1589 defer func() {
1590 *o = (*o)[:0]
1591 addOptPool.Put(o)
1592 }()
1593
1594 *o = append(*o, metric.WithAttributeSet(set))
1595 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1596 }
1597
1598 // ContainerStorageRequest is an instrument used to record metric values
1599 // conforming to the "k8s.container.storage.request" semantic conventions. It
1600 // represents the storage resource requested for the container.
1601 type ContainerStorageRequest struct {
1602 metric.Int64UpDownCounter
1603 }
1604
1605 var newContainerStorageRequestOpts = []metric.Int64UpDownCounterOption{
1606 metric.WithDescription("Storage resource requested for the container."),
1607 metric.WithUnit("By"),
1608 }
1609
1610 // NewContainerStorageRequest returns a new ContainerStorageRequest instrument.
1611 func NewContainerStorageRequest(
1612 m metric.Meter,
1613 opt ...metric.Int64UpDownCounterOption,
1614 ) (ContainerStorageRequest, error) {
1615 // Check if the meter is nil.
1616 if m == nil {
1617 return ContainerStorageRequest{noop.Int64UpDownCounter{}}, nil
1618 }
1619
1620 if len(opt) == 0 {
1621 opt = newContainerStorageRequestOpts
1622 } else {
1623 opt = append(opt, newContainerStorageRequestOpts...)
1624 }
1625
1626 i, err := m.Int64UpDownCounter(
1627 "k8s.container.storage.request",
1628 opt...,
1629 )
1630 if err != nil {
1631 return ContainerStorageRequest{noop.Int64UpDownCounter{}}, err
1632 }
1633 return ContainerStorageRequest{i}, nil
1634 }
1635
1636 // Inst returns the underlying metric instrument.
1637 func (m ContainerStorageRequest) Inst() metric.Int64UpDownCounter {
1638 return m.Int64UpDownCounter
1639 }
1640
1641 // Name returns the semantic convention name of the instrument.
1642 func (ContainerStorageRequest) Name() string {
1643 return "k8s.container.storage.request"
1644 }
1645
1646 // Unit returns the semantic convention unit of the instrument
1647 func (ContainerStorageRequest) Unit() string {
1648 return "By"
1649 }
1650
1651 // Description returns the semantic convention description of the instrument
1652 func (ContainerStorageRequest) Description() string {
1653 return "Storage resource requested for the container."
1654 }
1655
1656 // Add adds incr to the existing count for attrs.
1657 //
1658 // See
1659 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1660 // for details.
1661 func (m ContainerStorageRequest) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1662 if len(attrs) == 0 {
1663 m.Int64UpDownCounter.Add(ctx, incr)
1664 return
1665 }
1666
1667 o := addOptPool.Get().(*[]metric.AddOption)
1668 defer func() {
1669 *o = (*o)[:0]
1670 addOptPool.Put(o)
1671 }()
1672
1673 *o = append(*o, metric.WithAttributes(attrs...))
1674 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1675 }
1676
1677 // AddSet adds incr to the existing count for set.
1678 //
1679 // See
1680 // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core
1681 // for details.
1682 func (m ContainerStorageRequest) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1683 if set.Len() == 0 {
1684 m.Int64UpDownCounter.Add(ctx, incr)
1685 return
1686 }
1687
1688 o := addOptPool.Get().(*[]metric.AddOption)
1689 defer func() {
1690 *o = (*o)[:0]
1691 addOptPool.Put(o)
1692 }()
1693
1694 *o = append(*o, metric.WithAttributeSet(set))
1695 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1696 }
1697
1698 // CronJobJobActive is an instrument used to record metric values conforming to
1699 // the "k8s.cronjob.job.active" semantic conventions. It represents the number of
1700 // actively running jobs for a cronjob.
1701 type CronJobJobActive struct {
1702 metric.Int64UpDownCounter
1703 }
1704
1705 var newCronJobJobActiveOpts = []metric.Int64UpDownCounterOption{
1706 metric.WithDescription("The number of actively running jobs for a cronjob."),
1707 metric.WithUnit("{job}"),
1708 }
1709
1710 // NewCronJobJobActive returns a new CronJobJobActive instrument.
1711 func NewCronJobJobActive(
1712 m metric.Meter,
1713 opt ...metric.Int64UpDownCounterOption,
1714 ) (CronJobJobActive, error) {
1715 // Check if the meter is nil.
1716 if m == nil {
1717 return CronJobJobActive{noop.Int64UpDownCounter{}}, nil
1718 }
1719
1720 if len(opt) == 0 {
1721 opt = newCronJobJobActiveOpts
1722 } else {
1723 opt = append(opt, newCronJobJobActiveOpts...)
1724 }
1725
1726 i, err := m.Int64UpDownCounter(
1727 "k8s.cronjob.job.active",
1728 opt...,
1729 )
1730 if err != nil {
1731 return CronJobJobActive{noop.Int64UpDownCounter{}}, err
1732 }
1733 return CronJobJobActive{i}, nil
1734 }
1735
1736 // Inst returns the underlying metric instrument.
1737 func (m CronJobJobActive) Inst() metric.Int64UpDownCounter {
1738 return m.Int64UpDownCounter
1739 }
1740
1741 // Name returns the semantic convention name of the instrument.
1742 func (CronJobJobActive) Name() string {
1743 return "k8s.cronjob.job.active"
1744 }
1745
1746 // Unit returns the semantic convention unit of the instrument
1747 func (CronJobJobActive) Unit() string {
1748 return "{job}"
1749 }
1750
1751 // Description returns the semantic convention description of the instrument
1752 func (CronJobJobActive) Description() string {
1753 return "The number of actively running jobs for a cronjob."
1754 }
1755
1756 // Add adds incr to the existing count for attrs.
1757 //
1758 // This metric aligns with the `active` field of the
1759 // [K8s CronJobStatus].
1760 //
1761 // [K8s CronJobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#cronjobstatus-v1-batch
1762 func (m CronJobJobActive) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1763 if len(attrs) == 0 {
1764 m.Int64UpDownCounter.Add(ctx, incr)
1765 return
1766 }
1767
1768 o := addOptPool.Get().(*[]metric.AddOption)
1769 defer func() {
1770 *o = (*o)[:0]
1771 addOptPool.Put(o)
1772 }()
1773
1774 *o = append(*o, metric.WithAttributes(attrs...))
1775 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1776 }
1777
1778 // AddSet adds incr to the existing count for set.
1779 //
1780 // This metric aligns with the `active` field of the
1781 // [K8s CronJobStatus].
1782 //
1783 // [K8s CronJobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#cronjobstatus-v1-batch
1784 func (m CronJobJobActive) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1785 if set.Len() == 0 {
1786 m.Int64UpDownCounter.Add(ctx, incr)
1787 return
1788 }
1789
1790 o := addOptPool.Get().(*[]metric.AddOption)
1791 defer func() {
1792 *o = (*o)[:0]
1793 addOptPool.Put(o)
1794 }()
1795
1796 *o = append(*o, metric.WithAttributeSet(set))
1797 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1798 }
1799
1800 // DaemonSetNodeCurrentScheduled is an instrument used to record metric values
1801 // conforming to the "k8s.daemonset.node.current_scheduled" semantic conventions.
1802 // It represents the number of nodes that are running at least 1 daemon pod and
1803 // are supposed to run the daemon pod.
1804 type DaemonSetNodeCurrentScheduled struct {
1805 metric.Int64UpDownCounter
1806 }
1807
1808 var newDaemonSetNodeCurrentScheduledOpts = []metric.Int64UpDownCounterOption{
1809 metric.WithDescription("Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod."),
1810 metric.WithUnit("{node}"),
1811 }
1812
1813 // NewDaemonSetNodeCurrentScheduled returns a new DaemonSetNodeCurrentScheduled
1814 // instrument.
1815 func NewDaemonSetNodeCurrentScheduled(
1816 m metric.Meter,
1817 opt ...metric.Int64UpDownCounterOption,
1818 ) (DaemonSetNodeCurrentScheduled, error) {
1819 // Check if the meter is nil.
1820 if m == nil {
1821 return DaemonSetNodeCurrentScheduled{noop.Int64UpDownCounter{}}, nil
1822 }
1823
1824 if len(opt) == 0 {
1825 opt = newDaemonSetNodeCurrentScheduledOpts
1826 } else {
1827 opt = append(opt, newDaemonSetNodeCurrentScheduledOpts...)
1828 }
1829
1830 i, err := m.Int64UpDownCounter(
1831 "k8s.daemonset.node.current_scheduled",
1832 opt...,
1833 )
1834 if err != nil {
1835 return DaemonSetNodeCurrentScheduled{noop.Int64UpDownCounter{}}, err
1836 }
1837 return DaemonSetNodeCurrentScheduled{i}, nil
1838 }
1839
1840 // Inst returns the underlying metric instrument.
1841 func (m DaemonSetNodeCurrentScheduled) Inst() metric.Int64UpDownCounter {
1842 return m.Int64UpDownCounter
1843 }
1844
1845 // Name returns the semantic convention name of the instrument.
1846 func (DaemonSetNodeCurrentScheduled) Name() string {
1847 return "k8s.daemonset.node.current_scheduled"
1848 }
1849
1850 // Unit returns the semantic convention unit of the instrument
1851 func (DaemonSetNodeCurrentScheduled) Unit() string {
1852 return "{node}"
1853 }
1854
1855 // Description returns the semantic convention description of the instrument
1856 func (DaemonSetNodeCurrentScheduled) Description() string {
1857 return "Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod."
1858 }
1859
1860 // Add adds incr to the existing count for attrs.
1861 //
1862 // This metric aligns with the `currentNumberScheduled` field of the
1863 // [K8s DaemonSetStatus].
1864 //
1865 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
1866 func (m DaemonSetNodeCurrentScheduled) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1867 if len(attrs) == 0 {
1868 m.Int64UpDownCounter.Add(ctx, incr)
1869 return
1870 }
1871
1872 o := addOptPool.Get().(*[]metric.AddOption)
1873 defer func() {
1874 *o = (*o)[:0]
1875 addOptPool.Put(o)
1876 }()
1877
1878 *o = append(*o, metric.WithAttributes(attrs...))
1879 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1880 }
1881
1882 // AddSet adds incr to the existing count for set.
1883 //
1884 // This metric aligns with the `currentNumberScheduled` field of the
1885 // [K8s DaemonSetStatus].
1886 //
1887 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
1888 func (m DaemonSetNodeCurrentScheduled) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1889 if set.Len() == 0 {
1890 m.Int64UpDownCounter.Add(ctx, incr)
1891 return
1892 }
1893
1894 o := addOptPool.Get().(*[]metric.AddOption)
1895 defer func() {
1896 *o = (*o)[:0]
1897 addOptPool.Put(o)
1898 }()
1899
1900 *o = append(*o, metric.WithAttributeSet(set))
1901 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1902 }
1903
1904 // DaemonSetNodeDesiredScheduled is an instrument used to record metric values
1905 // conforming to the "k8s.daemonset.node.desired_scheduled" semantic conventions.
1906 // It represents the number of nodes that should be running the daemon pod
1907 // (including nodes currently running the daemon pod).
1908 type DaemonSetNodeDesiredScheduled struct {
1909 metric.Int64UpDownCounter
1910 }
1911
1912 var newDaemonSetNodeDesiredScheduledOpts = []metric.Int64UpDownCounterOption{
1913 metric.WithDescription("Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)."),
1914 metric.WithUnit("{node}"),
1915 }
1916
1917 // NewDaemonSetNodeDesiredScheduled returns a new DaemonSetNodeDesiredScheduled
1918 // instrument.
1919 func NewDaemonSetNodeDesiredScheduled(
1920 m metric.Meter,
1921 opt ...metric.Int64UpDownCounterOption,
1922 ) (DaemonSetNodeDesiredScheduled, error) {
1923 // Check if the meter is nil.
1924 if m == nil {
1925 return DaemonSetNodeDesiredScheduled{noop.Int64UpDownCounter{}}, nil
1926 }
1927
1928 if len(opt) == 0 {
1929 opt = newDaemonSetNodeDesiredScheduledOpts
1930 } else {
1931 opt = append(opt, newDaemonSetNodeDesiredScheduledOpts...)
1932 }
1933
1934 i, err := m.Int64UpDownCounter(
1935 "k8s.daemonset.node.desired_scheduled",
1936 opt...,
1937 )
1938 if err != nil {
1939 return DaemonSetNodeDesiredScheduled{noop.Int64UpDownCounter{}}, err
1940 }
1941 return DaemonSetNodeDesiredScheduled{i}, nil
1942 }
1943
1944 // Inst returns the underlying metric instrument.
1945 func (m DaemonSetNodeDesiredScheduled) Inst() metric.Int64UpDownCounter {
1946 return m.Int64UpDownCounter
1947 }
1948
1949 // Name returns the semantic convention name of the instrument.
1950 func (DaemonSetNodeDesiredScheduled) Name() string {
1951 return "k8s.daemonset.node.desired_scheduled"
1952 }
1953
1954 // Unit returns the semantic convention unit of the instrument
1955 func (DaemonSetNodeDesiredScheduled) Unit() string {
1956 return "{node}"
1957 }
1958
1959 // Description returns the semantic convention description of the instrument
1960 func (DaemonSetNodeDesiredScheduled) Description() string {
1961 return "Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)."
1962 }
1963
1964 // Add adds incr to the existing count for attrs.
1965 //
1966 // This metric aligns with the `desiredNumberScheduled` field of the
1967 // [K8s DaemonSetStatus].
1968 //
1969 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
1970 func (m DaemonSetNodeDesiredScheduled) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1971 if len(attrs) == 0 {
1972 m.Int64UpDownCounter.Add(ctx, incr)
1973 return
1974 }
1975
1976 o := addOptPool.Get().(*[]metric.AddOption)
1977 defer func() {
1978 *o = (*o)[:0]
1979 addOptPool.Put(o)
1980 }()
1981
1982 *o = append(*o, metric.WithAttributes(attrs...))
1983 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1984 }
1985
1986 // AddSet adds incr to the existing count for set.
1987 //
1988 // This metric aligns with the `desiredNumberScheduled` field of the
1989 // [K8s DaemonSetStatus].
1990 //
1991 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
1992 func (m DaemonSetNodeDesiredScheduled) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1993 if set.Len() == 0 {
1994 m.Int64UpDownCounter.Add(ctx, incr)
1995 return
1996 }
1997
1998 o := addOptPool.Get().(*[]metric.AddOption)
1999 defer func() {
2000 *o = (*o)[:0]
2001 addOptPool.Put(o)
2002 }()
2003
2004 *o = append(*o, metric.WithAttributeSet(set))
2005 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2006 }
2007
2008 // DaemonSetNodeMisscheduled is an instrument used to record metric values
2009 // conforming to the "k8s.daemonset.node.misscheduled" semantic conventions. It
2010 // represents the number of nodes that are running the daemon pod, but are not
2011 // supposed to run the daemon pod.
2012 type DaemonSetNodeMisscheduled struct {
2013 metric.Int64UpDownCounter
2014 }
2015
2016 var newDaemonSetNodeMisscheduledOpts = []metric.Int64UpDownCounterOption{
2017 metric.WithDescription("Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."),
2018 metric.WithUnit("{node}"),
2019 }
2020
2021 // NewDaemonSetNodeMisscheduled returns a new DaemonSetNodeMisscheduled
2022 // instrument.
2023 func NewDaemonSetNodeMisscheduled(
2024 m metric.Meter,
2025 opt ...metric.Int64UpDownCounterOption,
2026 ) (DaemonSetNodeMisscheduled, error) {
2027 // Check if the meter is nil.
2028 if m == nil {
2029 return DaemonSetNodeMisscheduled{noop.Int64UpDownCounter{}}, nil
2030 }
2031
2032 if len(opt) == 0 {
2033 opt = newDaemonSetNodeMisscheduledOpts
2034 } else {
2035 opt = append(opt, newDaemonSetNodeMisscheduledOpts...)
2036 }
2037
2038 i, err := m.Int64UpDownCounter(
2039 "k8s.daemonset.node.misscheduled",
2040 opt...,
2041 )
2042 if err != nil {
2043 return DaemonSetNodeMisscheduled{noop.Int64UpDownCounter{}}, err
2044 }
2045 return DaemonSetNodeMisscheduled{i}, nil
2046 }
2047
2048 // Inst returns the underlying metric instrument.
2049 func (m DaemonSetNodeMisscheduled) Inst() metric.Int64UpDownCounter {
2050 return m.Int64UpDownCounter
2051 }
2052
2053 // Name returns the semantic convention name of the instrument.
2054 func (DaemonSetNodeMisscheduled) Name() string {
2055 return "k8s.daemonset.node.misscheduled"
2056 }
2057
2058 // Unit returns the semantic convention unit of the instrument
2059 func (DaemonSetNodeMisscheduled) Unit() string {
2060 return "{node}"
2061 }
2062
2063 // Description returns the semantic convention description of the instrument
2064 func (DaemonSetNodeMisscheduled) Description() string {
2065 return "Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."
2066 }
2067
2068 // Add adds incr to the existing count for attrs.
2069 //
2070 // This metric aligns with the `numberMisscheduled` field of the
2071 // [K8s DaemonSetStatus].
2072 //
2073 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
2074 func (m DaemonSetNodeMisscheduled) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
2075 if len(attrs) == 0 {
2076 m.Int64UpDownCounter.Add(ctx, incr)
2077 return
2078 }
2079
2080 o := addOptPool.Get().(*[]metric.AddOption)
2081 defer func() {
2082 *o = (*o)[:0]
2083 addOptPool.Put(o)
2084 }()
2085
2086 *o = append(*o, metric.WithAttributes(attrs...))
2087 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2088 }
2089
2090 // AddSet adds incr to the existing count for set.
2091 //
2092 // This metric aligns with the `numberMisscheduled` field of the
2093 // [K8s DaemonSetStatus].
2094 //
2095 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
2096 func (m DaemonSetNodeMisscheduled) AddSet(ctx context.Context, incr int64, set attribute.Set) {
2097 if set.Len() == 0 {
2098 m.Int64UpDownCounter.Add(ctx, incr)
2099 return
2100 }
2101
2102 o := addOptPool.Get().(*[]metric.AddOption)
2103 defer func() {
2104 *o = (*o)[:0]
2105 addOptPool.Put(o)
2106 }()
2107
2108 *o = append(*o, metric.WithAttributeSet(set))
2109 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2110 }
2111
2112 // DaemonSetNodeReady is an instrument used to record metric values conforming to
2113 // the "k8s.daemonset.node.ready" semantic conventions. It represents the number
2114 // of nodes that should be running the daemon pod and have one or more of the
2115 // daemon pod running and ready.
2116 type DaemonSetNodeReady struct {
2117 metric.Int64UpDownCounter
2118 }
2119
2120 var newDaemonSetNodeReadyOpts = []metric.Int64UpDownCounterOption{
2121 metric.WithDescription("Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready."),
2122 metric.WithUnit("{node}"),
2123 }
2124
2125 // NewDaemonSetNodeReady returns a new DaemonSetNodeReady instrument.
2126 func NewDaemonSetNodeReady(
2127 m metric.Meter,
2128 opt ...metric.Int64UpDownCounterOption,
2129 ) (DaemonSetNodeReady, error) {
2130 // Check if the meter is nil.
2131 if m == nil {
2132 return DaemonSetNodeReady{noop.Int64UpDownCounter{}}, nil
2133 }
2134
2135 if len(opt) == 0 {
2136 opt = newDaemonSetNodeReadyOpts
2137 } else {
2138 opt = append(opt, newDaemonSetNodeReadyOpts...)
2139 }
2140
2141 i, err := m.Int64UpDownCounter(
2142 "k8s.daemonset.node.ready",
2143 opt...,
2144 )
2145 if err != nil {
2146 return DaemonSetNodeReady{noop.Int64UpDownCounter{}}, err
2147 }
2148 return DaemonSetNodeReady{i}, nil
2149 }
2150
2151 // Inst returns the underlying metric instrument.
2152 func (m DaemonSetNodeReady) Inst() metric.Int64UpDownCounter {
2153 return m.Int64UpDownCounter
2154 }
2155
2156 // Name returns the semantic convention name of the instrument.
2157 func (DaemonSetNodeReady) Name() string {
2158 return "k8s.daemonset.node.ready"
2159 }
2160
2161 // Unit returns the semantic convention unit of the instrument
2162 func (DaemonSetNodeReady) Unit() string {
2163 return "{node}"
2164 }
2165
2166 // Description returns the semantic convention description of the instrument
2167 func (DaemonSetNodeReady) Description() string {
2168 return "Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready."
2169 }
2170
2171 // Add adds incr to the existing count for attrs.
2172 //
2173 // This metric aligns with the `numberReady` field of the
2174 // [K8s DaemonSetStatus].
2175 //
2176 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
2177 func (m DaemonSetNodeReady) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
2178 if len(attrs) == 0 {
2179 m.Int64UpDownCounter.Add(ctx, incr)
2180 return
2181 }
2182
2183 o := addOptPool.Get().(*[]metric.AddOption)
2184 defer func() {
2185 *o = (*o)[:0]
2186 addOptPool.Put(o)
2187 }()
2188
2189 *o = append(*o, metric.WithAttributes(attrs...))
2190 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2191 }
2192
2193 // AddSet adds incr to the existing count for set.
2194 //
2195 // This metric aligns with the `numberReady` field of the
2196 // [K8s DaemonSetStatus].
2197 //
2198 // [K8s DaemonSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps
2199 func (m DaemonSetNodeReady) AddSet(ctx context.Context, incr int64, set attribute.Set) {
2200 if set.Len() == 0 {
2201 m.Int64UpDownCounter.Add(ctx, incr)
2202 return
2203 }
2204
2205 o := addOptPool.Get().(*[]metric.AddOption)
2206 defer func() {
2207 *o = (*o)[:0]
2208 addOptPool.Put(o)
2209 }()
2210
2211 *o = append(*o, metric.WithAttributeSet(set))
2212 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2213 }
2214
2215 // DeploymentPodAvailable is an instrument used to record metric values
2216 // conforming to the "k8s.deployment.pod.available" semantic conventions. It
2217 // represents the total number of available replica pods (ready for at least
2218 // minReadySeconds) targeted by this deployment.
2219 type DeploymentPodAvailable struct {
2220 metric.Int64UpDownCounter
2221 }
2222
2223 var newDeploymentPodAvailableOpts = []metric.Int64UpDownCounterOption{
2224 metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment."),
2225 metric.WithUnit("{pod}"),
2226 }
2227
2228 // NewDeploymentPodAvailable returns a new DeploymentPodAvailable instrument.
2229 func NewDeploymentPodAvailable(
2230 m metric.Meter,
2231 opt ...metric.Int64UpDownCounterOption,
2232 ) (DeploymentPodAvailable, error) {
2233 // Check if the meter is nil.
2234 if m == nil {
2235 return DeploymentPodAvailable{noop.Int64UpDownCounter{}}, nil
2236 }
2237
2238 if len(opt) == 0 {
2239 opt = newDeploymentPodAvailableOpts
2240 } else {
2241 opt = append(opt, newDeploymentPodAvailableOpts...)
2242 }
2243
2244 i, err := m.Int64UpDownCounter(
2245 "k8s.deployment.pod.available",
2246 opt...,
2247 )
2248 if err != nil {
2249 return DeploymentPodAvailable{noop.Int64UpDownCounter{}}, err
2250 }
2251 return DeploymentPodAvailable{i}, nil
2252 }
2253
2254 // Inst returns the underlying metric instrument.
2255 func (m DeploymentPodAvailable) Inst() metric.Int64UpDownCounter {
2256 return m.Int64UpDownCounter
2257 }
2258
2259 // Name returns the semantic convention name of the instrument.
2260 func (DeploymentPodAvailable) Name() string {
2261 return "k8s.deployment.pod.available"
2262 }
2263
2264 // Unit returns the semantic convention unit of the instrument
2265 func (DeploymentPodAvailable) Unit() string {
2266 return "{pod}"
2267 }
2268
2269 // Description returns the semantic convention description of the instrument
2270 func (DeploymentPodAvailable) Description() string {
2271 return "Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment."
2272 }
2273
2274 // Add adds incr to the existing count for attrs.
2275 //
2276 // This metric aligns with the `availableReplicas` field of the
2277 // [K8s DeploymentStatus].
2278 //
2279 // [K8s DeploymentStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps
2280 func (m DeploymentPodAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
2281 if len(attrs) == 0 {
2282 m.Int64UpDownCounter.Add(ctx, incr)
2283 return
2284 }
2285
2286 o := addOptPool.Get().(*[]metric.AddOption)
2287 defer func() {
2288 *o = (*o)[:0]
2289 addOptPool.Put(o)
2290 }()
2291
2292 *o = append(*o, metric.WithAttributes(attrs...))
2293 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2294 }
2295
2296 // AddSet adds incr to the existing count for set.
2297 //
2298 // This metric aligns with the `availableReplicas` field of the
2299 // [K8s DeploymentStatus].
2300 //
2301 // [K8s DeploymentStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps
2302 func (m DeploymentPodAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
2303 if set.Len() == 0 {
2304 m.Int64UpDownCounter.Add(ctx, incr)
2305 return
2306 }
2307
2308 o := addOptPool.Get().(*[]metric.AddOption)
2309 defer func() {
2310 *o = (*o)[:0]
2311 addOptPool.Put(o)
2312 }()
2313
2314 *o = append(*o, metric.WithAttributeSet(set))
2315 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2316 }
2317
2318 // DeploymentPodDesired is an instrument used to record metric values conforming
2319 // to the "k8s.deployment.pod.desired" semantic conventions. It represents the
2320 // number of desired replica pods in this deployment.
2321 type DeploymentPodDesired struct {
2322 metric.Int64UpDownCounter
2323 }
2324
2325 var newDeploymentPodDesiredOpts = []metric.Int64UpDownCounterOption{
2326 metric.WithDescription("Number of desired replica pods in this deployment."),
2327 metric.WithUnit("{pod}"),
2328 }
2329
2330 // NewDeploymentPodDesired returns a new DeploymentPodDesired instrument.
2331 func NewDeploymentPodDesired(
2332 m metric.Meter,
2333 opt ...metric.Int64UpDownCounterOption,
2334 ) (DeploymentPodDesired, error) {
2335 // Check if the meter is nil.
2336 if m == nil {
2337 return DeploymentPodDesired{noop.Int64UpDownCounter{}}, nil
2338 }
2339
2340 if len(opt) == 0 {
2341 opt = newDeploymentPodDesiredOpts
2342 } else {
2343 opt = append(opt, newDeploymentPodDesiredOpts...)
2344 }
2345
2346 i, err := m.Int64UpDownCounter(
2347 "k8s.deployment.pod.desired",
2348 opt...,
2349 )
2350 if err != nil {
2351 return DeploymentPodDesired{noop.Int64UpDownCounter{}}, err
2352 }
2353 return DeploymentPodDesired{i}, nil
2354 }
2355
2356 // Inst returns the underlying metric instrument.
2357 func (m DeploymentPodDesired) Inst() metric.Int64UpDownCounter {
2358 return m.Int64UpDownCounter
2359 }
2360
2361 // Name returns the semantic convention name of the instrument.
2362 func (DeploymentPodDesired) Name() string {
2363 return "k8s.deployment.pod.desired"
2364 }
2365
2366 // Unit returns the semantic convention unit of the instrument
2367 func (DeploymentPodDesired) Unit() string {
2368 return "{pod}"
2369 }
2370
2371 // Description returns the semantic convention description of the instrument
2372 func (DeploymentPodDesired) Description() string {
2373 return "Number of desired replica pods in this deployment."
2374 }
2375
2376 // Add adds incr to the existing count for attrs.
2377 //
2378 // This metric aligns with the `replicas` field of the
2379 // [K8s DeploymentSpec].
2380 //
2381 // [K8s DeploymentSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps
2382 func (m DeploymentPodDesired) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
2383 if len(attrs) == 0 {
2384 m.Int64UpDownCounter.Add(ctx, incr)
2385 return
2386 }
2387
2388 o := addOptPool.Get().(*[]metric.AddOption)
2389 defer func() {
2390 *o = (*o)[:0]
2391 addOptPool.Put(o)
2392 }()
2393
2394 *o = append(*o, metric.WithAttributes(attrs...))
2395 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2396 }
2397
2398 // AddSet adds incr to the existing count for set.
2399 //
2400 // This metric aligns with the `replicas` field of the
2401 // [K8s DeploymentSpec].
2402 //
2403 // [K8s DeploymentSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps
2404 func (m DeploymentPodDesired) AddSet(ctx context.Context, incr int64, set attribute.Set) {
2405 if set.Len() == 0 {
2406 m.Int64UpDownCounter.Add(ctx, incr)
2407 return
2408 }
2409
2410 o := addOptPool.Get().(*[]metric.AddOption)
2411 defer func() {
2412 *o = (*o)[:0]
2413 addOptPool.Put(o)
2414 }()
2415
2416 *o = append(*o, metric.WithAttributeSet(set))
2417 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2418 }
2419
2420 // HPAMetricTargetCPUAverageUtilization is an instrument used to record metric
2421 // values conforming to the "k8s.hpa.metric.target.cpu.average_utilization"
2422 // semantic conventions. It represents the target average utilization, in
2423 // percentage, for CPU resource in HPA config.
2424 type HPAMetricTargetCPUAverageUtilization struct {
2425 metric.Int64Gauge
2426 }
2427
2428 var newHPAMetricTargetCPUAverageUtilizationOpts = []metric.Int64GaugeOption{
2429 metric.WithDescription("Target average utilization, in percentage, for CPU resource in HPA config."),
2430 metric.WithUnit("1"),
2431 }
2432
2433 // NewHPAMetricTargetCPUAverageUtilization returns a new
2434 // HPAMetricTargetCPUAverageUtilization instrument.
2435 func NewHPAMetricTargetCPUAverageUtilization(
2436 m metric.Meter,
2437 opt ...metric.Int64GaugeOption,
2438 ) (HPAMetricTargetCPUAverageUtilization, error) {
2439 // Check if the meter is nil.
2440 if m == nil {
2441 return HPAMetricTargetCPUAverageUtilization{noop.Int64Gauge{}}, nil
2442 }
2443
2444 if len(opt) == 0 {
2445 opt = newHPAMetricTargetCPUAverageUtilizationOpts
2446 } else {
2447 opt = append(opt, newHPAMetricTargetCPUAverageUtilizationOpts...)
2448 }
2449
2450 i, err := m.Int64Gauge(
2451 "k8s.hpa.metric.target.cpu.average_utilization",
2452 opt...,
2453 )
2454 if err != nil {
2455 return HPAMetricTargetCPUAverageUtilization{noop.Int64Gauge{}}, err
2456 }
2457 return HPAMetricTargetCPUAverageUtilization{i}, nil
2458 }
2459
2460 // Inst returns the underlying metric instrument.
2461 func (m HPAMetricTargetCPUAverageUtilization) Inst() metric.Int64Gauge {
2462 return m.Int64Gauge
2463 }
2464
2465 // Name returns the semantic convention name of the instrument.
2466 func (HPAMetricTargetCPUAverageUtilization) Name() string {
2467 return "k8s.hpa.metric.target.cpu.average_utilization"
2468 }
2469
2470 // Unit returns the semantic convention unit of the instrument
2471 func (HPAMetricTargetCPUAverageUtilization) Unit() string {
2472 return "1"
2473 }
2474
2475 // Description returns the semantic convention description of the instrument
2476 func (HPAMetricTargetCPUAverageUtilization) Description() string {
2477 return "Target average utilization, in percentage, for CPU resource in HPA config."
2478 }
2479
2480 // Record records val to the current distribution for attrs.
2481 //
2482 // All additional attrs passed are included in the recorded value.
2483 //
2484 // This metric aligns with the `averageUtilization` field of the
2485 // [K8s HPA MetricTarget].
2486 // If the type of the metric is [`ContainerResource`],
2487 // the `k8s.container.name` attribute MUST be set to identify the specific
2488 // container within the pod to which the metric applies.
2489 //
2490 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2491 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2492 func (m HPAMetricTargetCPUAverageUtilization) Record(
2493 ctx context.Context,
2494 val int64,
2495 attrs ...attribute.KeyValue,
2496 ) {
2497 if len(attrs) == 0 {
2498 m.Int64Gauge.Record(ctx, val)
2499 return
2500 }
2501
2502 o := recOptPool.Get().(*[]metric.RecordOption)
2503 defer func() {
2504 *o = (*o)[:0]
2505 recOptPool.Put(o)
2506 }()
2507
2508 *o = append(
2509 *o,
2510 metric.WithAttributes(
2511 attrs...,
2512 ),
2513 )
2514
2515 m.Int64Gauge.Record(ctx, val, *o...)
2516 }
2517
2518 // RecordSet records val to the current distribution for set.
2519 //
2520 // This metric aligns with the `averageUtilization` field of the
2521 // [K8s HPA MetricTarget].
2522 // If the type of the metric is [`ContainerResource`],
2523 // the `k8s.container.name` attribute MUST be set to identify the specific
2524 // container within the pod to which the metric applies.
2525 //
2526 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2527 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2528 func (m HPAMetricTargetCPUAverageUtilization) RecordSet(ctx context.Context, val int64, set attribute.Set) {
2529 if set.Len() == 0 {
2530 m.Int64Gauge.Record(ctx, val)
2531 return
2532 }
2533
2534 o := recOptPool.Get().(*[]metric.RecordOption)
2535 defer func() {
2536 *o = (*o)[:0]
2537 recOptPool.Put(o)
2538 }()
2539
2540 *o = append(*o, metric.WithAttributeSet(set))
2541 m.Int64Gauge.Record(ctx, val, *o...)
2542 }
2543
2544 // AttrContainerName returns an optional attribute for the "k8s.container.name"
2545 // semantic convention. It represents the name of the Container from Pod
2546 // specification, must be unique within a Pod. Container runtime usually uses
2547 // different globally unique name (`container.name`).
2548 func (HPAMetricTargetCPUAverageUtilization) AttrContainerName(val string) attribute.KeyValue {
2549 return attribute.String("k8s.container.name", val)
2550 }
2551
2552 // AttrHPAMetricType returns an optional attribute for the "k8s.hpa.metric.type"
2553 // semantic convention. It represents the type of metric source for the
2554 // horizontal pod autoscaler.
2555 func (HPAMetricTargetCPUAverageUtilization) AttrHPAMetricType(val string) attribute.KeyValue {
2556 return attribute.String("k8s.hpa.metric.type", val)
2557 }
2558
2559 // HPAMetricTargetCPUAverageValue is an instrument used to record metric values
2560 // conforming to the "k8s.hpa.metric.target.cpu.average_value" semantic
2561 // conventions. It represents the target average value for CPU resource in HPA
2562 // config.
2563 type HPAMetricTargetCPUAverageValue struct {
2564 metric.Int64Gauge
2565 }
2566
2567 var newHPAMetricTargetCPUAverageValueOpts = []metric.Int64GaugeOption{
2568 metric.WithDescription("Target average value for CPU resource in HPA config."),
2569 metric.WithUnit("{cpu}"),
2570 }
2571
2572 // NewHPAMetricTargetCPUAverageValue returns a new HPAMetricTargetCPUAverageValue
2573 // instrument.
2574 func NewHPAMetricTargetCPUAverageValue(
2575 m metric.Meter,
2576 opt ...metric.Int64GaugeOption,
2577 ) (HPAMetricTargetCPUAverageValue, error) {
2578 // Check if the meter is nil.
2579 if m == nil {
2580 return HPAMetricTargetCPUAverageValue{noop.Int64Gauge{}}, nil
2581 }
2582
2583 if len(opt) == 0 {
2584 opt = newHPAMetricTargetCPUAverageValueOpts
2585 } else {
2586 opt = append(opt, newHPAMetricTargetCPUAverageValueOpts...)
2587 }
2588
2589 i, err := m.Int64Gauge(
2590 "k8s.hpa.metric.target.cpu.average_value",
2591 opt...,
2592 )
2593 if err != nil {
2594 return HPAMetricTargetCPUAverageValue{noop.Int64Gauge{}}, err
2595 }
2596 return HPAMetricTargetCPUAverageValue{i}, nil
2597 }
2598
2599 // Inst returns the underlying metric instrument.
2600 func (m HPAMetricTargetCPUAverageValue) Inst() metric.Int64Gauge {
2601 return m.Int64Gauge
2602 }
2603
2604 // Name returns the semantic convention name of the instrument.
2605 func (HPAMetricTargetCPUAverageValue) Name() string {
2606 return "k8s.hpa.metric.target.cpu.average_value"
2607 }
2608
2609 // Unit returns the semantic convention unit of the instrument
2610 func (HPAMetricTargetCPUAverageValue) Unit() string {
2611 return "{cpu}"
2612 }
2613
2614 // Description returns the semantic convention description of the instrument
2615 func (HPAMetricTargetCPUAverageValue) Description() string {
2616 return "Target average value for CPU resource in HPA config."
2617 }
2618
2619 // Record records val to the current distribution for attrs.
2620 //
2621 // All additional attrs passed are included in the recorded value.
2622 //
2623 // This metric aligns with the `averageValue` field of the
2624 // [K8s HPA MetricTarget].
2625 // If the type of the metric is [`ContainerResource`],
2626 // the `k8s.container.name` attribute MUST be set to identify the specific
2627 // container within the pod to which the metric applies.
2628 //
2629 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2630 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2631 func (m HPAMetricTargetCPUAverageValue) Record(
2632 ctx context.Context,
2633 val int64,
2634 attrs ...attribute.KeyValue,
2635 ) {
2636 if len(attrs) == 0 {
2637 m.Int64Gauge.Record(ctx, val)
2638 return
2639 }
2640
2641 o := recOptPool.Get().(*[]metric.RecordOption)
2642 defer func() {
2643 *o = (*o)[:0]
2644 recOptPool.Put(o)
2645 }()
2646
2647 *o = append(
2648 *o,
2649 metric.WithAttributes(
2650 attrs...,
2651 ),
2652 )
2653
2654 m.Int64Gauge.Record(ctx, val, *o...)
2655 }
2656
2657 // RecordSet records val to the current distribution for set.
2658 //
2659 // This metric aligns with the `averageValue` field of the
2660 // [K8s HPA MetricTarget].
2661 // If the type of the metric is [`ContainerResource`],
2662 // the `k8s.container.name` attribute MUST be set to identify the specific
2663 // container within the pod to which the metric applies.
2664 //
2665 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2666 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2667 func (m HPAMetricTargetCPUAverageValue) RecordSet(ctx context.Context, val int64, set attribute.Set) {
2668 if set.Len() == 0 {
2669 m.Int64Gauge.Record(ctx, val)
2670 return
2671 }
2672
2673 o := recOptPool.Get().(*[]metric.RecordOption)
2674 defer func() {
2675 *o = (*o)[:0]
2676 recOptPool.Put(o)
2677 }()
2678
2679 *o = append(*o, metric.WithAttributeSet(set))
2680 m.Int64Gauge.Record(ctx, val, *o...)
2681 }
2682
2683 // AttrContainerName returns an optional attribute for the "k8s.container.name"
2684 // semantic convention. It represents the name of the Container from Pod
2685 // specification, must be unique within a Pod. Container runtime usually uses
2686 // different globally unique name (`container.name`).
2687 func (HPAMetricTargetCPUAverageValue) AttrContainerName(val string) attribute.KeyValue {
2688 return attribute.String("k8s.container.name", val)
2689 }
2690
2691 // AttrHPAMetricType returns an optional attribute for the "k8s.hpa.metric.type"
2692 // semantic convention. It represents the type of metric source for the
2693 // horizontal pod autoscaler.
2694 func (HPAMetricTargetCPUAverageValue) AttrHPAMetricType(val string) attribute.KeyValue {
2695 return attribute.String("k8s.hpa.metric.type", val)
2696 }
2697
2698 // HPAMetricTargetCPUValue is an instrument used to record metric values
2699 // conforming to the "k8s.hpa.metric.target.cpu.value" semantic conventions. It
2700 // represents the target value for CPU resource in HPA config.
2701 type HPAMetricTargetCPUValue struct {
2702 metric.Int64Gauge
2703 }
2704
2705 var newHPAMetricTargetCPUValueOpts = []metric.Int64GaugeOption{
2706 metric.WithDescription("Target value for CPU resource in HPA config."),
2707 metric.WithUnit("{cpu}"),
2708 }
2709
2710 // NewHPAMetricTargetCPUValue returns a new HPAMetricTargetCPUValue instrument.
2711 func NewHPAMetricTargetCPUValue(
2712 m metric.Meter,
2713 opt ...metric.Int64GaugeOption,
2714 ) (HPAMetricTargetCPUValue, error) {
2715 // Check if the meter is nil.
2716 if m == nil {
2717 return HPAMetricTargetCPUValue{noop.Int64Gauge{}}, nil
2718 }
2719
2720 if len(opt) == 0 {
2721 opt = newHPAMetricTargetCPUValueOpts
2722 } else {
2723 opt = append(opt, newHPAMetricTargetCPUValueOpts...)
2724 }
2725
2726 i, err := m.Int64Gauge(
2727 "k8s.hpa.metric.target.cpu.value",
2728 opt...,
2729 )
2730 if err != nil {
2731 return HPAMetricTargetCPUValue{noop.Int64Gauge{}}, err
2732 }
2733 return HPAMetricTargetCPUValue{i}, nil
2734 }
2735
2736 // Inst returns the underlying metric instrument.
2737 func (m HPAMetricTargetCPUValue) Inst() metric.Int64Gauge {
2738 return m.Int64Gauge
2739 }
2740
2741 // Name returns the semantic convention name of the instrument.
2742 func (HPAMetricTargetCPUValue) Name() string {
2743 return "k8s.hpa.metric.target.cpu.value"
2744 }
2745
2746 // Unit returns the semantic convention unit of the instrument
2747 func (HPAMetricTargetCPUValue) Unit() string {
2748 return "{cpu}"
2749 }
2750
2751 // Description returns the semantic convention description of the instrument
2752 func (HPAMetricTargetCPUValue) Description() string {
2753 return "Target value for CPU resource in HPA config."
2754 }
2755
2756 // Record records val to the current distribution for attrs.
2757 //
2758 // All additional attrs passed are included in the recorded value.
2759 //
2760 // This metric aligns with the `value` field of the
2761 // [K8s HPA MetricTarget].
2762 // If the type of the metric is [`ContainerResource`],
2763 // the `k8s.container.name` attribute MUST be set to identify the specific
2764 // container within the pod to which the metric applies.
2765 //
2766 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2767 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2768 func (m HPAMetricTargetCPUValue) Record(
2769 ctx context.Context,
2770 val int64,
2771 attrs ...attribute.KeyValue,
2772 ) {
2773 if len(attrs) == 0 {
2774 m.Int64Gauge.Record(ctx, val)
2775 return
2776 }
2777
2778 o := recOptPool.Get().(*[]metric.RecordOption)
2779 defer func() {
2780 *o = (*o)[:0]
2781 recOptPool.Put(o)
2782 }()
2783
2784 *o = append(
2785 *o,
2786 metric.WithAttributes(
2787 attrs...,
2788 ),
2789 )
2790
2791 m.Int64Gauge.Record(ctx, val, *o...)
2792 }
2793
2794 // RecordSet records val to the current distribution for set.
2795 //
2796 // This metric aligns with the `value` field of the
2797 // [K8s HPA MetricTarget].
2798 // If the type of the metric is [`ContainerResource`],
2799 // the `k8s.container.name` attribute MUST be set to identify the specific
2800 // container within the pod to which the metric applies.
2801 //
2802 // [K8s HPA MetricTarget]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling
2803 // [`ContainerResource`]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
2804 func (m HPAMetricTargetCPUValue) RecordSet(ctx context.Context, val int64, set attribute.Set) {
2805 if set.Len() == 0 {
2806 m.Int64Gauge.Record(ctx, val)
2807 return
2808 }
2809
2810 o := recOptPool.Get().(*[]metric.RecordOption)
2811 defer func() {
2812 *o = (*o)[:0]
2813 recOptPool.Put(o)
2814 }()
2815
2816 *o = append(*o, metric.WithAttributeSet(set))
2817 m.Int64Gauge.Record(ctx, val, *o...)
2818 }
2819
2820 // AttrContainerName returns an optional attribute for the "k8s.container.name"
2821 // semantic convention. It represents the name of the Container from Pod
2822 // specification, must be unique within a Pod. Container runtime usually uses
2823 // different globally unique name (`container.name`).
2824 func (HPAMetricTargetCPUValue) AttrContainerName(val string) attribute.KeyValue {
2825 return attribute.String("k8s.container.name", val)
2826 }
2827
2828 // AttrHPAMetricType returns an optional attribute for the "k8s.hpa.metric.type"
2829 // semantic convention. It represents the type of metric source for the
2830 // horizontal pod autoscaler.
2831 func (HPAMetricTargetCPUValue) AttrHPAMetricType(val string) attribute.KeyValue {
2832 return attribute.String("k8s.hpa.metric.type", val)
2833 }
2834
2835 // HPAPodCurrent is an instrument used to record metric values conforming to the
2836 // "k8s.hpa.pod.current" semantic conventions. It represents the current number
2837 // of replica pods managed by this horizontal pod autoscaler, as last seen by the
2838 // autoscaler.
2839 type HPAPodCurrent struct {
2840 metric.Int64UpDownCounter
2841 }
2842
2843 var newHPAPodCurrentOpts = []metric.Int64UpDownCounterOption{
2844 metric.WithDescription("Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler."),
2845 metric.WithUnit("{pod}"),
2846 }
2847
2848 // NewHPAPodCurrent returns a new HPAPodCurrent instrument.
2849 func NewHPAPodCurrent(
2850 m metric.Meter,
2851 opt ...metric.Int64UpDownCounterOption,
2852 ) (HPAPodCurrent, error) {
2853 // Check if the meter is nil.
2854 if m == nil {
2855 return HPAPodCurrent{noop.Int64UpDownCounter{}}, nil
2856 }
2857
2858 if len(opt) == 0 {
2859 opt = newHPAPodCurrentOpts
2860 } else {
2861 opt = append(opt, newHPAPodCurrentOpts...)
2862 }
2863
2864 i, err := m.Int64UpDownCounter(
2865 "k8s.hpa.pod.current",
2866 opt...,
2867 )
2868 if err != nil {
2869 return HPAPodCurrent{noop.Int64UpDownCounter{}}, err
2870 }
2871 return HPAPodCurrent{i}, nil
2872 }
2873
2874 // Inst returns the underlying metric instrument.
2875 func (m HPAPodCurrent) Inst() metric.Int64UpDownCounter {
2876 return m.Int64UpDownCounter
2877 }
2878
2879 // Name returns the semantic convention name of the instrument.
2880 func (HPAPodCurrent) Name() string {
2881 return "k8s.hpa.pod.current"
2882 }
2883
2884 // Unit returns the semantic convention unit of the instrument
2885 func (HPAPodCurrent) Unit() string {
2886 return "{pod}"
2887 }
2888
2889 // Description returns the semantic convention description of the instrument
2890 func (HPAPodCurrent) Description() string {
2891 return "Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler."
2892 }
2893
2894 // Add adds incr to the existing count for attrs.
2895 //
2896 // This metric aligns with the `currentReplicas` field of the
2897 // [K8s HorizontalPodAutoscalerStatus]
2898 //
2899 // [K8s HorizontalPodAutoscalerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling
2900 func (m HPAPodCurrent) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
2901 if len(attrs) == 0 {
2902 m.Int64UpDownCounter.Add(ctx, incr)
2903 return
2904 }
2905
2906 o := addOptPool.Get().(*[]metric.AddOption)
2907 defer func() {
2908 *o = (*o)[:0]
2909 addOptPool.Put(o)
2910 }()
2911
2912 *o = append(*o, metric.WithAttributes(attrs...))
2913 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2914 }
2915
2916 // AddSet adds incr to the existing count for set.
2917 //
2918 // This metric aligns with the `currentReplicas` field of the
2919 // [K8s HorizontalPodAutoscalerStatus]
2920 //
2921 // [K8s HorizontalPodAutoscalerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling
2922 func (m HPAPodCurrent) AddSet(ctx context.Context, incr int64, set attribute.Set) {
2923 if set.Len() == 0 {
2924 m.Int64UpDownCounter.Add(ctx, incr)
2925 return
2926 }
2927
2928 o := addOptPool.Get().(*[]metric.AddOption)
2929 defer func() {
2930 *o = (*o)[:0]
2931 addOptPool.Put(o)
2932 }()
2933
2934 *o = append(*o, metric.WithAttributeSet(set))
2935 m.Int64UpDownCounter.Add(ctx, incr, *o...)
2936 }
2937
2938 // HPAPodDesired is an instrument used to record metric values conforming to the
2939 // "k8s.hpa.pod.desired" semantic conventions. It represents the desired number
2940 // of replica pods managed by this horizontal pod autoscaler, as last calculated
2941 // by the autoscaler.
2942 type HPAPodDesired struct {
2943 metric.Int64UpDownCounter
2944 }
2945
2946 var newHPAPodDesiredOpts = []metric.Int64UpDownCounterOption{
2947 metric.WithDescription("Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler."),
2948 metric.WithUnit("{pod}"),
2949 }
2950
2951 // NewHPAPodDesired returns a new HPAPodDesired instrument.
2952 func NewHPAPodDesired(
2953 m metric.Meter,
2954 opt ...metric.Int64UpDownCounterOption,
2955 ) (HPAPodDesired, error) {
2956 // Check if the meter is nil.
2957 if m == nil {
2958 return HPAPodDesired{noop.Int64UpDownCounter{}}, nil
2959 }
2960
2961 if len(opt) == 0 {
2962 opt = newHPAPodDesiredOpts
2963 } else {
2964 opt = append(opt, newHPAPodDesiredOpts...)
2965 }
2966
2967 i, err := m.Int64UpDownCounter(
2968 "k8s.hpa.pod.desired",
2969 opt...,
2970 )
2971 if err != nil {
2972 return HPAPodDesired{noop.Int64UpDownCounter{}}, err
2973 }
2974 return HPAPodDesired{i}, nil
2975 }
2976
2977 // Inst returns the underlying metric instrument.
2978 func (m HPAPodDesired) Inst() metric.Int64UpDownCounter {
2979 return m.Int64UpDownCounter
2980 }
2981
2982 // Name returns the semantic convention name of the instrument.
2983 func (HPAPodDesired) Name() string {
2984 return "k8s.hpa.pod.desired"
2985 }
2986
2987 // Unit returns the semantic convention unit of the instrument
2988 func (HPAPodDesired) Unit() string {
2989 return "{pod}"
2990 }
2991
2992 // Description returns the semantic convention description of the instrument
2993 func (HPAPodDesired) Description() string {
2994 return "Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler."
2995 }
2996
2997 // Add adds incr to the existing count for attrs.
2998 //
2999 // This metric aligns with the `desiredReplicas` field of the
3000 // [K8s HorizontalPodAutoscalerStatus]
3001 //
3002 // [K8s HorizontalPodAutoscalerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling
3003 func (m HPAPodDesired) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3004 if len(attrs) == 0 {
3005 m.Int64UpDownCounter.Add(ctx, incr)
3006 return
3007 }
3008
3009 o := addOptPool.Get().(*[]metric.AddOption)
3010 defer func() {
3011 *o = (*o)[:0]
3012 addOptPool.Put(o)
3013 }()
3014
3015 *o = append(*o, metric.WithAttributes(attrs...))
3016 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3017 }
3018
3019 // AddSet adds incr to the existing count for set.
3020 //
3021 // This metric aligns with the `desiredReplicas` field of the
3022 // [K8s HorizontalPodAutoscalerStatus]
3023 //
3024 // [K8s HorizontalPodAutoscalerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling
3025 func (m HPAPodDesired) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3026 if set.Len() == 0 {
3027 m.Int64UpDownCounter.Add(ctx, incr)
3028 return
3029 }
3030
3031 o := addOptPool.Get().(*[]metric.AddOption)
3032 defer func() {
3033 *o = (*o)[:0]
3034 addOptPool.Put(o)
3035 }()
3036
3037 *o = append(*o, metric.WithAttributeSet(set))
3038 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3039 }
3040
3041 // HPAPodMax is an instrument used to record metric values conforming to the
3042 // "k8s.hpa.pod.max" semantic conventions. It represents the upper limit for the
3043 // number of replica pods to which the autoscaler can scale up.
3044 type HPAPodMax struct {
3045 metric.Int64UpDownCounter
3046 }
3047
3048 var newHPAPodMaxOpts = []metric.Int64UpDownCounterOption{
3049 metric.WithDescription("The upper limit for the number of replica pods to which the autoscaler can scale up."),
3050 metric.WithUnit("{pod}"),
3051 }
3052
3053 // NewHPAPodMax returns a new HPAPodMax instrument.
3054 func NewHPAPodMax(
3055 m metric.Meter,
3056 opt ...metric.Int64UpDownCounterOption,
3057 ) (HPAPodMax, error) {
3058 // Check if the meter is nil.
3059 if m == nil {
3060 return HPAPodMax{noop.Int64UpDownCounter{}}, nil
3061 }
3062
3063 if len(opt) == 0 {
3064 opt = newHPAPodMaxOpts
3065 } else {
3066 opt = append(opt, newHPAPodMaxOpts...)
3067 }
3068
3069 i, err := m.Int64UpDownCounter(
3070 "k8s.hpa.pod.max",
3071 opt...,
3072 )
3073 if err != nil {
3074 return HPAPodMax{noop.Int64UpDownCounter{}}, err
3075 }
3076 return HPAPodMax{i}, nil
3077 }
3078
3079 // Inst returns the underlying metric instrument.
3080 func (m HPAPodMax) Inst() metric.Int64UpDownCounter {
3081 return m.Int64UpDownCounter
3082 }
3083
3084 // Name returns the semantic convention name of the instrument.
3085 func (HPAPodMax) Name() string {
3086 return "k8s.hpa.pod.max"
3087 }
3088
3089 // Unit returns the semantic convention unit of the instrument
3090 func (HPAPodMax) Unit() string {
3091 return "{pod}"
3092 }
3093
3094 // Description returns the semantic convention description of the instrument
3095 func (HPAPodMax) Description() string {
3096 return "The upper limit for the number of replica pods to which the autoscaler can scale up."
3097 }
3098
3099 // Add adds incr to the existing count for attrs.
3100 //
3101 // This metric aligns with the `maxReplicas` field of the
3102 // [K8s HorizontalPodAutoscalerSpec]
3103 //
3104 // [K8s HorizontalPodAutoscalerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling
3105 func (m HPAPodMax) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3106 if len(attrs) == 0 {
3107 m.Int64UpDownCounter.Add(ctx, incr)
3108 return
3109 }
3110
3111 o := addOptPool.Get().(*[]metric.AddOption)
3112 defer func() {
3113 *o = (*o)[:0]
3114 addOptPool.Put(o)
3115 }()
3116
3117 *o = append(*o, metric.WithAttributes(attrs...))
3118 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3119 }
3120
3121 // AddSet adds incr to the existing count for set.
3122 //
3123 // This metric aligns with the `maxReplicas` field of the
3124 // [K8s HorizontalPodAutoscalerSpec]
3125 //
3126 // [K8s HorizontalPodAutoscalerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling
3127 func (m HPAPodMax) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3128 if set.Len() == 0 {
3129 m.Int64UpDownCounter.Add(ctx, incr)
3130 return
3131 }
3132
3133 o := addOptPool.Get().(*[]metric.AddOption)
3134 defer func() {
3135 *o = (*o)[:0]
3136 addOptPool.Put(o)
3137 }()
3138
3139 *o = append(*o, metric.WithAttributeSet(set))
3140 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3141 }
3142
3143 // HPAPodMin is an instrument used to record metric values conforming to the
3144 // "k8s.hpa.pod.min" semantic conventions. It represents the lower limit for the
3145 // number of replica pods to which the autoscaler can scale down.
3146 type HPAPodMin struct {
3147 metric.Int64UpDownCounter
3148 }
3149
3150 var newHPAPodMinOpts = []metric.Int64UpDownCounterOption{
3151 metric.WithDescription("The lower limit for the number of replica pods to which the autoscaler can scale down."),
3152 metric.WithUnit("{pod}"),
3153 }
3154
3155 // NewHPAPodMin returns a new HPAPodMin instrument.
3156 func NewHPAPodMin(
3157 m metric.Meter,
3158 opt ...metric.Int64UpDownCounterOption,
3159 ) (HPAPodMin, error) {
3160 // Check if the meter is nil.
3161 if m == nil {
3162 return HPAPodMin{noop.Int64UpDownCounter{}}, nil
3163 }
3164
3165 if len(opt) == 0 {
3166 opt = newHPAPodMinOpts
3167 } else {
3168 opt = append(opt, newHPAPodMinOpts...)
3169 }
3170
3171 i, err := m.Int64UpDownCounter(
3172 "k8s.hpa.pod.min",
3173 opt...,
3174 )
3175 if err != nil {
3176 return HPAPodMin{noop.Int64UpDownCounter{}}, err
3177 }
3178 return HPAPodMin{i}, nil
3179 }
3180
3181 // Inst returns the underlying metric instrument.
3182 func (m HPAPodMin) Inst() metric.Int64UpDownCounter {
3183 return m.Int64UpDownCounter
3184 }
3185
3186 // Name returns the semantic convention name of the instrument.
3187 func (HPAPodMin) Name() string {
3188 return "k8s.hpa.pod.min"
3189 }
3190
3191 // Unit returns the semantic convention unit of the instrument
3192 func (HPAPodMin) Unit() string {
3193 return "{pod}"
3194 }
3195
3196 // Description returns the semantic convention description of the instrument
3197 func (HPAPodMin) Description() string {
3198 return "The lower limit for the number of replica pods to which the autoscaler can scale down."
3199 }
3200
3201 // Add adds incr to the existing count for attrs.
3202 //
3203 // This metric aligns with the `minReplicas` field of the
3204 // [K8s HorizontalPodAutoscalerSpec]
3205 //
3206 // [K8s HorizontalPodAutoscalerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling
3207 func (m HPAPodMin) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3208 if len(attrs) == 0 {
3209 m.Int64UpDownCounter.Add(ctx, incr)
3210 return
3211 }
3212
3213 o := addOptPool.Get().(*[]metric.AddOption)
3214 defer func() {
3215 *o = (*o)[:0]
3216 addOptPool.Put(o)
3217 }()
3218
3219 *o = append(*o, metric.WithAttributes(attrs...))
3220 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3221 }
3222
3223 // AddSet adds incr to the existing count for set.
3224 //
3225 // This metric aligns with the `minReplicas` field of the
3226 // [K8s HorizontalPodAutoscalerSpec]
3227 //
3228 // [K8s HorizontalPodAutoscalerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling
3229 func (m HPAPodMin) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3230 if set.Len() == 0 {
3231 m.Int64UpDownCounter.Add(ctx, incr)
3232 return
3233 }
3234
3235 o := addOptPool.Get().(*[]metric.AddOption)
3236 defer func() {
3237 *o = (*o)[:0]
3238 addOptPool.Put(o)
3239 }()
3240
3241 *o = append(*o, metric.WithAttributeSet(set))
3242 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3243 }
3244
3245 // JobPodActive is an instrument used to record metric values conforming to the
3246 // "k8s.job.pod.active" semantic conventions. It represents the number of pending
3247 // and actively running pods for a job.
3248 type JobPodActive struct {
3249 metric.Int64UpDownCounter
3250 }
3251
3252 var newJobPodActiveOpts = []metric.Int64UpDownCounterOption{
3253 metric.WithDescription("The number of pending and actively running pods for a job."),
3254 metric.WithUnit("{pod}"),
3255 }
3256
3257 // NewJobPodActive returns a new JobPodActive instrument.
3258 func NewJobPodActive(
3259 m metric.Meter,
3260 opt ...metric.Int64UpDownCounterOption,
3261 ) (JobPodActive, error) {
3262 // Check if the meter is nil.
3263 if m == nil {
3264 return JobPodActive{noop.Int64UpDownCounter{}}, nil
3265 }
3266
3267 if len(opt) == 0 {
3268 opt = newJobPodActiveOpts
3269 } else {
3270 opt = append(opt, newJobPodActiveOpts...)
3271 }
3272
3273 i, err := m.Int64UpDownCounter(
3274 "k8s.job.pod.active",
3275 opt...,
3276 )
3277 if err != nil {
3278 return JobPodActive{noop.Int64UpDownCounter{}}, err
3279 }
3280 return JobPodActive{i}, nil
3281 }
3282
3283 // Inst returns the underlying metric instrument.
3284 func (m JobPodActive) Inst() metric.Int64UpDownCounter {
3285 return m.Int64UpDownCounter
3286 }
3287
3288 // Name returns the semantic convention name of the instrument.
3289 func (JobPodActive) Name() string {
3290 return "k8s.job.pod.active"
3291 }
3292
3293 // Unit returns the semantic convention unit of the instrument
3294 func (JobPodActive) Unit() string {
3295 return "{pod}"
3296 }
3297
3298 // Description returns the semantic convention description of the instrument
3299 func (JobPodActive) Description() string {
3300 return "The number of pending and actively running pods for a job."
3301 }
3302
3303 // Add adds incr to the existing count for attrs.
3304 //
3305 // This metric aligns with the `active` field of the
3306 // [K8s JobStatus].
3307 //
3308 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3309 func (m JobPodActive) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3310 if len(attrs) == 0 {
3311 m.Int64UpDownCounter.Add(ctx, incr)
3312 return
3313 }
3314
3315 o := addOptPool.Get().(*[]metric.AddOption)
3316 defer func() {
3317 *o = (*o)[:0]
3318 addOptPool.Put(o)
3319 }()
3320
3321 *o = append(*o, metric.WithAttributes(attrs...))
3322 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3323 }
3324
3325 // AddSet adds incr to the existing count for set.
3326 //
3327 // This metric aligns with the `active` field of the
3328 // [K8s JobStatus].
3329 //
3330 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3331 func (m JobPodActive) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3332 if set.Len() == 0 {
3333 m.Int64UpDownCounter.Add(ctx, incr)
3334 return
3335 }
3336
3337 o := addOptPool.Get().(*[]metric.AddOption)
3338 defer func() {
3339 *o = (*o)[:0]
3340 addOptPool.Put(o)
3341 }()
3342
3343 *o = append(*o, metric.WithAttributeSet(set))
3344 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3345 }
3346
3347 // JobPodDesiredSuccessful is an instrument used to record metric values
3348 // conforming to the "k8s.job.pod.desired_successful" semantic conventions. It
3349 // represents the desired number of successfully finished pods the job should be
3350 // run with.
3351 type JobPodDesiredSuccessful struct {
3352 metric.Int64UpDownCounter
3353 }
3354
3355 var newJobPodDesiredSuccessfulOpts = []metric.Int64UpDownCounterOption{
3356 metric.WithDescription("The desired number of successfully finished pods the job should be run with."),
3357 metric.WithUnit("{pod}"),
3358 }
3359
3360 // NewJobPodDesiredSuccessful returns a new JobPodDesiredSuccessful instrument.
3361 func NewJobPodDesiredSuccessful(
3362 m metric.Meter,
3363 opt ...metric.Int64UpDownCounterOption,
3364 ) (JobPodDesiredSuccessful, error) {
3365 // Check if the meter is nil.
3366 if m == nil {
3367 return JobPodDesiredSuccessful{noop.Int64UpDownCounter{}}, nil
3368 }
3369
3370 if len(opt) == 0 {
3371 opt = newJobPodDesiredSuccessfulOpts
3372 } else {
3373 opt = append(opt, newJobPodDesiredSuccessfulOpts...)
3374 }
3375
3376 i, err := m.Int64UpDownCounter(
3377 "k8s.job.pod.desired_successful",
3378 opt...,
3379 )
3380 if err != nil {
3381 return JobPodDesiredSuccessful{noop.Int64UpDownCounter{}}, err
3382 }
3383 return JobPodDesiredSuccessful{i}, nil
3384 }
3385
3386 // Inst returns the underlying metric instrument.
3387 func (m JobPodDesiredSuccessful) Inst() metric.Int64UpDownCounter {
3388 return m.Int64UpDownCounter
3389 }
3390
3391 // Name returns the semantic convention name of the instrument.
3392 func (JobPodDesiredSuccessful) Name() string {
3393 return "k8s.job.pod.desired_successful"
3394 }
3395
3396 // Unit returns the semantic convention unit of the instrument
3397 func (JobPodDesiredSuccessful) Unit() string {
3398 return "{pod}"
3399 }
3400
3401 // Description returns the semantic convention description of the instrument
3402 func (JobPodDesiredSuccessful) Description() string {
3403 return "The desired number of successfully finished pods the job should be run with."
3404 }
3405
3406 // Add adds incr to the existing count for attrs.
3407 //
3408 // This metric aligns with the `completions` field of the
3409 // [K8s JobSpec]..
3410 //
3411 // [K8s JobSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch
3412 func (m JobPodDesiredSuccessful) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3413 if len(attrs) == 0 {
3414 m.Int64UpDownCounter.Add(ctx, incr)
3415 return
3416 }
3417
3418 o := addOptPool.Get().(*[]metric.AddOption)
3419 defer func() {
3420 *o = (*o)[:0]
3421 addOptPool.Put(o)
3422 }()
3423
3424 *o = append(*o, metric.WithAttributes(attrs...))
3425 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3426 }
3427
3428 // AddSet adds incr to the existing count for set.
3429 //
3430 // This metric aligns with the `completions` field of the
3431 // [K8s JobSpec]..
3432 //
3433 // [K8s JobSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch
3434 func (m JobPodDesiredSuccessful) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3435 if set.Len() == 0 {
3436 m.Int64UpDownCounter.Add(ctx, incr)
3437 return
3438 }
3439
3440 o := addOptPool.Get().(*[]metric.AddOption)
3441 defer func() {
3442 *o = (*o)[:0]
3443 addOptPool.Put(o)
3444 }()
3445
3446 *o = append(*o, metric.WithAttributeSet(set))
3447 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3448 }
3449
3450 // JobPodFailed is an instrument used to record metric values conforming to the
3451 // "k8s.job.pod.failed" semantic conventions. It represents the number of pods
3452 // which reached phase Failed for a job.
3453 type JobPodFailed struct {
3454 metric.Int64UpDownCounter
3455 }
3456
3457 var newJobPodFailedOpts = []metric.Int64UpDownCounterOption{
3458 metric.WithDescription("The number of pods which reached phase Failed for a job."),
3459 metric.WithUnit("{pod}"),
3460 }
3461
3462 // NewJobPodFailed returns a new JobPodFailed instrument.
3463 func NewJobPodFailed(
3464 m metric.Meter,
3465 opt ...metric.Int64UpDownCounterOption,
3466 ) (JobPodFailed, error) {
3467 // Check if the meter is nil.
3468 if m == nil {
3469 return JobPodFailed{noop.Int64UpDownCounter{}}, nil
3470 }
3471
3472 if len(opt) == 0 {
3473 opt = newJobPodFailedOpts
3474 } else {
3475 opt = append(opt, newJobPodFailedOpts...)
3476 }
3477
3478 i, err := m.Int64UpDownCounter(
3479 "k8s.job.pod.failed",
3480 opt...,
3481 )
3482 if err != nil {
3483 return JobPodFailed{noop.Int64UpDownCounter{}}, err
3484 }
3485 return JobPodFailed{i}, nil
3486 }
3487
3488 // Inst returns the underlying metric instrument.
3489 func (m JobPodFailed) Inst() metric.Int64UpDownCounter {
3490 return m.Int64UpDownCounter
3491 }
3492
3493 // Name returns the semantic convention name of the instrument.
3494 func (JobPodFailed) Name() string {
3495 return "k8s.job.pod.failed"
3496 }
3497
3498 // Unit returns the semantic convention unit of the instrument
3499 func (JobPodFailed) Unit() string {
3500 return "{pod}"
3501 }
3502
3503 // Description returns the semantic convention description of the instrument
3504 func (JobPodFailed) Description() string {
3505 return "The number of pods which reached phase Failed for a job."
3506 }
3507
3508 // Add adds incr to the existing count for attrs.
3509 //
3510 // This metric aligns with the `failed` field of the
3511 // [K8s JobStatus].
3512 //
3513 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3514 func (m JobPodFailed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3515 if len(attrs) == 0 {
3516 m.Int64UpDownCounter.Add(ctx, incr)
3517 return
3518 }
3519
3520 o := addOptPool.Get().(*[]metric.AddOption)
3521 defer func() {
3522 *o = (*o)[:0]
3523 addOptPool.Put(o)
3524 }()
3525
3526 *o = append(*o, metric.WithAttributes(attrs...))
3527 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3528 }
3529
3530 // AddSet adds incr to the existing count for set.
3531 //
3532 // This metric aligns with the `failed` field of the
3533 // [K8s JobStatus].
3534 //
3535 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3536 func (m JobPodFailed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3537 if set.Len() == 0 {
3538 m.Int64UpDownCounter.Add(ctx, incr)
3539 return
3540 }
3541
3542 o := addOptPool.Get().(*[]metric.AddOption)
3543 defer func() {
3544 *o = (*o)[:0]
3545 addOptPool.Put(o)
3546 }()
3547
3548 *o = append(*o, metric.WithAttributeSet(set))
3549 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3550 }
3551
3552 // JobPodMaxParallel is an instrument used to record metric values conforming to
3553 // the "k8s.job.pod.max_parallel" semantic conventions. It represents the max
3554 // desired number of pods the job should run at any given time.
3555 type JobPodMaxParallel struct {
3556 metric.Int64UpDownCounter
3557 }
3558
3559 var newJobPodMaxParallelOpts = []metric.Int64UpDownCounterOption{
3560 metric.WithDescription("The max desired number of pods the job should run at any given time."),
3561 metric.WithUnit("{pod}"),
3562 }
3563
3564 // NewJobPodMaxParallel returns a new JobPodMaxParallel instrument.
3565 func NewJobPodMaxParallel(
3566 m metric.Meter,
3567 opt ...metric.Int64UpDownCounterOption,
3568 ) (JobPodMaxParallel, error) {
3569 // Check if the meter is nil.
3570 if m == nil {
3571 return JobPodMaxParallel{noop.Int64UpDownCounter{}}, nil
3572 }
3573
3574 if len(opt) == 0 {
3575 opt = newJobPodMaxParallelOpts
3576 } else {
3577 opt = append(opt, newJobPodMaxParallelOpts...)
3578 }
3579
3580 i, err := m.Int64UpDownCounter(
3581 "k8s.job.pod.max_parallel",
3582 opt...,
3583 )
3584 if err != nil {
3585 return JobPodMaxParallel{noop.Int64UpDownCounter{}}, err
3586 }
3587 return JobPodMaxParallel{i}, nil
3588 }
3589
3590 // Inst returns the underlying metric instrument.
3591 func (m JobPodMaxParallel) Inst() metric.Int64UpDownCounter {
3592 return m.Int64UpDownCounter
3593 }
3594
3595 // Name returns the semantic convention name of the instrument.
3596 func (JobPodMaxParallel) Name() string {
3597 return "k8s.job.pod.max_parallel"
3598 }
3599
3600 // Unit returns the semantic convention unit of the instrument
3601 func (JobPodMaxParallel) Unit() string {
3602 return "{pod}"
3603 }
3604
3605 // Description returns the semantic convention description of the instrument
3606 func (JobPodMaxParallel) Description() string {
3607 return "The max desired number of pods the job should run at any given time."
3608 }
3609
3610 // Add adds incr to the existing count for attrs.
3611 //
3612 // This metric aligns with the `parallelism` field of the
3613 // [K8s JobSpec].
3614 //
3615 // [K8s JobSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch
3616 func (m JobPodMaxParallel) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3617 if len(attrs) == 0 {
3618 m.Int64UpDownCounter.Add(ctx, incr)
3619 return
3620 }
3621
3622 o := addOptPool.Get().(*[]metric.AddOption)
3623 defer func() {
3624 *o = (*o)[:0]
3625 addOptPool.Put(o)
3626 }()
3627
3628 *o = append(*o, metric.WithAttributes(attrs...))
3629 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3630 }
3631
3632 // AddSet adds incr to the existing count for set.
3633 //
3634 // This metric aligns with the `parallelism` field of the
3635 // [K8s JobSpec].
3636 //
3637 // [K8s JobSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch
3638 func (m JobPodMaxParallel) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3639 if set.Len() == 0 {
3640 m.Int64UpDownCounter.Add(ctx, incr)
3641 return
3642 }
3643
3644 o := addOptPool.Get().(*[]metric.AddOption)
3645 defer func() {
3646 *o = (*o)[:0]
3647 addOptPool.Put(o)
3648 }()
3649
3650 *o = append(*o, metric.WithAttributeSet(set))
3651 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3652 }
3653
3654 // JobPodSuccessful is an instrument used to record metric values conforming to
3655 // the "k8s.job.pod.successful" semantic conventions. It represents the number of
3656 // pods which reached phase Succeeded for a job.
3657 type JobPodSuccessful struct {
3658 metric.Int64UpDownCounter
3659 }
3660
3661 var newJobPodSuccessfulOpts = []metric.Int64UpDownCounterOption{
3662 metric.WithDescription("The number of pods which reached phase Succeeded for a job."),
3663 metric.WithUnit("{pod}"),
3664 }
3665
3666 // NewJobPodSuccessful returns a new JobPodSuccessful instrument.
3667 func NewJobPodSuccessful(
3668 m metric.Meter,
3669 opt ...metric.Int64UpDownCounterOption,
3670 ) (JobPodSuccessful, error) {
3671 // Check if the meter is nil.
3672 if m == nil {
3673 return JobPodSuccessful{noop.Int64UpDownCounter{}}, nil
3674 }
3675
3676 if len(opt) == 0 {
3677 opt = newJobPodSuccessfulOpts
3678 } else {
3679 opt = append(opt, newJobPodSuccessfulOpts...)
3680 }
3681
3682 i, err := m.Int64UpDownCounter(
3683 "k8s.job.pod.successful",
3684 opt...,
3685 )
3686 if err != nil {
3687 return JobPodSuccessful{noop.Int64UpDownCounter{}}, err
3688 }
3689 return JobPodSuccessful{i}, nil
3690 }
3691
3692 // Inst returns the underlying metric instrument.
3693 func (m JobPodSuccessful) Inst() metric.Int64UpDownCounter {
3694 return m.Int64UpDownCounter
3695 }
3696
3697 // Name returns the semantic convention name of the instrument.
3698 func (JobPodSuccessful) Name() string {
3699 return "k8s.job.pod.successful"
3700 }
3701
3702 // Unit returns the semantic convention unit of the instrument
3703 func (JobPodSuccessful) Unit() string {
3704 return "{pod}"
3705 }
3706
3707 // Description returns the semantic convention description of the instrument
3708 func (JobPodSuccessful) Description() string {
3709 return "The number of pods which reached phase Succeeded for a job."
3710 }
3711
3712 // Add adds incr to the existing count for attrs.
3713 //
3714 // This metric aligns with the `succeeded` field of the
3715 // [K8s JobStatus].
3716 //
3717 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3718 func (m JobPodSuccessful) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
3719 if len(attrs) == 0 {
3720 m.Int64UpDownCounter.Add(ctx, incr)
3721 return
3722 }
3723
3724 o := addOptPool.Get().(*[]metric.AddOption)
3725 defer func() {
3726 *o = (*o)[:0]
3727 addOptPool.Put(o)
3728 }()
3729
3730 *o = append(*o, metric.WithAttributes(attrs...))
3731 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3732 }
3733
3734 // AddSet adds incr to the existing count for set.
3735 //
3736 // This metric aligns with the `succeeded` field of the
3737 // [K8s JobStatus].
3738 //
3739 // [K8s JobStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch
3740 func (m JobPodSuccessful) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3741 if set.Len() == 0 {
3742 m.Int64UpDownCounter.Add(ctx, incr)
3743 return
3744 }
3745
3746 o := addOptPool.Get().(*[]metric.AddOption)
3747 defer func() {
3748 *o = (*o)[:0]
3749 addOptPool.Put(o)
3750 }()
3751
3752 *o = append(*o, metric.WithAttributeSet(set))
3753 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3754 }
3755
3756 // NamespacePhase is an instrument used to record metric values conforming to the
3757 // "k8s.namespace.phase" semantic conventions. It represents the describes number
3758 // of K8s namespaces that are currently in a given phase.
3759 type NamespacePhase struct {
3760 metric.Int64UpDownCounter
3761 }
3762
3763 var newNamespacePhaseOpts = []metric.Int64UpDownCounterOption{
3764 metric.WithDescription("Describes number of K8s namespaces that are currently in a given phase."),
3765 metric.WithUnit("{namespace}"),
3766 }
3767
3768 // NewNamespacePhase returns a new NamespacePhase instrument.
3769 func NewNamespacePhase(
3770 m metric.Meter,
3771 opt ...metric.Int64UpDownCounterOption,
3772 ) (NamespacePhase, error) {
3773 // Check if the meter is nil.
3774 if m == nil {
3775 return NamespacePhase{noop.Int64UpDownCounter{}}, nil
3776 }
3777
3778 if len(opt) == 0 {
3779 opt = newNamespacePhaseOpts
3780 } else {
3781 opt = append(opt, newNamespacePhaseOpts...)
3782 }
3783
3784 i, err := m.Int64UpDownCounter(
3785 "k8s.namespace.phase",
3786 opt...,
3787 )
3788 if err != nil {
3789 return NamespacePhase{noop.Int64UpDownCounter{}}, err
3790 }
3791 return NamespacePhase{i}, nil
3792 }
3793
3794 // Inst returns the underlying metric instrument.
3795 func (m NamespacePhase) Inst() metric.Int64UpDownCounter {
3796 return m.Int64UpDownCounter
3797 }
3798
3799 // Name returns the semantic convention name of the instrument.
3800 func (NamespacePhase) Name() string {
3801 return "k8s.namespace.phase"
3802 }
3803
3804 // Unit returns the semantic convention unit of the instrument
3805 func (NamespacePhase) Unit() string {
3806 return "{namespace}"
3807 }
3808
3809 // Description returns the semantic convention description of the instrument
3810 func (NamespacePhase) Description() string {
3811 return "Describes number of K8s namespaces that are currently in a given phase."
3812 }
3813
3814 // Add adds incr to the existing count for attrs.
3815 //
3816 // The namespacePhase is the the phase of the K8s namespace.
3817 func (m NamespacePhase) Add(
3818 ctx context.Context,
3819 incr int64,
3820 namespacePhase NamespacePhaseAttr,
3821 attrs ...attribute.KeyValue,
3822 ) {
3823 if len(attrs) == 0 {
3824 m.Int64UpDownCounter.Add(ctx, incr)
3825 return
3826 }
3827
3828 o := addOptPool.Get().(*[]metric.AddOption)
3829 defer func() {
3830 *o = (*o)[:0]
3831 addOptPool.Put(o)
3832 }()
3833
3834 *o = append(
3835 *o,
3836 metric.WithAttributes(
3837 append(
3838 attrs,
3839 attribute.String("k8s.namespace.phase", string(namespacePhase)),
3840 )...,
3841 ),
3842 )
3843
3844 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3845 }
3846
3847 // AddSet adds incr to the existing count for set.
3848 func (m NamespacePhase) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3849 if set.Len() == 0 {
3850 m.Int64UpDownCounter.Add(ctx, incr)
3851 return
3852 }
3853
3854 o := addOptPool.Get().(*[]metric.AddOption)
3855 defer func() {
3856 *o = (*o)[:0]
3857 addOptPool.Put(o)
3858 }()
3859
3860 *o = append(*o, metric.WithAttributeSet(set))
3861 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3862 }
3863
3864 // NodeConditionStatus is an instrument used to record metric values conforming
3865 // to the "k8s.node.condition.status" semantic conventions. It represents the
3866 // describes the condition of a particular Node.
3867 type NodeConditionStatus struct {
3868 metric.Int64UpDownCounter
3869 }
3870
3871 var newNodeConditionStatusOpts = []metric.Int64UpDownCounterOption{
3872 metric.WithDescription("Describes the condition of a particular Node."),
3873 metric.WithUnit("{node}"),
3874 }
3875
3876 // NewNodeConditionStatus returns a new NodeConditionStatus instrument.
3877 func NewNodeConditionStatus(
3878 m metric.Meter,
3879 opt ...metric.Int64UpDownCounterOption,
3880 ) (NodeConditionStatus, error) {
3881 // Check if the meter is nil.
3882 if m == nil {
3883 return NodeConditionStatus{noop.Int64UpDownCounter{}}, nil
3884 }
3885
3886 if len(opt) == 0 {
3887 opt = newNodeConditionStatusOpts
3888 } else {
3889 opt = append(opt, newNodeConditionStatusOpts...)
3890 }
3891
3892 i, err := m.Int64UpDownCounter(
3893 "k8s.node.condition.status",
3894 opt...,
3895 )
3896 if err != nil {
3897 return NodeConditionStatus{noop.Int64UpDownCounter{}}, err
3898 }
3899 return NodeConditionStatus{i}, nil
3900 }
3901
3902 // Inst returns the underlying metric instrument.
3903 func (m NodeConditionStatus) Inst() metric.Int64UpDownCounter {
3904 return m.Int64UpDownCounter
3905 }
3906
3907 // Name returns the semantic convention name of the instrument.
3908 func (NodeConditionStatus) Name() string {
3909 return "k8s.node.condition.status"
3910 }
3911
3912 // Unit returns the semantic convention unit of the instrument
3913 func (NodeConditionStatus) Unit() string {
3914 return "{node}"
3915 }
3916
3917 // Description returns the semantic convention description of the instrument
3918 func (NodeConditionStatus) Description() string {
3919 return "Describes the condition of a particular Node."
3920 }
3921
3922 // Add adds incr to the existing count for attrs.
3923 //
3924 // The nodeConditionStatus is the the status of the condition, one of True,
3925 // False, Unknown.
3926 //
3927 // The nodeConditionType is the the condition type of a K8s Node.
3928 //
3929 // All possible node condition pairs (type and status) will be reported at each
3930 // time interval to avoid missing metrics. Condition pairs corresponding to the
3931 // current conditions' statuses will be non-zero.
3932 func (m NodeConditionStatus) Add(
3933 ctx context.Context,
3934 incr int64,
3935 nodeConditionStatus NodeConditionStatusAttr,
3936 nodeConditionType NodeConditionTypeAttr,
3937 attrs ...attribute.KeyValue,
3938 ) {
3939 if len(attrs) == 0 {
3940 m.Int64UpDownCounter.Add(ctx, incr)
3941 return
3942 }
3943
3944 o := addOptPool.Get().(*[]metric.AddOption)
3945 defer func() {
3946 *o = (*o)[:0]
3947 addOptPool.Put(o)
3948 }()
3949
3950 *o = append(
3951 *o,
3952 metric.WithAttributes(
3953 append(
3954 attrs,
3955 attribute.String("k8s.node.condition.status", string(nodeConditionStatus)),
3956 attribute.String("k8s.node.condition.type", string(nodeConditionType)),
3957 )...,
3958 ),
3959 )
3960
3961 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3962 }
3963
3964 // AddSet adds incr to the existing count for set.
3965 //
3966 // All possible node condition pairs (type and status) will be reported at each
3967 // time interval to avoid missing metrics. Condition pairs corresponding to the
3968 // current conditions' statuses will be non-zero.
3969 func (m NodeConditionStatus) AddSet(ctx context.Context, incr int64, set attribute.Set) {
3970 if set.Len() == 0 {
3971 m.Int64UpDownCounter.Add(ctx, incr)
3972 return
3973 }
3974
3975 o := addOptPool.Get().(*[]metric.AddOption)
3976 defer func() {
3977 *o = (*o)[:0]
3978 addOptPool.Put(o)
3979 }()
3980
3981 *o = append(*o, metric.WithAttributeSet(set))
3982 m.Int64UpDownCounter.Add(ctx, incr, *o...)
3983 }
3984
3985 // NodeCPUAllocatable is an instrument used to record metric values conforming to
3986 // the "k8s.node.cpu.allocatable" semantic conventions. It represents the amount
3987 // of cpu allocatable on the node.
3988 type NodeCPUAllocatable struct {
3989 metric.Int64UpDownCounter
3990 }
3991
3992 var newNodeCPUAllocatableOpts = []metric.Int64UpDownCounterOption{
3993 metric.WithDescription("Amount of cpu allocatable on the node."),
3994 metric.WithUnit("{cpu}"),
3995 }
3996
3997 // NewNodeCPUAllocatable returns a new NodeCPUAllocatable instrument.
3998 func NewNodeCPUAllocatable(
3999 m metric.Meter,
4000 opt ...metric.Int64UpDownCounterOption,
4001 ) (NodeCPUAllocatable, error) {
4002 // Check if the meter is nil.
4003 if m == nil {
4004 return NodeCPUAllocatable{noop.Int64UpDownCounter{}}, nil
4005 }
4006
4007 if len(opt) == 0 {
4008 opt = newNodeCPUAllocatableOpts
4009 } else {
4010 opt = append(opt, newNodeCPUAllocatableOpts...)
4011 }
4012
4013 i, err := m.Int64UpDownCounter(
4014 "k8s.node.cpu.allocatable",
4015 opt...,
4016 )
4017 if err != nil {
4018 return NodeCPUAllocatable{noop.Int64UpDownCounter{}}, err
4019 }
4020 return NodeCPUAllocatable{i}, nil
4021 }
4022
4023 // Inst returns the underlying metric instrument.
4024 func (m NodeCPUAllocatable) Inst() metric.Int64UpDownCounter {
4025 return m.Int64UpDownCounter
4026 }
4027
4028 // Name returns the semantic convention name of the instrument.
4029 func (NodeCPUAllocatable) Name() string {
4030 return "k8s.node.cpu.allocatable"
4031 }
4032
4033 // Unit returns the semantic convention unit of the instrument
4034 func (NodeCPUAllocatable) Unit() string {
4035 return "{cpu}"
4036 }
4037
4038 // Description returns the semantic convention description of the instrument
4039 func (NodeCPUAllocatable) Description() string {
4040 return "Amount of cpu allocatable on the node."
4041 }
4042
4043 // Add adds incr to the existing count for attrs.
4044 func (m NodeCPUAllocatable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4045 if len(attrs) == 0 {
4046 m.Int64UpDownCounter.Add(ctx, incr)
4047 return
4048 }
4049
4050 o := addOptPool.Get().(*[]metric.AddOption)
4051 defer func() {
4052 *o = (*o)[:0]
4053 addOptPool.Put(o)
4054 }()
4055
4056 *o = append(*o, metric.WithAttributes(attrs...))
4057 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4058 }
4059
4060 // AddSet adds incr to the existing count for set.
4061 func (m NodeCPUAllocatable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4062 if set.Len() == 0 {
4063 m.Int64UpDownCounter.Add(ctx, incr)
4064 return
4065 }
4066
4067 o := addOptPool.Get().(*[]metric.AddOption)
4068 defer func() {
4069 *o = (*o)[:0]
4070 addOptPool.Put(o)
4071 }()
4072
4073 *o = append(*o, metric.WithAttributeSet(set))
4074 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4075 }
4076
4077 // NodeCPUTime is an instrument used to record metric values conforming to the
4078 // "k8s.node.cpu.time" semantic conventions. It represents the total CPU time
4079 // consumed.
4080 type NodeCPUTime struct {
4081 metric.Float64Counter
4082 }
4083
4084 var newNodeCPUTimeOpts = []metric.Float64CounterOption{
4085 metric.WithDescription("Total CPU time consumed."),
4086 metric.WithUnit("s"),
4087 }
4088
4089 // NewNodeCPUTime returns a new NodeCPUTime instrument.
4090 func NewNodeCPUTime(
4091 m metric.Meter,
4092 opt ...metric.Float64CounterOption,
4093 ) (NodeCPUTime, error) {
4094 // Check if the meter is nil.
4095 if m == nil {
4096 return NodeCPUTime{noop.Float64Counter{}}, nil
4097 }
4098
4099 if len(opt) == 0 {
4100 opt = newNodeCPUTimeOpts
4101 } else {
4102 opt = append(opt, newNodeCPUTimeOpts...)
4103 }
4104
4105 i, err := m.Float64Counter(
4106 "k8s.node.cpu.time",
4107 opt...,
4108 )
4109 if err != nil {
4110 return NodeCPUTime{noop.Float64Counter{}}, err
4111 }
4112 return NodeCPUTime{i}, nil
4113 }
4114
4115 // Inst returns the underlying metric instrument.
4116 func (m NodeCPUTime) Inst() metric.Float64Counter {
4117 return m.Float64Counter
4118 }
4119
4120 // Name returns the semantic convention name of the instrument.
4121 func (NodeCPUTime) Name() string {
4122 return "k8s.node.cpu.time"
4123 }
4124
4125 // Unit returns the semantic convention unit of the instrument
4126 func (NodeCPUTime) Unit() string {
4127 return "s"
4128 }
4129
4130 // Description returns the semantic convention description of the instrument
4131 func (NodeCPUTime) Description() string {
4132 return "Total CPU time consumed."
4133 }
4134
4135 // Add adds incr to the existing count for attrs.
4136 //
4137 // Total CPU time consumed by the specific Node on all available CPU cores
4138 func (m NodeCPUTime) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
4139 if len(attrs) == 0 {
4140 m.Float64Counter.Add(ctx, incr)
4141 return
4142 }
4143
4144 o := addOptPool.Get().(*[]metric.AddOption)
4145 defer func() {
4146 *o = (*o)[:0]
4147 addOptPool.Put(o)
4148 }()
4149
4150 *o = append(*o, metric.WithAttributes(attrs...))
4151 m.Float64Counter.Add(ctx, incr, *o...)
4152 }
4153
4154 // AddSet adds incr to the existing count for set.
4155 //
4156 // Total CPU time consumed by the specific Node on all available CPU cores
4157 func (m NodeCPUTime) AddSet(ctx context.Context, incr float64, set attribute.Set) {
4158 if set.Len() == 0 {
4159 m.Float64Counter.Add(ctx, incr)
4160 return
4161 }
4162
4163 o := addOptPool.Get().(*[]metric.AddOption)
4164 defer func() {
4165 *o = (*o)[:0]
4166 addOptPool.Put(o)
4167 }()
4168
4169 *o = append(*o, metric.WithAttributeSet(set))
4170 m.Float64Counter.Add(ctx, incr, *o...)
4171 }
4172
4173 // NodeCPUUsage is an instrument used to record metric values conforming to the
4174 // "k8s.node.cpu.usage" semantic conventions. It represents the node's CPU usage,
4175 // measured in cpus. Range from 0 to the number of allocatable CPUs.
4176 type NodeCPUUsage struct {
4177 metric.Int64Gauge
4178 }
4179
4180 var newNodeCPUUsageOpts = []metric.Int64GaugeOption{
4181 metric.WithDescription("Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."),
4182 metric.WithUnit("{cpu}"),
4183 }
4184
4185 // NewNodeCPUUsage returns a new NodeCPUUsage instrument.
4186 func NewNodeCPUUsage(
4187 m metric.Meter,
4188 opt ...metric.Int64GaugeOption,
4189 ) (NodeCPUUsage, error) {
4190 // Check if the meter is nil.
4191 if m == nil {
4192 return NodeCPUUsage{noop.Int64Gauge{}}, nil
4193 }
4194
4195 if len(opt) == 0 {
4196 opt = newNodeCPUUsageOpts
4197 } else {
4198 opt = append(opt, newNodeCPUUsageOpts...)
4199 }
4200
4201 i, err := m.Int64Gauge(
4202 "k8s.node.cpu.usage",
4203 opt...,
4204 )
4205 if err != nil {
4206 return NodeCPUUsage{noop.Int64Gauge{}}, err
4207 }
4208 return NodeCPUUsage{i}, nil
4209 }
4210
4211 // Inst returns the underlying metric instrument.
4212 func (m NodeCPUUsage) Inst() metric.Int64Gauge {
4213 return m.Int64Gauge
4214 }
4215
4216 // Name returns the semantic convention name of the instrument.
4217 func (NodeCPUUsage) Name() string {
4218 return "k8s.node.cpu.usage"
4219 }
4220
4221 // Unit returns the semantic convention unit of the instrument
4222 func (NodeCPUUsage) Unit() string {
4223 return "{cpu}"
4224 }
4225
4226 // Description returns the semantic convention description of the instrument
4227 func (NodeCPUUsage) Description() string {
4228 return "Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."
4229 }
4230
4231 // Record records val to the current distribution for attrs.
4232 //
4233 // CPU usage of the specific Node on all available CPU cores, averaged over the
4234 // sample window
4235 func (m NodeCPUUsage) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
4236 if len(attrs) == 0 {
4237 m.Int64Gauge.Record(ctx, val)
4238 return
4239 }
4240
4241 o := recOptPool.Get().(*[]metric.RecordOption)
4242 defer func() {
4243 *o = (*o)[:0]
4244 recOptPool.Put(o)
4245 }()
4246
4247 *o = append(*o, metric.WithAttributes(attrs...))
4248 m.Int64Gauge.Record(ctx, val, *o...)
4249 }
4250
4251 // RecordSet records val to the current distribution for set.
4252 //
4253 // CPU usage of the specific Node on all available CPU cores, averaged over the
4254 // sample window
4255 func (m NodeCPUUsage) RecordSet(ctx context.Context, val int64, set attribute.Set) {
4256 if set.Len() == 0 {
4257 m.Int64Gauge.Record(ctx, val)
4258 return
4259 }
4260
4261 o := recOptPool.Get().(*[]metric.RecordOption)
4262 defer func() {
4263 *o = (*o)[:0]
4264 recOptPool.Put(o)
4265 }()
4266
4267 *o = append(*o, metric.WithAttributeSet(set))
4268 m.Int64Gauge.Record(ctx, val, *o...)
4269 }
4270
4271 // NodeEphemeralStorageAllocatable is an instrument used to record metric values
4272 // conforming to the "k8s.node.ephemeral_storage.allocatable" semantic
4273 // conventions. It represents the amount of ephemeral-storage allocatable on the
4274 // node.
4275 type NodeEphemeralStorageAllocatable struct {
4276 metric.Int64UpDownCounter
4277 }
4278
4279 var newNodeEphemeralStorageAllocatableOpts = []metric.Int64UpDownCounterOption{
4280 metric.WithDescription("Amount of ephemeral-storage allocatable on the node."),
4281 metric.WithUnit("By"),
4282 }
4283
4284 // NewNodeEphemeralStorageAllocatable returns a new
4285 // NodeEphemeralStorageAllocatable instrument.
4286 func NewNodeEphemeralStorageAllocatable(
4287 m metric.Meter,
4288 opt ...metric.Int64UpDownCounterOption,
4289 ) (NodeEphemeralStorageAllocatable, error) {
4290 // Check if the meter is nil.
4291 if m == nil {
4292 return NodeEphemeralStorageAllocatable{noop.Int64UpDownCounter{}}, nil
4293 }
4294
4295 if len(opt) == 0 {
4296 opt = newNodeEphemeralStorageAllocatableOpts
4297 } else {
4298 opt = append(opt, newNodeEphemeralStorageAllocatableOpts...)
4299 }
4300
4301 i, err := m.Int64UpDownCounter(
4302 "k8s.node.ephemeral_storage.allocatable",
4303 opt...,
4304 )
4305 if err != nil {
4306 return NodeEphemeralStorageAllocatable{noop.Int64UpDownCounter{}}, err
4307 }
4308 return NodeEphemeralStorageAllocatable{i}, nil
4309 }
4310
4311 // Inst returns the underlying metric instrument.
4312 func (m NodeEphemeralStorageAllocatable) Inst() metric.Int64UpDownCounter {
4313 return m.Int64UpDownCounter
4314 }
4315
4316 // Name returns the semantic convention name of the instrument.
4317 func (NodeEphemeralStorageAllocatable) Name() string {
4318 return "k8s.node.ephemeral_storage.allocatable"
4319 }
4320
4321 // Unit returns the semantic convention unit of the instrument
4322 func (NodeEphemeralStorageAllocatable) Unit() string {
4323 return "By"
4324 }
4325
4326 // Description returns the semantic convention description of the instrument
4327 func (NodeEphemeralStorageAllocatable) Description() string {
4328 return "Amount of ephemeral-storage allocatable on the node."
4329 }
4330
4331 // Add adds incr to the existing count for attrs.
4332 func (m NodeEphemeralStorageAllocatable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4333 if len(attrs) == 0 {
4334 m.Int64UpDownCounter.Add(ctx, incr)
4335 return
4336 }
4337
4338 o := addOptPool.Get().(*[]metric.AddOption)
4339 defer func() {
4340 *o = (*o)[:0]
4341 addOptPool.Put(o)
4342 }()
4343
4344 *o = append(*o, metric.WithAttributes(attrs...))
4345 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4346 }
4347
4348 // AddSet adds incr to the existing count for set.
4349 func (m NodeEphemeralStorageAllocatable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4350 if set.Len() == 0 {
4351 m.Int64UpDownCounter.Add(ctx, incr)
4352 return
4353 }
4354
4355 o := addOptPool.Get().(*[]metric.AddOption)
4356 defer func() {
4357 *o = (*o)[:0]
4358 addOptPool.Put(o)
4359 }()
4360
4361 *o = append(*o, metric.WithAttributeSet(set))
4362 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4363 }
4364
4365 // NodeFilesystemAvailable is an instrument used to record metric values
4366 // conforming to the "k8s.node.filesystem.available" semantic conventions. It
4367 // represents the node filesystem available bytes.
4368 type NodeFilesystemAvailable struct {
4369 metric.Int64UpDownCounter
4370 }
4371
4372 var newNodeFilesystemAvailableOpts = []metric.Int64UpDownCounterOption{
4373 metric.WithDescription("Node filesystem available bytes."),
4374 metric.WithUnit("By"),
4375 }
4376
4377 // NewNodeFilesystemAvailable returns a new NodeFilesystemAvailable instrument.
4378 func NewNodeFilesystemAvailable(
4379 m metric.Meter,
4380 opt ...metric.Int64UpDownCounterOption,
4381 ) (NodeFilesystemAvailable, error) {
4382 // Check if the meter is nil.
4383 if m == nil {
4384 return NodeFilesystemAvailable{noop.Int64UpDownCounter{}}, nil
4385 }
4386
4387 if len(opt) == 0 {
4388 opt = newNodeFilesystemAvailableOpts
4389 } else {
4390 opt = append(opt, newNodeFilesystemAvailableOpts...)
4391 }
4392
4393 i, err := m.Int64UpDownCounter(
4394 "k8s.node.filesystem.available",
4395 opt...,
4396 )
4397 if err != nil {
4398 return NodeFilesystemAvailable{noop.Int64UpDownCounter{}}, err
4399 }
4400 return NodeFilesystemAvailable{i}, nil
4401 }
4402
4403 // Inst returns the underlying metric instrument.
4404 func (m NodeFilesystemAvailable) Inst() metric.Int64UpDownCounter {
4405 return m.Int64UpDownCounter
4406 }
4407
4408 // Name returns the semantic convention name of the instrument.
4409 func (NodeFilesystemAvailable) Name() string {
4410 return "k8s.node.filesystem.available"
4411 }
4412
4413 // Unit returns the semantic convention unit of the instrument
4414 func (NodeFilesystemAvailable) Unit() string {
4415 return "By"
4416 }
4417
4418 // Description returns the semantic convention description of the instrument
4419 func (NodeFilesystemAvailable) Description() string {
4420 return "Node filesystem available bytes."
4421 }
4422
4423 // Add adds incr to the existing count for attrs.
4424 //
4425 // This metric is derived from the
4426 // [FsStats.AvailableBytes] field
4427 // of the [NodeStats.Fs]
4428 // of the Kubelet's stats API.
4429 //
4430 // [FsStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4431 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4432 func (m NodeFilesystemAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4433 if len(attrs) == 0 {
4434 m.Int64UpDownCounter.Add(ctx, incr)
4435 return
4436 }
4437
4438 o := addOptPool.Get().(*[]metric.AddOption)
4439 defer func() {
4440 *o = (*o)[:0]
4441 addOptPool.Put(o)
4442 }()
4443
4444 *o = append(*o, metric.WithAttributes(attrs...))
4445 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4446 }
4447
4448 // AddSet adds incr to the existing count for set.
4449 //
4450 // This metric is derived from the
4451 // [FsStats.AvailableBytes] field
4452 // of the [NodeStats.Fs]
4453 // of the Kubelet's stats API.
4454 //
4455 // [FsStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4456 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4457 func (m NodeFilesystemAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4458 if set.Len() == 0 {
4459 m.Int64UpDownCounter.Add(ctx, incr)
4460 return
4461 }
4462
4463 o := addOptPool.Get().(*[]metric.AddOption)
4464 defer func() {
4465 *o = (*o)[:0]
4466 addOptPool.Put(o)
4467 }()
4468
4469 *o = append(*o, metric.WithAttributeSet(set))
4470 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4471 }
4472
4473 // NodeFilesystemCapacity is an instrument used to record metric values
4474 // conforming to the "k8s.node.filesystem.capacity" semantic conventions. It
4475 // represents the node filesystem capacity.
4476 type NodeFilesystemCapacity struct {
4477 metric.Int64UpDownCounter
4478 }
4479
4480 var newNodeFilesystemCapacityOpts = []metric.Int64UpDownCounterOption{
4481 metric.WithDescription("Node filesystem capacity."),
4482 metric.WithUnit("By"),
4483 }
4484
4485 // NewNodeFilesystemCapacity returns a new NodeFilesystemCapacity instrument.
4486 func NewNodeFilesystemCapacity(
4487 m metric.Meter,
4488 opt ...metric.Int64UpDownCounterOption,
4489 ) (NodeFilesystemCapacity, error) {
4490 // Check if the meter is nil.
4491 if m == nil {
4492 return NodeFilesystemCapacity{noop.Int64UpDownCounter{}}, nil
4493 }
4494
4495 if len(opt) == 0 {
4496 opt = newNodeFilesystemCapacityOpts
4497 } else {
4498 opt = append(opt, newNodeFilesystemCapacityOpts...)
4499 }
4500
4501 i, err := m.Int64UpDownCounter(
4502 "k8s.node.filesystem.capacity",
4503 opt...,
4504 )
4505 if err != nil {
4506 return NodeFilesystemCapacity{noop.Int64UpDownCounter{}}, err
4507 }
4508 return NodeFilesystemCapacity{i}, nil
4509 }
4510
4511 // Inst returns the underlying metric instrument.
4512 func (m NodeFilesystemCapacity) Inst() metric.Int64UpDownCounter {
4513 return m.Int64UpDownCounter
4514 }
4515
4516 // Name returns the semantic convention name of the instrument.
4517 func (NodeFilesystemCapacity) Name() string {
4518 return "k8s.node.filesystem.capacity"
4519 }
4520
4521 // Unit returns the semantic convention unit of the instrument
4522 func (NodeFilesystemCapacity) Unit() string {
4523 return "By"
4524 }
4525
4526 // Description returns the semantic convention description of the instrument
4527 func (NodeFilesystemCapacity) Description() string {
4528 return "Node filesystem capacity."
4529 }
4530
4531 // Add adds incr to the existing count for attrs.
4532 //
4533 // This metric is derived from the
4534 // [FsStats.CapacityBytes] field
4535 // of the [NodeStats.Fs]
4536 // of the Kubelet's stats API.
4537 //
4538 // [FsStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4539 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4540 func (m NodeFilesystemCapacity) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4541 if len(attrs) == 0 {
4542 m.Int64UpDownCounter.Add(ctx, incr)
4543 return
4544 }
4545
4546 o := addOptPool.Get().(*[]metric.AddOption)
4547 defer func() {
4548 *o = (*o)[:0]
4549 addOptPool.Put(o)
4550 }()
4551
4552 *o = append(*o, metric.WithAttributes(attrs...))
4553 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4554 }
4555
4556 // AddSet adds incr to the existing count for set.
4557 //
4558 // This metric is derived from the
4559 // [FsStats.CapacityBytes] field
4560 // of the [NodeStats.Fs]
4561 // of the Kubelet's stats API.
4562 //
4563 // [FsStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4564 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4565 func (m NodeFilesystemCapacity) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4566 if set.Len() == 0 {
4567 m.Int64UpDownCounter.Add(ctx, incr)
4568 return
4569 }
4570
4571 o := addOptPool.Get().(*[]metric.AddOption)
4572 defer func() {
4573 *o = (*o)[:0]
4574 addOptPool.Put(o)
4575 }()
4576
4577 *o = append(*o, metric.WithAttributeSet(set))
4578 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4579 }
4580
4581 // NodeFilesystemUsage is an instrument used to record metric values conforming
4582 // to the "k8s.node.filesystem.usage" semantic conventions. It represents the
4583 // node filesystem usage.
4584 type NodeFilesystemUsage struct {
4585 metric.Int64UpDownCounter
4586 }
4587
4588 var newNodeFilesystemUsageOpts = []metric.Int64UpDownCounterOption{
4589 metric.WithDescription("Node filesystem usage."),
4590 metric.WithUnit("By"),
4591 }
4592
4593 // NewNodeFilesystemUsage returns a new NodeFilesystemUsage instrument.
4594 func NewNodeFilesystemUsage(
4595 m metric.Meter,
4596 opt ...metric.Int64UpDownCounterOption,
4597 ) (NodeFilesystemUsage, error) {
4598 // Check if the meter is nil.
4599 if m == nil {
4600 return NodeFilesystemUsage{noop.Int64UpDownCounter{}}, nil
4601 }
4602
4603 if len(opt) == 0 {
4604 opt = newNodeFilesystemUsageOpts
4605 } else {
4606 opt = append(opt, newNodeFilesystemUsageOpts...)
4607 }
4608
4609 i, err := m.Int64UpDownCounter(
4610 "k8s.node.filesystem.usage",
4611 opt...,
4612 )
4613 if err != nil {
4614 return NodeFilesystemUsage{noop.Int64UpDownCounter{}}, err
4615 }
4616 return NodeFilesystemUsage{i}, nil
4617 }
4618
4619 // Inst returns the underlying metric instrument.
4620 func (m NodeFilesystemUsage) Inst() metric.Int64UpDownCounter {
4621 return m.Int64UpDownCounter
4622 }
4623
4624 // Name returns the semantic convention name of the instrument.
4625 func (NodeFilesystemUsage) Name() string {
4626 return "k8s.node.filesystem.usage"
4627 }
4628
4629 // Unit returns the semantic convention unit of the instrument
4630 func (NodeFilesystemUsage) Unit() string {
4631 return "By"
4632 }
4633
4634 // Description returns the semantic convention description of the instrument
4635 func (NodeFilesystemUsage) Description() string {
4636 return "Node filesystem usage."
4637 }
4638
4639 // Add adds incr to the existing count for attrs.
4640 //
4641 // This may not equal capacity - available.
4642 //
4643 // This metric is derived from the
4644 // [FsStats.UsedBytes] field
4645 // of the [NodeStats.Fs]
4646 // of the Kubelet's stats API.
4647 //
4648 // [FsStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4649 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4650 func (m NodeFilesystemUsage) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4651 if len(attrs) == 0 {
4652 m.Int64UpDownCounter.Add(ctx, incr)
4653 return
4654 }
4655
4656 o := addOptPool.Get().(*[]metric.AddOption)
4657 defer func() {
4658 *o = (*o)[:0]
4659 addOptPool.Put(o)
4660 }()
4661
4662 *o = append(*o, metric.WithAttributes(attrs...))
4663 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4664 }
4665
4666 // AddSet adds incr to the existing count for set.
4667 //
4668 // This may not equal capacity - available.
4669 //
4670 // This metric is derived from the
4671 // [FsStats.UsedBytes] field
4672 // of the [NodeStats.Fs]
4673 // of the Kubelet's stats API.
4674 //
4675 // [FsStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
4676 // [NodeStats.Fs]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4677 func (m NodeFilesystemUsage) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4678 if set.Len() == 0 {
4679 m.Int64UpDownCounter.Add(ctx, incr)
4680 return
4681 }
4682
4683 o := addOptPool.Get().(*[]metric.AddOption)
4684 defer func() {
4685 *o = (*o)[:0]
4686 addOptPool.Put(o)
4687 }()
4688
4689 *o = append(*o, metric.WithAttributeSet(set))
4690 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4691 }
4692
4693 // NodeMemoryAllocatable is an instrument used to record metric values conforming
4694 // to the "k8s.node.memory.allocatable" semantic conventions. It represents the
4695 // amount of memory allocatable on the node.
4696 type NodeMemoryAllocatable struct {
4697 metric.Int64UpDownCounter
4698 }
4699
4700 var newNodeMemoryAllocatableOpts = []metric.Int64UpDownCounterOption{
4701 metric.WithDescription("Amount of memory allocatable on the node."),
4702 metric.WithUnit("By"),
4703 }
4704
4705 // NewNodeMemoryAllocatable returns a new NodeMemoryAllocatable instrument.
4706 func NewNodeMemoryAllocatable(
4707 m metric.Meter,
4708 opt ...metric.Int64UpDownCounterOption,
4709 ) (NodeMemoryAllocatable, error) {
4710 // Check if the meter is nil.
4711 if m == nil {
4712 return NodeMemoryAllocatable{noop.Int64UpDownCounter{}}, nil
4713 }
4714
4715 if len(opt) == 0 {
4716 opt = newNodeMemoryAllocatableOpts
4717 } else {
4718 opt = append(opt, newNodeMemoryAllocatableOpts...)
4719 }
4720
4721 i, err := m.Int64UpDownCounter(
4722 "k8s.node.memory.allocatable",
4723 opt...,
4724 )
4725 if err != nil {
4726 return NodeMemoryAllocatable{noop.Int64UpDownCounter{}}, err
4727 }
4728 return NodeMemoryAllocatable{i}, nil
4729 }
4730
4731 // Inst returns the underlying metric instrument.
4732 func (m NodeMemoryAllocatable) Inst() metric.Int64UpDownCounter {
4733 return m.Int64UpDownCounter
4734 }
4735
4736 // Name returns the semantic convention name of the instrument.
4737 func (NodeMemoryAllocatable) Name() string {
4738 return "k8s.node.memory.allocatable"
4739 }
4740
4741 // Unit returns the semantic convention unit of the instrument
4742 func (NodeMemoryAllocatable) Unit() string {
4743 return "By"
4744 }
4745
4746 // Description returns the semantic convention description of the instrument
4747 func (NodeMemoryAllocatable) Description() string {
4748 return "Amount of memory allocatable on the node."
4749 }
4750
4751 // Add adds incr to the existing count for attrs.
4752 func (m NodeMemoryAllocatable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4753 if len(attrs) == 0 {
4754 m.Int64UpDownCounter.Add(ctx, incr)
4755 return
4756 }
4757
4758 o := addOptPool.Get().(*[]metric.AddOption)
4759 defer func() {
4760 *o = (*o)[:0]
4761 addOptPool.Put(o)
4762 }()
4763
4764 *o = append(*o, metric.WithAttributes(attrs...))
4765 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4766 }
4767
4768 // AddSet adds incr to the existing count for set.
4769 func (m NodeMemoryAllocatable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4770 if set.Len() == 0 {
4771 m.Int64UpDownCounter.Add(ctx, incr)
4772 return
4773 }
4774
4775 o := addOptPool.Get().(*[]metric.AddOption)
4776 defer func() {
4777 *o = (*o)[:0]
4778 addOptPool.Put(o)
4779 }()
4780
4781 *o = append(*o, metric.WithAttributeSet(set))
4782 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4783 }
4784
4785 // NodeMemoryAvailable is an instrument used to record metric values conforming
4786 // to the "k8s.node.memory.available" semantic conventions. It represents the
4787 // node memory available.
4788 type NodeMemoryAvailable struct {
4789 metric.Int64UpDownCounter
4790 }
4791
4792 var newNodeMemoryAvailableOpts = []metric.Int64UpDownCounterOption{
4793 metric.WithDescription("Node memory available."),
4794 metric.WithUnit("By"),
4795 }
4796
4797 // NewNodeMemoryAvailable returns a new NodeMemoryAvailable instrument.
4798 func NewNodeMemoryAvailable(
4799 m metric.Meter,
4800 opt ...metric.Int64UpDownCounterOption,
4801 ) (NodeMemoryAvailable, error) {
4802 // Check if the meter is nil.
4803 if m == nil {
4804 return NodeMemoryAvailable{noop.Int64UpDownCounter{}}, nil
4805 }
4806
4807 if len(opt) == 0 {
4808 opt = newNodeMemoryAvailableOpts
4809 } else {
4810 opt = append(opt, newNodeMemoryAvailableOpts...)
4811 }
4812
4813 i, err := m.Int64UpDownCounter(
4814 "k8s.node.memory.available",
4815 opt...,
4816 )
4817 if err != nil {
4818 return NodeMemoryAvailable{noop.Int64UpDownCounter{}}, err
4819 }
4820 return NodeMemoryAvailable{i}, nil
4821 }
4822
4823 // Inst returns the underlying metric instrument.
4824 func (m NodeMemoryAvailable) Inst() metric.Int64UpDownCounter {
4825 return m.Int64UpDownCounter
4826 }
4827
4828 // Name returns the semantic convention name of the instrument.
4829 func (NodeMemoryAvailable) Name() string {
4830 return "k8s.node.memory.available"
4831 }
4832
4833 // Unit returns the semantic convention unit of the instrument
4834 func (NodeMemoryAvailable) Unit() string {
4835 return "By"
4836 }
4837
4838 // Description returns the semantic convention description of the instrument
4839 func (NodeMemoryAvailable) Description() string {
4840 return "Node memory available."
4841 }
4842
4843 // Add adds incr to the existing count for attrs.
4844 //
4845 // Available memory for use. This is defined as the memory limit -
4846 // workingSetBytes. If memory limit is undefined, the available bytes is omitted.
4847 // This metric is derived from the [MemoryStats.AvailableBytes] field of the
4848 // [NodeStats.Memory] of the Kubelet's stats API.
4849 //
4850 // [MemoryStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4851 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4852 func (m NodeMemoryAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
4853 if len(attrs) == 0 {
4854 m.Int64UpDownCounter.Add(ctx, incr)
4855 return
4856 }
4857
4858 o := addOptPool.Get().(*[]metric.AddOption)
4859 defer func() {
4860 *o = (*o)[:0]
4861 addOptPool.Put(o)
4862 }()
4863
4864 *o = append(*o, metric.WithAttributes(attrs...))
4865 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4866 }
4867
4868 // AddSet adds incr to the existing count for set.
4869 //
4870 // Available memory for use. This is defined as the memory limit -
4871 // workingSetBytes. If memory limit is undefined, the available bytes is omitted.
4872 // This metric is derived from the [MemoryStats.AvailableBytes] field of the
4873 // [NodeStats.Memory] of the Kubelet's stats API.
4874 //
4875 // [MemoryStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4876 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4877 func (m NodeMemoryAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
4878 if set.Len() == 0 {
4879 m.Int64UpDownCounter.Add(ctx, incr)
4880 return
4881 }
4882
4883 o := addOptPool.Get().(*[]metric.AddOption)
4884 defer func() {
4885 *o = (*o)[:0]
4886 addOptPool.Put(o)
4887 }()
4888
4889 *o = append(*o, metric.WithAttributeSet(set))
4890 m.Int64UpDownCounter.Add(ctx, incr, *o...)
4891 }
4892
4893 // NodeMemoryPagingFaults is an instrument used to record metric values
4894 // conforming to the "k8s.node.memory.paging.faults" semantic conventions. It
4895 // represents the node memory paging faults.
4896 type NodeMemoryPagingFaults struct {
4897 metric.Int64Counter
4898 }
4899
4900 var newNodeMemoryPagingFaultsOpts = []metric.Int64CounterOption{
4901 metric.WithDescription("Node memory paging faults."),
4902 metric.WithUnit("{fault}"),
4903 }
4904
4905 // NewNodeMemoryPagingFaults returns a new NodeMemoryPagingFaults instrument.
4906 func NewNodeMemoryPagingFaults(
4907 m metric.Meter,
4908 opt ...metric.Int64CounterOption,
4909 ) (NodeMemoryPagingFaults, error) {
4910 // Check if the meter is nil.
4911 if m == nil {
4912 return NodeMemoryPagingFaults{noop.Int64Counter{}}, nil
4913 }
4914
4915 if len(opt) == 0 {
4916 opt = newNodeMemoryPagingFaultsOpts
4917 } else {
4918 opt = append(opt, newNodeMemoryPagingFaultsOpts...)
4919 }
4920
4921 i, err := m.Int64Counter(
4922 "k8s.node.memory.paging.faults",
4923 opt...,
4924 )
4925 if err != nil {
4926 return NodeMemoryPagingFaults{noop.Int64Counter{}}, err
4927 }
4928 return NodeMemoryPagingFaults{i}, nil
4929 }
4930
4931 // Inst returns the underlying metric instrument.
4932 func (m NodeMemoryPagingFaults) Inst() metric.Int64Counter {
4933 return m.Int64Counter
4934 }
4935
4936 // Name returns the semantic convention name of the instrument.
4937 func (NodeMemoryPagingFaults) Name() string {
4938 return "k8s.node.memory.paging.faults"
4939 }
4940
4941 // Unit returns the semantic convention unit of the instrument
4942 func (NodeMemoryPagingFaults) Unit() string {
4943 return "{fault}"
4944 }
4945
4946 // Description returns the semantic convention description of the instrument
4947 func (NodeMemoryPagingFaults) Description() string {
4948 return "Node memory paging faults."
4949 }
4950
4951 // Add adds incr to the existing count for attrs.
4952 //
4953 // All additional attrs passed are included in the recorded value.
4954 //
4955 // Cumulative number of major/minor page faults.
4956 // This metric is derived from the [MemoryStats.PageFaults] and
4957 // [MemoryStats.MajorPageFaults] fields of the [NodeStats.Memory] of the
4958 // Kubelet's stats API.
4959 //
4960 // [MemoryStats.PageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4961 // [MemoryStats.MajorPageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4962 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4963 func (m NodeMemoryPagingFaults) Add(
4964 ctx context.Context,
4965 incr int64,
4966 attrs ...attribute.KeyValue,
4967 ) {
4968 if len(attrs) == 0 {
4969 m.Int64Counter.Add(ctx, incr)
4970 return
4971 }
4972
4973 o := addOptPool.Get().(*[]metric.AddOption)
4974 defer func() {
4975 *o = (*o)[:0]
4976 addOptPool.Put(o)
4977 }()
4978
4979 *o = append(
4980 *o,
4981 metric.WithAttributes(
4982 attrs...,
4983 ),
4984 )
4985
4986 m.Int64Counter.Add(ctx, incr, *o...)
4987 }
4988
4989 // AddSet adds incr to the existing count for set.
4990 //
4991 // Cumulative number of major/minor page faults.
4992 // This metric is derived from the [MemoryStats.PageFaults] and
4993 // [MemoryStats.MajorPageFaults] fields of the [NodeStats.Memory] of the
4994 // Kubelet's stats API.
4995 //
4996 // [MemoryStats.PageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4997 // [MemoryStats.MajorPageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
4998 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
4999 func (m NodeMemoryPagingFaults) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5000 if set.Len() == 0 {
5001 m.Int64Counter.Add(ctx, incr)
5002 return
5003 }
5004
5005 o := addOptPool.Get().(*[]metric.AddOption)
5006 defer func() {
5007 *o = (*o)[:0]
5008 addOptPool.Put(o)
5009 }()
5010
5011 *o = append(*o, metric.WithAttributeSet(set))
5012 m.Int64Counter.Add(ctx, incr, *o...)
5013 }
5014
5015 // AttrSystemPagingFaultType returns an optional attribute for the
5016 // "system.paging.fault.type" semantic convention. It represents the paging fault
5017 // type.
5018 func (NodeMemoryPagingFaults) AttrSystemPagingFaultType(val SystemPagingFaultTypeAttr) attribute.KeyValue {
5019 return attribute.String("system.paging.fault.type", string(val))
5020 }
5021
5022 // NodeMemoryRss is an instrument used to record metric values conforming to the
5023 // "k8s.node.memory.rss" semantic conventions. It represents the node memory RSS.
5024 type NodeMemoryRss struct {
5025 metric.Int64UpDownCounter
5026 }
5027
5028 var newNodeMemoryRssOpts = []metric.Int64UpDownCounterOption{
5029 metric.WithDescription("Node memory RSS."),
5030 metric.WithUnit("By"),
5031 }
5032
5033 // NewNodeMemoryRss returns a new NodeMemoryRss instrument.
5034 func NewNodeMemoryRss(
5035 m metric.Meter,
5036 opt ...metric.Int64UpDownCounterOption,
5037 ) (NodeMemoryRss, error) {
5038 // Check if the meter is nil.
5039 if m == nil {
5040 return NodeMemoryRss{noop.Int64UpDownCounter{}}, nil
5041 }
5042
5043 if len(opt) == 0 {
5044 opt = newNodeMemoryRssOpts
5045 } else {
5046 opt = append(opt, newNodeMemoryRssOpts...)
5047 }
5048
5049 i, err := m.Int64UpDownCounter(
5050 "k8s.node.memory.rss",
5051 opt...,
5052 )
5053 if err != nil {
5054 return NodeMemoryRss{noop.Int64UpDownCounter{}}, err
5055 }
5056 return NodeMemoryRss{i}, nil
5057 }
5058
5059 // Inst returns the underlying metric instrument.
5060 func (m NodeMemoryRss) Inst() metric.Int64UpDownCounter {
5061 return m.Int64UpDownCounter
5062 }
5063
5064 // Name returns the semantic convention name of the instrument.
5065 func (NodeMemoryRss) Name() string {
5066 return "k8s.node.memory.rss"
5067 }
5068
5069 // Unit returns the semantic convention unit of the instrument
5070 func (NodeMemoryRss) Unit() string {
5071 return "By"
5072 }
5073
5074 // Description returns the semantic convention description of the instrument
5075 func (NodeMemoryRss) Description() string {
5076 return "Node memory RSS."
5077 }
5078
5079 // Add adds incr to the existing count for attrs.
5080 //
5081 // The amount of anonymous and swap cache memory (includes transparent
5082 // hugepages).
5083 // This metric is derived from the [MemoryStats.RSSBytes] field of the
5084 // [NodeStats.Memory] of the Kubelet's stats API.
5085 //
5086 // [MemoryStats.RSSBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
5087 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
5088 func (m NodeMemoryRss) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
5089 if len(attrs) == 0 {
5090 m.Int64UpDownCounter.Add(ctx, incr)
5091 return
5092 }
5093
5094 o := addOptPool.Get().(*[]metric.AddOption)
5095 defer func() {
5096 *o = (*o)[:0]
5097 addOptPool.Put(o)
5098 }()
5099
5100 *o = append(*o, metric.WithAttributes(attrs...))
5101 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5102 }
5103
5104 // AddSet adds incr to the existing count for set.
5105 //
5106 // The amount of anonymous and swap cache memory (includes transparent
5107 // hugepages).
5108 // This metric is derived from the [MemoryStats.RSSBytes] field of the
5109 // [NodeStats.Memory] of the Kubelet's stats API.
5110 //
5111 // [MemoryStats.RSSBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
5112 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
5113 func (m NodeMemoryRss) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5114 if set.Len() == 0 {
5115 m.Int64UpDownCounter.Add(ctx, incr)
5116 return
5117 }
5118
5119 o := addOptPool.Get().(*[]metric.AddOption)
5120 defer func() {
5121 *o = (*o)[:0]
5122 addOptPool.Put(o)
5123 }()
5124
5125 *o = append(*o, metric.WithAttributeSet(set))
5126 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5127 }
5128
5129 // NodeMemoryUsage is an instrument used to record metric values conforming to
5130 // the "k8s.node.memory.usage" semantic conventions. It represents the memory
5131 // usage of the Node.
5132 type NodeMemoryUsage struct {
5133 metric.Int64Gauge
5134 }
5135
5136 var newNodeMemoryUsageOpts = []metric.Int64GaugeOption{
5137 metric.WithDescription("Memory usage of the Node."),
5138 metric.WithUnit("By"),
5139 }
5140
5141 // NewNodeMemoryUsage returns a new NodeMemoryUsage instrument.
5142 func NewNodeMemoryUsage(
5143 m metric.Meter,
5144 opt ...metric.Int64GaugeOption,
5145 ) (NodeMemoryUsage, error) {
5146 // Check if the meter is nil.
5147 if m == nil {
5148 return NodeMemoryUsage{noop.Int64Gauge{}}, nil
5149 }
5150
5151 if len(opt) == 0 {
5152 opt = newNodeMemoryUsageOpts
5153 } else {
5154 opt = append(opt, newNodeMemoryUsageOpts...)
5155 }
5156
5157 i, err := m.Int64Gauge(
5158 "k8s.node.memory.usage",
5159 opt...,
5160 )
5161 if err != nil {
5162 return NodeMemoryUsage{noop.Int64Gauge{}}, err
5163 }
5164 return NodeMemoryUsage{i}, nil
5165 }
5166
5167 // Inst returns the underlying metric instrument.
5168 func (m NodeMemoryUsage) Inst() metric.Int64Gauge {
5169 return m.Int64Gauge
5170 }
5171
5172 // Name returns the semantic convention name of the instrument.
5173 func (NodeMemoryUsage) Name() string {
5174 return "k8s.node.memory.usage"
5175 }
5176
5177 // Unit returns the semantic convention unit of the instrument
5178 func (NodeMemoryUsage) Unit() string {
5179 return "By"
5180 }
5181
5182 // Description returns the semantic convention description of the instrument
5183 func (NodeMemoryUsage) Description() string {
5184 return "Memory usage of the Node."
5185 }
5186
5187 // Record records val to the current distribution for attrs.
5188 //
5189 // Total memory usage of the Node
5190 func (m NodeMemoryUsage) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
5191 if len(attrs) == 0 {
5192 m.Int64Gauge.Record(ctx, val)
5193 return
5194 }
5195
5196 o := recOptPool.Get().(*[]metric.RecordOption)
5197 defer func() {
5198 *o = (*o)[:0]
5199 recOptPool.Put(o)
5200 }()
5201
5202 *o = append(*o, metric.WithAttributes(attrs...))
5203 m.Int64Gauge.Record(ctx, val, *o...)
5204 }
5205
5206 // RecordSet records val to the current distribution for set.
5207 //
5208 // Total memory usage of the Node
5209 func (m NodeMemoryUsage) RecordSet(ctx context.Context, val int64, set attribute.Set) {
5210 if set.Len() == 0 {
5211 m.Int64Gauge.Record(ctx, val)
5212 return
5213 }
5214
5215 o := recOptPool.Get().(*[]metric.RecordOption)
5216 defer func() {
5217 *o = (*o)[:0]
5218 recOptPool.Put(o)
5219 }()
5220
5221 *o = append(*o, metric.WithAttributeSet(set))
5222 m.Int64Gauge.Record(ctx, val, *o...)
5223 }
5224
5225 // NodeMemoryWorkingSet is an instrument used to record metric values conforming
5226 // to the "k8s.node.memory.working_set" semantic conventions. It represents the
5227 // node memory working set.
5228 type NodeMemoryWorkingSet struct {
5229 metric.Int64UpDownCounter
5230 }
5231
5232 var newNodeMemoryWorkingSetOpts = []metric.Int64UpDownCounterOption{
5233 metric.WithDescription("Node memory working set."),
5234 metric.WithUnit("By"),
5235 }
5236
5237 // NewNodeMemoryWorkingSet returns a new NodeMemoryWorkingSet instrument.
5238 func NewNodeMemoryWorkingSet(
5239 m metric.Meter,
5240 opt ...metric.Int64UpDownCounterOption,
5241 ) (NodeMemoryWorkingSet, error) {
5242 // Check if the meter is nil.
5243 if m == nil {
5244 return NodeMemoryWorkingSet{noop.Int64UpDownCounter{}}, nil
5245 }
5246
5247 if len(opt) == 0 {
5248 opt = newNodeMemoryWorkingSetOpts
5249 } else {
5250 opt = append(opt, newNodeMemoryWorkingSetOpts...)
5251 }
5252
5253 i, err := m.Int64UpDownCounter(
5254 "k8s.node.memory.working_set",
5255 opt...,
5256 )
5257 if err != nil {
5258 return NodeMemoryWorkingSet{noop.Int64UpDownCounter{}}, err
5259 }
5260 return NodeMemoryWorkingSet{i}, nil
5261 }
5262
5263 // Inst returns the underlying metric instrument.
5264 func (m NodeMemoryWorkingSet) Inst() metric.Int64UpDownCounter {
5265 return m.Int64UpDownCounter
5266 }
5267
5268 // Name returns the semantic convention name of the instrument.
5269 func (NodeMemoryWorkingSet) Name() string {
5270 return "k8s.node.memory.working_set"
5271 }
5272
5273 // Unit returns the semantic convention unit of the instrument
5274 func (NodeMemoryWorkingSet) Unit() string {
5275 return "By"
5276 }
5277
5278 // Description returns the semantic convention description of the instrument
5279 func (NodeMemoryWorkingSet) Description() string {
5280 return "Node memory working set."
5281 }
5282
5283 // Add adds incr to the existing count for attrs.
5284 //
5285 // The amount of working set memory. This includes recently accessed memory,
5286 // dirty memory, and kernel memory. WorkingSetBytes is <= UsageBytes.
5287 // This metric is derived from the [MemoryStats.WorkingSetBytes] field of the
5288 // [NodeStats.Memory] of the Kubelet's stats API.
5289 //
5290 // [MemoryStats.WorkingSetBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
5291 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
5292 func (m NodeMemoryWorkingSet) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
5293 if len(attrs) == 0 {
5294 m.Int64UpDownCounter.Add(ctx, incr)
5295 return
5296 }
5297
5298 o := addOptPool.Get().(*[]metric.AddOption)
5299 defer func() {
5300 *o = (*o)[:0]
5301 addOptPool.Put(o)
5302 }()
5303
5304 *o = append(*o, metric.WithAttributes(attrs...))
5305 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5306 }
5307
5308 // AddSet adds incr to the existing count for set.
5309 //
5310 // The amount of working set memory. This includes recently accessed memory,
5311 // dirty memory, and kernel memory. WorkingSetBytes is <= UsageBytes.
5312 // This metric is derived from the [MemoryStats.WorkingSetBytes] field of the
5313 // [NodeStats.Memory] of the Kubelet's stats API.
5314 //
5315 // [MemoryStats.WorkingSetBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
5316 // [NodeStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#NodeStats
5317 func (m NodeMemoryWorkingSet) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5318 if set.Len() == 0 {
5319 m.Int64UpDownCounter.Add(ctx, incr)
5320 return
5321 }
5322
5323 o := addOptPool.Get().(*[]metric.AddOption)
5324 defer func() {
5325 *o = (*o)[:0]
5326 addOptPool.Put(o)
5327 }()
5328
5329 *o = append(*o, metric.WithAttributeSet(set))
5330 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5331 }
5332
5333 // NodeNetworkErrors is an instrument used to record metric values conforming to
5334 // the "k8s.node.network.errors" semantic conventions. It represents the node
5335 // network errors.
5336 type NodeNetworkErrors struct {
5337 metric.Int64Counter
5338 }
5339
5340 var newNodeNetworkErrorsOpts = []metric.Int64CounterOption{
5341 metric.WithDescription("Node network errors."),
5342 metric.WithUnit("{error}"),
5343 }
5344
5345 // NewNodeNetworkErrors returns a new NodeNetworkErrors instrument.
5346 func NewNodeNetworkErrors(
5347 m metric.Meter,
5348 opt ...metric.Int64CounterOption,
5349 ) (NodeNetworkErrors, error) {
5350 // Check if the meter is nil.
5351 if m == nil {
5352 return NodeNetworkErrors{noop.Int64Counter{}}, nil
5353 }
5354
5355 if len(opt) == 0 {
5356 opt = newNodeNetworkErrorsOpts
5357 } else {
5358 opt = append(opt, newNodeNetworkErrorsOpts...)
5359 }
5360
5361 i, err := m.Int64Counter(
5362 "k8s.node.network.errors",
5363 opt...,
5364 )
5365 if err != nil {
5366 return NodeNetworkErrors{noop.Int64Counter{}}, err
5367 }
5368 return NodeNetworkErrors{i}, nil
5369 }
5370
5371 // Inst returns the underlying metric instrument.
5372 func (m NodeNetworkErrors) Inst() metric.Int64Counter {
5373 return m.Int64Counter
5374 }
5375
5376 // Name returns the semantic convention name of the instrument.
5377 func (NodeNetworkErrors) Name() string {
5378 return "k8s.node.network.errors"
5379 }
5380
5381 // Unit returns the semantic convention unit of the instrument
5382 func (NodeNetworkErrors) Unit() string {
5383 return "{error}"
5384 }
5385
5386 // Description returns the semantic convention description of the instrument
5387 func (NodeNetworkErrors) Description() string {
5388 return "Node network errors."
5389 }
5390
5391 // Add adds incr to the existing count for attrs.
5392 //
5393 // All additional attrs passed are included in the recorded value.
5394 func (m NodeNetworkErrors) Add(
5395 ctx context.Context,
5396 incr int64,
5397 attrs ...attribute.KeyValue,
5398 ) {
5399 if len(attrs) == 0 {
5400 m.Int64Counter.Add(ctx, incr)
5401 return
5402 }
5403
5404 o := addOptPool.Get().(*[]metric.AddOption)
5405 defer func() {
5406 *o = (*o)[:0]
5407 addOptPool.Put(o)
5408 }()
5409
5410 *o = append(
5411 *o,
5412 metric.WithAttributes(
5413 attrs...,
5414 ),
5415 )
5416
5417 m.Int64Counter.Add(ctx, incr, *o...)
5418 }
5419
5420 // AddSet adds incr to the existing count for set.
5421 func (m NodeNetworkErrors) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5422 if set.Len() == 0 {
5423 m.Int64Counter.Add(ctx, incr)
5424 return
5425 }
5426
5427 o := addOptPool.Get().(*[]metric.AddOption)
5428 defer func() {
5429 *o = (*o)[:0]
5430 addOptPool.Put(o)
5431 }()
5432
5433 *o = append(*o, metric.WithAttributeSet(set))
5434 m.Int64Counter.Add(ctx, incr, *o...)
5435 }
5436
5437 // AttrNetworkInterfaceName returns an optional attribute for the
5438 // "network.interface.name" semantic convention. It represents the network
5439 // interface name.
5440 func (NodeNetworkErrors) AttrNetworkInterfaceName(val string) attribute.KeyValue {
5441 return attribute.String("network.interface.name", val)
5442 }
5443
5444 // AttrNetworkIODirection returns an optional attribute for the
5445 // "network.io.direction" semantic convention. It represents the network IO
5446 // operation direction.
5447 func (NodeNetworkErrors) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue {
5448 return attribute.String("network.io.direction", string(val))
5449 }
5450
5451 // NodeNetworkIO is an instrument used to record metric values conforming to the
5452 // "k8s.node.network.io" semantic conventions. It represents the network bytes
5453 // for the Node.
5454 type NodeNetworkIO struct {
5455 metric.Int64Counter
5456 }
5457
5458 var newNodeNetworkIOOpts = []metric.Int64CounterOption{
5459 metric.WithDescription("Network bytes for the Node."),
5460 metric.WithUnit("By"),
5461 }
5462
5463 // NewNodeNetworkIO returns a new NodeNetworkIO instrument.
5464 func NewNodeNetworkIO(
5465 m metric.Meter,
5466 opt ...metric.Int64CounterOption,
5467 ) (NodeNetworkIO, error) {
5468 // Check if the meter is nil.
5469 if m == nil {
5470 return NodeNetworkIO{noop.Int64Counter{}}, nil
5471 }
5472
5473 if len(opt) == 0 {
5474 opt = newNodeNetworkIOOpts
5475 } else {
5476 opt = append(opt, newNodeNetworkIOOpts...)
5477 }
5478
5479 i, err := m.Int64Counter(
5480 "k8s.node.network.io",
5481 opt...,
5482 )
5483 if err != nil {
5484 return NodeNetworkIO{noop.Int64Counter{}}, err
5485 }
5486 return NodeNetworkIO{i}, nil
5487 }
5488
5489 // Inst returns the underlying metric instrument.
5490 func (m NodeNetworkIO) Inst() metric.Int64Counter {
5491 return m.Int64Counter
5492 }
5493
5494 // Name returns the semantic convention name of the instrument.
5495 func (NodeNetworkIO) Name() string {
5496 return "k8s.node.network.io"
5497 }
5498
5499 // Unit returns the semantic convention unit of the instrument
5500 func (NodeNetworkIO) Unit() string {
5501 return "By"
5502 }
5503
5504 // Description returns the semantic convention description of the instrument
5505 func (NodeNetworkIO) Description() string {
5506 return "Network bytes for the Node."
5507 }
5508
5509 // Add adds incr to the existing count for attrs.
5510 //
5511 // All additional attrs passed are included in the recorded value.
5512 func (m NodeNetworkIO) Add(
5513 ctx context.Context,
5514 incr int64,
5515 attrs ...attribute.KeyValue,
5516 ) {
5517 if len(attrs) == 0 {
5518 m.Int64Counter.Add(ctx, incr)
5519 return
5520 }
5521
5522 o := addOptPool.Get().(*[]metric.AddOption)
5523 defer func() {
5524 *o = (*o)[:0]
5525 addOptPool.Put(o)
5526 }()
5527
5528 *o = append(
5529 *o,
5530 metric.WithAttributes(
5531 attrs...,
5532 ),
5533 )
5534
5535 m.Int64Counter.Add(ctx, incr, *o...)
5536 }
5537
5538 // AddSet adds incr to the existing count for set.
5539 func (m NodeNetworkIO) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5540 if set.Len() == 0 {
5541 m.Int64Counter.Add(ctx, incr)
5542 return
5543 }
5544
5545 o := addOptPool.Get().(*[]metric.AddOption)
5546 defer func() {
5547 *o = (*o)[:0]
5548 addOptPool.Put(o)
5549 }()
5550
5551 *o = append(*o, metric.WithAttributeSet(set))
5552 m.Int64Counter.Add(ctx, incr, *o...)
5553 }
5554
5555 // AttrNetworkInterfaceName returns an optional attribute for the
5556 // "network.interface.name" semantic convention. It represents the network
5557 // interface name.
5558 func (NodeNetworkIO) AttrNetworkInterfaceName(val string) attribute.KeyValue {
5559 return attribute.String("network.interface.name", val)
5560 }
5561
5562 // AttrNetworkIODirection returns an optional attribute for the
5563 // "network.io.direction" semantic convention. It represents the network IO
5564 // operation direction.
5565 func (NodeNetworkIO) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue {
5566 return attribute.String("network.io.direction", string(val))
5567 }
5568
5569 // NodePodAllocatable is an instrument used to record metric values conforming to
5570 // the "k8s.node.pod.allocatable" semantic conventions. It represents the amount
5571 // of pods allocatable on the node.
5572 type NodePodAllocatable struct {
5573 metric.Int64UpDownCounter
5574 }
5575
5576 var newNodePodAllocatableOpts = []metric.Int64UpDownCounterOption{
5577 metric.WithDescription("Amount of pods allocatable on the node."),
5578 metric.WithUnit("{pod}"),
5579 }
5580
5581 // NewNodePodAllocatable returns a new NodePodAllocatable instrument.
5582 func NewNodePodAllocatable(
5583 m metric.Meter,
5584 opt ...metric.Int64UpDownCounterOption,
5585 ) (NodePodAllocatable, error) {
5586 // Check if the meter is nil.
5587 if m == nil {
5588 return NodePodAllocatable{noop.Int64UpDownCounter{}}, nil
5589 }
5590
5591 if len(opt) == 0 {
5592 opt = newNodePodAllocatableOpts
5593 } else {
5594 opt = append(opt, newNodePodAllocatableOpts...)
5595 }
5596
5597 i, err := m.Int64UpDownCounter(
5598 "k8s.node.pod.allocatable",
5599 opt...,
5600 )
5601 if err != nil {
5602 return NodePodAllocatable{noop.Int64UpDownCounter{}}, err
5603 }
5604 return NodePodAllocatable{i}, nil
5605 }
5606
5607 // Inst returns the underlying metric instrument.
5608 func (m NodePodAllocatable) Inst() metric.Int64UpDownCounter {
5609 return m.Int64UpDownCounter
5610 }
5611
5612 // Name returns the semantic convention name of the instrument.
5613 func (NodePodAllocatable) Name() string {
5614 return "k8s.node.pod.allocatable"
5615 }
5616
5617 // Unit returns the semantic convention unit of the instrument
5618 func (NodePodAllocatable) Unit() string {
5619 return "{pod}"
5620 }
5621
5622 // Description returns the semantic convention description of the instrument
5623 func (NodePodAllocatable) Description() string {
5624 return "Amount of pods allocatable on the node."
5625 }
5626
5627 // Add adds incr to the existing count for attrs.
5628 func (m NodePodAllocatable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
5629 if len(attrs) == 0 {
5630 m.Int64UpDownCounter.Add(ctx, incr)
5631 return
5632 }
5633
5634 o := addOptPool.Get().(*[]metric.AddOption)
5635 defer func() {
5636 *o = (*o)[:0]
5637 addOptPool.Put(o)
5638 }()
5639
5640 *o = append(*o, metric.WithAttributes(attrs...))
5641 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5642 }
5643
5644 // AddSet adds incr to the existing count for set.
5645 func (m NodePodAllocatable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
5646 if set.Len() == 0 {
5647 m.Int64UpDownCounter.Add(ctx, incr)
5648 return
5649 }
5650
5651 o := addOptPool.Get().(*[]metric.AddOption)
5652 defer func() {
5653 *o = (*o)[:0]
5654 addOptPool.Put(o)
5655 }()
5656
5657 *o = append(*o, metric.WithAttributeSet(set))
5658 m.Int64UpDownCounter.Add(ctx, incr, *o...)
5659 }
5660
5661 // NodeUptime is an instrument used to record metric values conforming to the
5662 // "k8s.node.uptime" semantic conventions. It represents the time the Node has
5663 // been running.
5664 type NodeUptime struct {
5665 metric.Float64Gauge
5666 }
5667
5668 var newNodeUptimeOpts = []metric.Float64GaugeOption{
5669 metric.WithDescription("The time the Node has been running."),
5670 metric.WithUnit("s"),
5671 }
5672
5673 // NewNodeUptime returns a new NodeUptime instrument.
5674 func NewNodeUptime(
5675 m metric.Meter,
5676 opt ...metric.Float64GaugeOption,
5677 ) (NodeUptime, error) {
5678 // Check if the meter is nil.
5679 if m == nil {
5680 return NodeUptime{noop.Float64Gauge{}}, nil
5681 }
5682
5683 if len(opt) == 0 {
5684 opt = newNodeUptimeOpts
5685 } else {
5686 opt = append(opt, newNodeUptimeOpts...)
5687 }
5688
5689 i, err := m.Float64Gauge(
5690 "k8s.node.uptime",
5691 opt...,
5692 )
5693 if err != nil {
5694 return NodeUptime{noop.Float64Gauge{}}, err
5695 }
5696 return NodeUptime{i}, nil
5697 }
5698
5699 // Inst returns the underlying metric instrument.
5700 func (m NodeUptime) Inst() metric.Float64Gauge {
5701 return m.Float64Gauge
5702 }
5703
5704 // Name returns the semantic convention name of the instrument.
5705 func (NodeUptime) Name() string {
5706 return "k8s.node.uptime"
5707 }
5708
5709 // Unit returns the semantic convention unit of the instrument
5710 func (NodeUptime) Unit() string {
5711 return "s"
5712 }
5713
5714 // Description returns the semantic convention description of the instrument
5715 func (NodeUptime) Description() string {
5716 return "The time the Node has been running."
5717 }
5718
5719 // Record records val to the current distribution for attrs.
5720 //
5721 // Instrumentations SHOULD use a gauge with type `double` and measure uptime in
5722 // seconds as a floating point number with the highest precision available.
5723 // The actual accuracy would depend on the instrumentation and operating system.
5724 func (m NodeUptime) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) {
5725 if len(attrs) == 0 {
5726 m.Float64Gauge.Record(ctx, val)
5727 return
5728 }
5729
5730 o := recOptPool.Get().(*[]metric.RecordOption)
5731 defer func() {
5732 *o = (*o)[:0]
5733 recOptPool.Put(o)
5734 }()
5735
5736 *o = append(*o, metric.WithAttributes(attrs...))
5737 m.Float64Gauge.Record(ctx, val, *o...)
5738 }
5739
5740 // RecordSet records val to the current distribution for set.
5741 //
5742 // Instrumentations SHOULD use a gauge with type `double` and measure uptime in
5743 // seconds as a floating point number with the highest precision available.
5744 // The actual accuracy would depend on the instrumentation and operating system.
5745 func (m NodeUptime) RecordSet(ctx context.Context, val float64, set attribute.Set) {
5746 if set.Len() == 0 {
5747 m.Float64Gauge.Record(ctx, val)
5748 return
5749 }
5750
5751 o := recOptPool.Get().(*[]metric.RecordOption)
5752 defer func() {
5753 *o = (*o)[:0]
5754 recOptPool.Put(o)
5755 }()
5756
5757 *o = append(*o, metric.WithAttributeSet(set))
5758 m.Float64Gauge.Record(ctx, val, *o...)
5759 }
5760
5761 // PodCPUTime is an instrument used to record metric values conforming to the
5762 // "k8s.pod.cpu.time" semantic conventions. It represents the total CPU time
5763 // consumed.
5764 type PodCPUTime struct {
5765 metric.Float64Counter
5766 }
5767
5768 var newPodCPUTimeOpts = []metric.Float64CounterOption{
5769 metric.WithDescription("Total CPU time consumed."),
5770 metric.WithUnit("s"),
5771 }
5772
5773 // NewPodCPUTime returns a new PodCPUTime instrument.
5774 func NewPodCPUTime(
5775 m metric.Meter,
5776 opt ...metric.Float64CounterOption,
5777 ) (PodCPUTime, error) {
5778 // Check if the meter is nil.
5779 if m == nil {
5780 return PodCPUTime{noop.Float64Counter{}}, nil
5781 }
5782
5783 if len(opt) == 0 {
5784 opt = newPodCPUTimeOpts
5785 } else {
5786 opt = append(opt, newPodCPUTimeOpts...)
5787 }
5788
5789 i, err := m.Float64Counter(
5790 "k8s.pod.cpu.time",
5791 opt...,
5792 )
5793 if err != nil {
5794 return PodCPUTime{noop.Float64Counter{}}, err
5795 }
5796 return PodCPUTime{i}, nil
5797 }
5798
5799 // Inst returns the underlying metric instrument.
5800 func (m PodCPUTime) Inst() metric.Float64Counter {
5801 return m.Float64Counter
5802 }
5803
5804 // Name returns the semantic convention name of the instrument.
5805 func (PodCPUTime) Name() string {
5806 return "k8s.pod.cpu.time"
5807 }
5808
5809 // Unit returns the semantic convention unit of the instrument
5810 func (PodCPUTime) Unit() string {
5811 return "s"
5812 }
5813
5814 // Description returns the semantic convention description of the instrument
5815 func (PodCPUTime) Description() string {
5816 return "Total CPU time consumed."
5817 }
5818
5819 // Add adds incr to the existing count for attrs.
5820 //
5821 // Total CPU time consumed by the specific Pod on all available CPU cores
5822 func (m PodCPUTime) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
5823 if len(attrs) == 0 {
5824 m.Float64Counter.Add(ctx, incr)
5825 return
5826 }
5827
5828 o := addOptPool.Get().(*[]metric.AddOption)
5829 defer func() {
5830 *o = (*o)[:0]
5831 addOptPool.Put(o)
5832 }()
5833
5834 *o = append(*o, metric.WithAttributes(attrs...))
5835 m.Float64Counter.Add(ctx, incr, *o...)
5836 }
5837
5838 // AddSet adds incr to the existing count for set.
5839 //
5840 // Total CPU time consumed by the specific Pod on all available CPU cores
5841 func (m PodCPUTime) AddSet(ctx context.Context, incr float64, set attribute.Set) {
5842 if set.Len() == 0 {
5843 m.Float64Counter.Add(ctx, incr)
5844 return
5845 }
5846
5847 o := addOptPool.Get().(*[]metric.AddOption)
5848 defer func() {
5849 *o = (*o)[:0]
5850 addOptPool.Put(o)
5851 }()
5852
5853 *o = append(*o, metric.WithAttributeSet(set))
5854 m.Float64Counter.Add(ctx, incr, *o...)
5855 }
5856
5857 // PodCPUUsage is an instrument used to record metric values conforming to the
5858 // "k8s.pod.cpu.usage" semantic conventions. It represents the pod's CPU usage,
5859 // measured in cpus. Range from 0 to the number of allocatable CPUs.
5860 type PodCPUUsage struct {
5861 metric.Int64Gauge
5862 }
5863
5864 var newPodCPUUsageOpts = []metric.Int64GaugeOption{
5865 metric.WithDescription("Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."),
5866 metric.WithUnit("{cpu}"),
5867 }
5868
5869 // NewPodCPUUsage returns a new PodCPUUsage instrument.
5870 func NewPodCPUUsage(
5871 m metric.Meter,
5872 opt ...metric.Int64GaugeOption,
5873 ) (PodCPUUsage, error) {
5874 // Check if the meter is nil.
5875 if m == nil {
5876 return PodCPUUsage{noop.Int64Gauge{}}, nil
5877 }
5878
5879 if len(opt) == 0 {
5880 opt = newPodCPUUsageOpts
5881 } else {
5882 opt = append(opt, newPodCPUUsageOpts...)
5883 }
5884
5885 i, err := m.Int64Gauge(
5886 "k8s.pod.cpu.usage",
5887 opt...,
5888 )
5889 if err != nil {
5890 return PodCPUUsage{noop.Int64Gauge{}}, err
5891 }
5892 return PodCPUUsage{i}, nil
5893 }
5894
5895 // Inst returns the underlying metric instrument.
5896 func (m PodCPUUsage) Inst() metric.Int64Gauge {
5897 return m.Int64Gauge
5898 }
5899
5900 // Name returns the semantic convention name of the instrument.
5901 func (PodCPUUsage) Name() string {
5902 return "k8s.pod.cpu.usage"
5903 }
5904
5905 // Unit returns the semantic convention unit of the instrument
5906 func (PodCPUUsage) Unit() string {
5907 return "{cpu}"
5908 }
5909
5910 // Description returns the semantic convention description of the instrument
5911 func (PodCPUUsage) Description() string {
5912 return "Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs."
5913 }
5914
5915 // Record records val to the current distribution for attrs.
5916 //
5917 // CPU usage of the specific Pod on all available CPU cores, averaged over the
5918 // sample window
5919 func (m PodCPUUsage) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
5920 if len(attrs) == 0 {
5921 m.Int64Gauge.Record(ctx, val)
5922 return
5923 }
5924
5925 o := recOptPool.Get().(*[]metric.RecordOption)
5926 defer func() {
5927 *o = (*o)[:0]
5928 recOptPool.Put(o)
5929 }()
5930
5931 *o = append(*o, metric.WithAttributes(attrs...))
5932 m.Int64Gauge.Record(ctx, val, *o...)
5933 }
5934
5935 // RecordSet records val to the current distribution for set.
5936 //
5937 // CPU usage of the specific Pod on all available CPU cores, averaged over the
5938 // sample window
5939 func (m PodCPUUsage) RecordSet(ctx context.Context, val int64, set attribute.Set) {
5940 if set.Len() == 0 {
5941 m.Int64Gauge.Record(ctx, val)
5942 return
5943 }
5944
5945 o := recOptPool.Get().(*[]metric.RecordOption)
5946 defer func() {
5947 *o = (*o)[:0]
5948 recOptPool.Put(o)
5949 }()
5950
5951 *o = append(*o, metric.WithAttributeSet(set))
5952 m.Int64Gauge.Record(ctx, val, *o...)
5953 }
5954
5955 // PodFilesystemAvailable is an instrument used to record metric values
5956 // conforming to the "k8s.pod.filesystem.available" semantic conventions. It
5957 // represents the pod filesystem available bytes.
5958 type PodFilesystemAvailable struct {
5959 metric.Int64UpDownCounter
5960 }
5961
5962 var newPodFilesystemAvailableOpts = []metric.Int64UpDownCounterOption{
5963 metric.WithDescription("Pod filesystem available bytes."),
5964 metric.WithUnit("By"),
5965 }
5966
5967 // NewPodFilesystemAvailable returns a new PodFilesystemAvailable instrument.
5968 func NewPodFilesystemAvailable(
5969 m metric.Meter,
5970 opt ...metric.Int64UpDownCounterOption,
5971 ) (PodFilesystemAvailable, error) {
5972 // Check if the meter is nil.
5973 if m == nil {
5974 return PodFilesystemAvailable{noop.Int64UpDownCounter{}}, nil
5975 }
5976
5977 if len(opt) == 0 {
5978 opt = newPodFilesystemAvailableOpts
5979 } else {
5980 opt = append(opt, newPodFilesystemAvailableOpts...)
5981 }
5982
5983 i, err := m.Int64UpDownCounter(
5984 "k8s.pod.filesystem.available",
5985 opt...,
5986 )
5987 if err != nil {
5988 return PodFilesystemAvailable{noop.Int64UpDownCounter{}}, err
5989 }
5990 return PodFilesystemAvailable{i}, nil
5991 }
5992
5993 // Inst returns the underlying metric instrument.
5994 func (m PodFilesystemAvailable) Inst() metric.Int64UpDownCounter {
5995 return m.Int64UpDownCounter
5996 }
5997
5998 // Name returns the semantic convention name of the instrument.
5999 func (PodFilesystemAvailable) Name() string {
6000 return "k8s.pod.filesystem.available"
6001 }
6002
6003 // Unit returns the semantic convention unit of the instrument
6004 func (PodFilesystemAvailable) Unit() string {
6005 return "By"
6006 }
6007
6008 // Description returns the semantic convention description of the instrument
6009 func (PodFilesystemAvailable) Description() string {
6010 return "Pod filesystem available bytes."
6011 }
6012
6013 // Add adds incr to the existing count for attrs.
6014 //
6015 // This metric is derived from the
6016 // [FsStats.AvailableBytes] field
6017 // of the [PodStats.EphemeralStorage]
6018 // of the Kubelet's stats API.
6019 //
6020 // [FsStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6021 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6022 func (m PodFilesystemAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6023 if len(attrs) == 0 {
6024 m.Int64UpDownCounter.Add(ctx, incr)
6025 return
6026 }
6027
6028 o := addOptPool.Get().(*[]metric.AddOption)
6029 defer func() {
6030 *o = (*o)[:0]
6031 addOptPool.Put(o)
6032 }()
6033
6034 *o = append(*o, metric.WithAttributes(attrs...))
6035 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6036 }
6037
6038 // AddSet adds incr to the existing count for set.
6039 //
6040 // This metric is derived from the
6041 // [FsStats.AvailableBytes] field
6042 // of the [PodStats.EphemeralStorage]
6043 // of the Kubelet's stats API.
6044 //
6045 // [FsStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6046 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6047 func (m PodFilesystemAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6048 if set.Len() == 0 {
6049 m.Int64UpDownCounter.Add(ctx, incr)
6050 return
6051 }
6052
6053 o := addOptPool.Get().(*[]metric.AddOption)
6054 defer func() {
6055 *o = (*o)[:0]
6056 addOptPool.Put(o)
6057 }()
6058
6059 *o = append(*o, metric.WithAttributeSet(set))
6060 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6061 }
6062
6063 // PodFilesystemCapacity is an instrument used to record metric values conforming
6064 // to the "k8s.pod.filesystem.capacity" semantic conventions. It represents the
6065 // pod filesystem capacity.
6066 type PodFilesystemCapacity struct {
6067 metric.Int64UpDownCounter
6068 }
6069
6070 var newPodFilesystemCapacityOpts = []metric.Int64UpDownCounterOption{
6071 metric.WithDescription("Pod filesystem capacity."),
6072 metric.WithUnit("By"),
6073 }
6074
6075 // NewPodFilesystemCapacity returns a new PodFilesystemCapacity instrument.
6076 func NewPodFilesystemCapacity(
6077 m metric.Meter,
6078 opt ...metric.Int64UpDownCounterOption,
6079 ) (PodFilesystemCapacity, error) {
6080 // Check if the meter is nil.
6081 if m == nil {
6082 return PodFilesystemCapacity{noop.Int64UpDownCounter{}}, nil
6083 }
6084
6085 if len(opt) == 0 {
6086 opt = newPodFilesystemCapacityOpts
6087 } else {
6088 opt = append(opt, newPodFilesystemCapacityOpts...)
6089 }
6090
6091 i, err := m.Int64UpDownCounter(
6092 "k8s.pod.filesystem.capacity",
6093 opt...,
6094 )
6095 if err != nil {
6096 return PodFilesystemCapacity{noop.Int64UpDownCounter{}}, err
6097 }
6098 return PodFilesystemCapacity{i}, nil
6099 }
6100
6101 // Inst returns the underlying metric instrument.
6102 func (m PodFilesystemCapacity) Inst() metric.Int64UpDownCounter {
6103 return m.Int64UpDownCounter
6104 }
6105
6106 // Name returns the semantic convention name of the instrument.
6107 func (PodFilesystemCapacity) Name() string {
6108 return "k8s.pod.filesystem.capacity"
6109 }
6110
6111 // Unit returns the semantic convention unit of the instrument
6112 func (PodFilesystemCapacity) Unit() string {
6113 return "By"
6114 }
6115
6116 // Description returns the semantic convention description of the instrument
6117 func (PodFilesystemCapacity) Description() string {
6118 return "Pod filesystem capacity."
6119 }
6120
6121 // Add adds incr to the existing count for attrs.
6122 //
6123 // This metric is derived from the
6124 // [FsStats.CapacityBytes] field
6125 // of the [PodStats.EphemeralStorage]
6126 // of the Kubelet's stats API.
6127 //
6128 // [FsStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6129 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6130 func (m PodFilesystemCapacity) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6131 if len(attrs) == 0 {
6132 m.Int64UpDownCounter.Add(ctx, incr)
6133 return
6134 }
6135
6136 o := addOptPool.Get().(*[]metric.AddOption)
6137 defer func() {
6138 *o = (*o)[:0]
6139 addOptPool.Put(o)
6140 }()
6141
6142 *o = append(*o, metric.WithAttributes(attrs...))
6143 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6144 }
6145
6146 // AddSet adds incr to the existing count for set.
6147 //
6148 // This metric is derived from the
6149 // [FsStats.CapacityBytes] field
6150 // of the [PodStats.EphemeralStorage]
6151 // of the Kubelet's stats API.
6152 //
6153 // [FsStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6154 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6155 func (m PodFilesystemCapacity) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6156 if set.Len() == 0 {
6157 m.Int64UpDownCounter.Add(ctx, incr)
6158 return
6159 }
6160
6161 o := addOptPool.Get().(*[]metric.AddOption)
6162 defer func() {
6163 *o = (*o)[:0]
6164 addOptPool.Put(o)
6165 }()
6166
6167 *o = append(*o, metric.WithAttributeSet(set))
6168 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6169 }
6170
6171 // PodFilesystemUsage is an instrument used to record metric values conforming to
6172 // the "k8s.pod.filesystem.usage" semantic conventions. It represents the pod
6173 // filesystem usage.
6174 type PodFilesystemUsage struct {
6175 metric.Int64UpDownCounter
6176 }
6177
6178 var newPodFilesystemUsageOpts = []metric.Int64UpDownCounterOption{
6179 metric.WithDescription("Pod filesystem usage."),
6180 metric.WithUnit("By"),
6181 }
6182
6183 // NewPodFilesystemUsage returns a new PodFilesystemUsage instrument.
6184 func NewPodFilesystemUsage(
6185 m metric.Meter,
6186 opt ...metric.Int64UpDownCounterOption,
6187 ) (PodFilesystemUsage, error) {
6188 // Check if the meter is nil.
6189 if m == nil {
6190 return PodFilesystemUsage{noop.Int64UpDownCounter{}}, nil
6191 }
6192
6193 if len(opt) == 0 {
6194 opt = newPodFilesystemUsageOpts
6195 } else {
6196 opt = append(opt, newPodFilesystemUsageOpts...)
6197 }
6198
6199 i, err := m.Int64UpDownCounter(
6200 "k8s.pod.filesystem.usage",
6201 opt...,
6202 )
6203 if err != nil {
6204 return PodFilesystemUsage{noop.Int64UpDownCounter{}}, err
6205 }
6206 return PodFilesystemUsage{i}, nil
6207 }
6208
6209 // Inst returns the underlying metric instrument.
6210 func (m PodFilesystemUsage) Inst() metric.Int64UpDownCounter {
6211 return m.Int64UpDownCounter
6212 }
6213
6214 // Name returns the semantic convention name of the instrument.
6215 func (PodFilesystemUsage) Name() string {
6216 return "k8s.pod.filesystem.usage"
6217 }
6218
6219 // Unit returns the semantic convention unit of the instrument
6220 func (PodFilesystemUsage) Unit() string {
6221 return "By"
6222 }
6223
6224 // Description returns the semantic convention description of the instrument
6225 func (PodFilesystemUsage) Description() string {
6226 return "Pod filesystem usage."
6227 }
6228
6229 // Add adds incr to the existing count for attrs.
6230 //
6231 // This may not equal capacity - available.
6232 //
6233 // This metric is derived from the
6234 // [FsStats.UsedBytes] field
6235 // of the [PodStats.EphemeralStorage]
6236 // of the Kubelet's stats API.
6237 //
6238 // [FsStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6239 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6240 func (m PodFilesystemUsage) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6241 if len(attrs) == 0 {
6242 m.Int64UpDownCounter.Add(ctx, incr)
6243 return
6244 }
6245
6246 o := addOptPool.Get().(*[]metric.AddOption)
6247 defer func() {
6248 *o = (*o)[:0]
6249 addOptPool.Put(o)
6250 }()
6251
6252 *o = append(*o, metric.WithAttributes(attrs...))
6253 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6254 }
6255
6256 // AddSet adds incr to the existing count for set.
6257 //
6258 // This may not equal capacity - available.
6259 //
6260 // This metric is derived from the
6261 // [FsStats.UsedBytes] field
6262 // of the [PodStats.EphemeralStorage]
6263 // of the Kubelet's stats API.
6264 //
6265 // [FsStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#FsStats
6266 // [PodStats.EphemeralStorage]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6267 func (m PodFilesystemUsage) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6268 if set.Len() == 0 {
6269 m.Int64UpDownCounter.Add(ctx, incr)
6270 return
6271 }
6272
6273 o := addOptPool.Get().(*[]metric.AddOption)
6274 defer func() {
6275 *o = (*o)[:0]
6276 addOptPool.Put(o)
6277 }()
6278
6279 *o = append(*o, metric.WithAttributeSet(set))
6280 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6281 }
6282
6283 // PodMemoryAvailable is an instrument used to record metric values conforming to
6284 // the "k8s.pod.memory.available" semantic conventions. It represents the pod
6285 // memory available.
6286 type PodMemoryAvailable struct {
6287 metric.Int64UpDownCounter
6288 }
6289
6290 var newPodMemoryAvailableOpts = []metric.Int64UpDownCounterOption{
6291 metric.WithDescription("Pod memory available."),
6292 metric.WithUnit("By"),
6293 }
6294
6295 // NewPodMemoryAvailable returns a new PodMemoryAvailable instrument.
6296 func NewPodMemoryAvailable(
6297 m metric.Meter,
6298 opt ...metric.Int64UpDownCounterOption,
6299 ) (PodMemoryAvailable, error) {
6300 // Check if the meter is nil.
6301 if m == nil {
6302 return PodMemoryAvailable{noop.Int64UpDownCounter{}}, nil
6303 }
6304
6305 if len(opt) == 0 {
6306 opt = newPodMemoryAvailableOpts
6307 } else {
6308 opt = append(opt, newPodMemoryAvailableOpts...)
6309 }
6310
6311 i, err := m.Int64UpDownCounter(
6312 "k8s.pod.memory.available",
6313 opt...,
6314 )
6315 if err != nil {
6316 return PodMemoryAvailable{noop.Int64UpDownCounter{}}, err
6317 }
6318 return PodMemoryAvailable{i}, nil
6319 }
6320
6321 // Inst returns the underlying metric instrument.
6322 func (m PodMemoryAvailable) Inst() metric.Int64UpDownCounter {
6323 return m.Int64UpDownCounter
6324 }
6325
6326 // Name returns the semantic convention name of the instrument.
6327 func (PodMemoryAvailable) Name() string {
6328 return "k8s.pod.memory.available"
6329 }
6330
6331 // Unit returns the semantic convention unit of the instrument
6332 func (PodMemoryAvailable) Unit() string {
6333 return "By"
6334 }
6335
6336 // Description returns the semantic convention description of the instrument
6337 func (PodMemoryAvailable) Description() string {
6338 return "Pod memory available."
6339 }
6340
6341 // Add adds incr to the existing count for attrs.
6342 //
6343 // Available memory for use. This is defined as the memory limit -
6344 // workingSetBytes. If memory limit is undefined, the available bytes is omitted.
6345 // This metric is derived from the [MemoryStats.AvailableBytes] field of the
6346 // [PodStats.Memory] of the Kubelet's stats API.
6347 //
6348 // [MemoryStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6349 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6350 func (m PodMemoryAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6351 if len(attrs) == 0 {
6352 m.Int64UpDownCounter.Add(ctx, incr)
6353 return
6354 }
6355
6356 o := addOptPool.Get().(*[]metric.AddOption)
6357 defer func() {
6358 *o = (*o)[:0]
6359 addOptPool.Put(o)
6360 }()
6361
6362 *o = append(*o, metric.WithAttributes(attrs...))
6363 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6364 }
6365
6366 // AddSet adds incr to the existing count for set.
6367 //
6368 // Available memory for use. This is defined as the memory limit -
6369 // workingSetBytes. If memory limit is undefined, the available bytes is omitted.
6370 // This metric is derived from the [MemoryStats.AvailableBytes] field of the
6371 // [PodStats.Memory] of the Kubelet's stats API.
6372 //
6373 // [MemoryStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6374 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6375 func (m PodMemoryAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6376 if set.Len() == 0 {
6377 m.Int64UpDownCounter.Add(ctx, incr)
6378 return
6379 }
6380
6381 o := addOptPool.Get().(*[]metric.AddOption)
6382 defer func() {
6383 *o = (*o)[:0]
6384 addOptPool.Put(o)
6385 }()
6386
6387 *o = append(*o, metric.WithAttributeSet(set))
6388 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6389 }
6390
6391 // PodMemoryPagingFaults is an instrument used to record metric values conforming
6392 // to the "k8s.pod.memory.paging.faults" semantic conventions. It represents the
6393 // pod memory paging faults.
6394 type PodMemoryPagingFaults struct {
6395 metric.Int64Counter
6396 }
6397
6398 var newPodMemoryPagingFaultsOpts = []metric.Int64CounterOption{
6399 metric.WithDescription("Pod memory paging faults."),
6400 metric.WithUnit("{fault}"),
6401 }
6402
6403 // NewPodMemoryPagingFaults returns a new PodMemoryPagingFaults instrument.
6404 func NewPodMemoryPagingFaults(
6405 m metric.Meter,
6406 opt ...metric.Int64CounterOption,
6407 ) (PodMemoryPagingFaults, error) {
6408 // Check if the meter is nil.
6409 if m == nil {
6410 return PodMemoryPagingFaults{noop.Int64Counter{}}, nil
6411 }
6412
6413 if len(opt) == 0 {
6414 opt = newPodMemoryPagingFaultsOpts
6415 } else {
6416 opt = append(opt, newPodMemoryPagingFaultsOpts...)
6417 }
6418
6419 i, err := m.Int64Counter(
6420 "k8s.pod.memory.paging.faults",
6421 opt...,
6422 )
6423 if err != nil {
6424 return PodMemoryPagingFaults{noop.Int64Counter{}}, err
6425 }
6426 return PodMemoryPagingFaults{i}, nil
6427 }
6428
6429 // Inst returns the underlying metric instrument.
6430 func (m PodMemoryPagingFaults) Inst() metric.Int64Counter {
6431 return m.Int64Counter
6432 }
6433
6434 // Name returns the semantic convention name of the instrument.
6435 func (PodMemoryPagingFaults) Name() string {
6436 return "k8s.pod.memory.paging.faults"
6437 }
6438
6439 // Unit returns the semantic convention unit of the instrument
6440 func (PodMemoryPagingFaults) Unit() string {
6441 return "{fault}"
6442 }
6443
6444 // Description returns the semantic convention description of the instrument
6445 func (PodMemoryPagingFaults) Description() string {
6446 return "Pod memory paging faults."
6447 }
6448
6449 // Add adds incr to the existing count for attrs.
6450 //
6451 // All additional attrs passed are included in the recorded value.
6452 //
6453 // Cumulative number of major/minor page faults.
6454 // This metric is derived from the [MemoryStats.PageFaults] and
6455 // [MemoryStats.MajorPageFaults] field of the [PodStats.Memory] of the Kubelet's
6456 // stats API.
6457 //
6458 // [MemoryStats.PageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6459 // [MemoryStats.MajorPageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6460 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6461 func (m PodMemoryPagingFaults) Add(
6462 ctx context.Context,
6463 incr int64,
6464 attrs ...attribute.KeyValue,
6465 ) {
6466 if len(attrs) == 0 {
6467 m.Int64Counter.Add(ctx, incr)
6468 return
6469 }
6470
6471 o := addOptPool.Get().(*[]metric.AddOption)
6472 defer func() {
6473 *o = (*o)[:0]
6474 addOptPool.Put(o)
6475 }()
6476
6477 *o = append(
6478 *o,
6479 metric.WithAttributes(
6480 attrs...,
6481 ),
6482 )
6483
6484 m.Int64Counter.Add(ctx, incr, *o...)
6485 }
6486
6487 // AddSet adds incr to the existing count for set.
6488 //
6489 // Cumulative number of major/minor page faults.
6490 // This metric is derived from the [MemoryStats.PageFaults] and
6491 // [MemoryStats.MajorPageFaults] field of the [PodStats.Memory] of the Kubelet's
6492 // stats API.
6493 //
6494 // [MemoryStats.PageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6495 // [MemoryStats.MajorPageFaults]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6496 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6497 func (m PodMemoryPagingFaults) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6498 if set.Len() == 0 {
6499 m.Int64Counter.Add(ctx, incr)
6500 return
6501 }
6502
6503 o := addOptPool.Get().(*[]metric.AddOption)
6504 defer func() {
6505 *o = (*o)[:0]
6506 addOptPool.Put(o)
6507 }()
6508
6509 *o = append(*o, metric.WithAttributeSet(set))
6510 m.Int64Counter.Add(ctx, incr, *o...)
6511 }
6512
6513 // AttrSystemPagingFaultType returns an optional attribute for the
6514 // "system.paging.fault.type" semantic convention. It represents the paging fault
6515 // type.
6516 func (PodMemoryPagingFaults) AttrSystemPagingFaultType(val SystemPagingFaultTypeAttr) attribute.KeyValue {
6517 return attribute.String("system.paging.fault.type", string(val))
6518 }
6519
6520 // PodMemoryRss is an instrument used to record metric values conforming to the
6521 // "k8s.pod.memory.rss" semantic conventions. It represents the pod memory RSS.
6522 type PodMemoryRss struct {
6523 metric.Int64UpDownCounter
6524 }
6525
6526 var newPodMemoryRssOpts = []metric.Int64UpDownCounterOption{
6527 metric.WithDescription("Pod memory RSS."),
6528 metric.WithUnit("By"),
6529 }
6530
6531 // NewPodMemoryRss returns a new PodMemoryRss instrument.
6532 func NewPodMemoryRss(
6533 m metric.Meter,
6534 opt ...metric.Int64UpDownCounterOption,
6535 ) (PodMemoryRss, error) {
6536 // Check if the meter is nil.
6537 if m == nil {
6538 return PodMemoryRss{noop.Int64UpDownCounter{}}, nil
6539 }
6540
6541 if len(opt) == 0 {
6542 opt = newPodMemoryRssOpts
6543 } else {
6544 opt = append(opt, newPodMemoryRssOpts...)
6545 }
6546
6547 i, err := m.Int64UpDownCounter(
6548 "k8s.pod.memory.rss",
6549 opt...,
6550 )
6551 if err != nil {
6552 return PodMemoryRss{noop.Int64UpDownCounter{}}, err
6553 }
6554 return PodMemoryRss{i}, nil
6555 }
6556
6557 // Inst returns the underlying metric instrument.
6558 func (m PodMemoryRss) Inst() metric.Int64UpDownCounter {
6559 return m.Int64UpDownCounter
6560 }
6561
6562 // Name returns the semantic convention name of the instrument.
6563 func (PodMemoryRss) Name() string {
6564 return "k8s.pod.memory.rss"
6565 }
6566
6567 // Unit returns the semantic convention unit of the instrument
6568 func (PodMemoryRss) Unit() string {
6569 return "By"
6570 }
6571
6572 // Description returns the semantic convention description of the instrument
6573 func (PodMemoryRss) Description() string {
6574 return "Pod memory RSS."
6575 }
6576
6577 // Add adds incr to the existing count for attrs.
6578 //
6579 // The amount of anonymous and swap cache memory (includes transparent
6580 // hugepages).
6581 // This metric is derived from the [MemoryStats.RSSBytes] field of the
6582 // [PodStats.Memory] of the Kubelet's stats API.
6583 //
6584 // [MemoryStats.RSSBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6585 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6586 func (m PodMemoryRss) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6587 if len(attrs) == 0 {
6588 m.Int64UpDownCounter.Add(ctx, incr)
6589 return
6590 }
6591
6592 o := addOptPool.Get().(*[]metric.AddOption)
6593 defer func() {
6594 *o = (*o)[:0]
6595 addOptPool.Put(o)
6596 }()
6597
6598 *o = append(*o, metric.WithAttributes(attrs...))
6599 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6600 }
6601
6602 // AddSet adds incr to the existing count for set.
6603 //
6604 // The amount of anonymous and swap cache memory (includes transparent
6605 // hugepages).
6606 // This metric is derived from the [MemoryStats.RSSBytes] field of the
6607 // [PodStats.Memory] of the Kubelet's stats API.
6608 //
6609 // [MemoryStats.RSSBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6610 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6611 func (m PodMemoryRss) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6612 if set.Len() == 0 {
6613 m.Int64UpDownCounter.Add(ctx, incr)
6614 return
6615 }
6616
6617 o := addOptPool.Get().(*[]metric.AddOption)
6618 defer func() {
6619 *o = (*o)[:0]
6620 addOptPool.Put(o)
6621 }()
6622
6623 *o = append(*o, metric.WithAttributeSet(set))
6624 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6625 }
6626
6627 // PodMemoryUsage is an instrument used to record metric values conforming to the
6628 // "k8s.pod.memory.usage" semantic conventions. It represents the memory usage of
6629 // the Pod.
6630 type PodMemoryUsage struct {
6631 metric.Int64Gauge
6632 }
6633
6634 var newPodMemoryUsageOpts = []metric.Int64GaugeOption{
6635 metric.WithDescription("Memory usage of the Pod."),
6636 metric.WithUnit("By"),
6637 }
6638
6639 // NewPodMemoryUsage returns a new PodMemoryUsage instrument.
6640 func NewPodMemoryUsage(
6641 m metric.Meter,
6642 opt ...metric.Int64GaugeOption,
6643 ) (PodMemoryUsage, error) {
6644 // Check if the meter is nil.
6645 if m == nil {
6646 return PodMemoryUsage{noop.Int64Gauge{}}, nil
6647 }
6648
6649 if len(opt) == 0 {
6650 opt = newPodMemoryUsageOpts
6651 } else {
6652 opt = append(opt, newPodMemoryUsageOpts...)
6653 }
6654
6655 i, err := m.Int64Gauge(
6656 "k8s.pod.memory.usage",
6657 opt...,
6658 )
6659 if err != nil {
6660 return PodMemoryUsage{noop.Int64Gauge{}}, err
6661 }
6662 return PodMemoryUsage{i}, nil
6663 }
6664
6665 // Inst returns the underlying metric instrument.
6666 func (m PodMemoryUsage) Inst() metric.Int64Gauge {
6667 return m.Int64Gauge
6668 }
6669
6670 // Name returns the semantic convention name of the instrument.
6671 func (PodMemoryUsage) Name() string {
6672 return "k8s.pod.memory.usage"
6673 }
6674
6675 // Unit returns the semantic convention unit of the instrument
6676 func (PodMemoryUsage) Unit() string {
6677 return "By"
6678 }
6679
6680 // Description returns the semantic convention description of the instrument
6681 func (PodMemoryUsage) Description() string {
6682 return "Memory usage of the Pod."
6683 }
6684
6685 // Record records val to the current distribution for attrs.
6686 //
6687 // Total memory usage of the Pod
6688 func (m PodMemoryUsage) Record(ctx context.Context, val int64, attrs ...attribute.KeyValue) {
6689 if len(attrs) == 0 {
6690 m.Int64Gauge.Record(ctx, val)
6691 return
6692 }
6693
6694 o := recOptPool.Get().(*[]metric.RecordOption)
6695 defer func() {
6696 *o = (*o)[:0]
6697 recOptPool.Put(o)
6698 }()
6699
6700 *o = append(*o, metric.WithAttributes(attrs...))
6701 m.Int64Gauge.Record(ctx, val, *o...)
6702 }
6703
6704 // RecordSet records val to the current distribution for set.
6705 //
6706 // Total memory usage of the Pod
6707 func (m PodMemoryUsage) RecordSet(ctx context.Context, val int64, set attribute.Set) {
6708 if set.Len() == 0 {
6709 m.Int64Gauge.Record(ctx, val)
6710 return
6711 }
6712
6713 o := recOptPool.Get().(*[]metric.RecordOption)
6714 defer func() {
6715 *o = (*o)[:0]
6716 recOptPool.Put(o)
6717 }()
6718
6719 *o = append(*o, metric.WithAttributeSet(set))
6720 m.Int64Gauge.Record(ctx, val, *o...)
6721 }
6722
6723 // PodMemoryWorkingSet is an instrument used to record metric values conforming
6724 // to the "k8s.pod.memory.working_set" semantic conventions. It represents the
6725 // pod memory working set.
6726 type PodMemoryWorkingSet struct {
6727 metric.Int64UpDownCounter
6728 }
6729
6730 var newPodMemoryWorkingSetOpts = []metric.Int64UpDownCounterOption{
6731 metric.WithDescription("Pod memory working set."),
6732 metric.WithUnit("By"),
6733 }
6734
6735 // NewPodMemoryWorkingSet returns a new PodMemoryWorkingSet instrument.
6736 func NewPodMemoryWorkingSet(
6737 m metric.Meter,
6738 opt ...metric.Int64UpDownCounterOption,
6739 ) (PodMemoryWorkingSet, error) {
6740 // Check if the meter is nil.
6741 if m == nil {
6742 return PodMemoryWorkingSet{noop.Int64UpDownCounter{}}, nil
6743 }
6744
6745 if len(opt) == 0 {
6746 opt = newPodMemoryWorkingSetOpts
6747 } else {
6748 opt = append(opt, newPodMemoryWorkingSetOpts...)
6749 }
6750
6751 i, err := m.Int64UpDownCounter(
6752 "k8s.pod.memory.working_set",
6753 opt...,
6754 )
6755 if err != nil {
6756 return PodMemoryWorkingSet{noop.Int64UpDownCounter{}}, err
6757 }
6758 return PodMemoryWorkingSet{i}, nil
6759 }
6760
6761 // Inst returns the underlying metric instrument.
6762 func (m PodMemoryWorkingSet) Inst() metric.Int64UpDownCounter {
6763 return m.Int64UpDownCounter
6764 }
6765
6766 // Name returns the semantic convention name of the instrument.
6767 func (PodMemoryWorkingSet) Name() string {
6768 return "k8s.pod.memory.working_set"
6769 }
6770
6771 // Unit returns the semantic convention unit of the instrument
6772 func (PodMemoryWorkingSet) Unit() string {
6773 return "By"
6774 }
6775
6776 // Description returns the semantic convention description of the instrument
6777 func (PodMemoryWorkingSet) Description() string {
6778 return "Pod memory working set."
6779 }
6780
6781 // Add adds incr to the existing count for attrs.
6782 //
6783 // The amount of working set memory. This includes recently accessed memory,
6784 // dirty memory, and kernel memory. WorkingSetBytes is <= UsageBytes.
6785 // This metric is derived from the [MemoryStats.WorkingSetBytes] field of the
6786 // [PodStats.Memory] of the Kubelet's stats API.
6787 //
6788 // [MemoryStats.WorkingSetBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6789 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6790 func (m PodMemoryWorkingSet) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
6791 if len(attrs) == 0 {
6792 m.Int64UpDownCounter.Add(ctx, incr)
6793 return
6794 }
6795
6796 o := addOptPool.Get().(*[]metric.AddOption)
6797 defer func() {
6798 *o = (*o)[:0]
6799 addOptPool.Put(o)
6800 }()
6801
6802 *o = append(*o, metric.WithAttributes(attrs...))
6803 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6804 }
6805
6806 // AddSet adds incr to the existing count for set.
6807 //
6808 // The amount of working set memory. This includes recently accessed memory,
6809 // dirty memory, and kernel memory. WorkingSetBytes is <= UsageBytes.
6810 // This metric is derived from the [MemoryStats.WorkingSetBytes] field of the
6811 // [PodStats.Memory] of the Kubelet's stats API.
6812 //
6813 // [MemoryStats.WorkingSetBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats
6814 // [PodStats.Memory]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
6815 func (m PodMemoryWorkingSet) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6816 if set.Len() == 0 {
6817 m.Int64UpDownCounter.Add(ctx, incr)
6818 return
6819 }
6820
6821 o := addOptPool.Get().(*[]metric.AddOption)
6822 defer func() {
6823 *o = (*o)[:0]
6824 addOptPool.Put(o)
6825 }()
6826
6827 *o = append(*o, metric.WithAttributeSet(set))
6828 m.Int64UpDownCounter.Add(ctx, incr, *o...)
6829 }
6830
6831 // PodNetworkErrors is an instrument used to record metric values conforming to
6832 // the "k8s.pod.network.errors" semantic conventions. It represents the pod
6833 // network errors.
6834 type PodNetworkErrors struct {
6835 metric.Int64Counter
6836 }
6837
6838 var newPodNetworkErrorsOpts = []metric.Int64CounterOption{
6839 metric.WithDescription("Pod network errors."),
6840 metric.WithUnit("{error}"),
6841 }
6842
6843 // NewPodNetworkErrors returns a new PodNetworkErrors instrument.
6844 func NewPodNetworkErrors(
6845 m metric.Meter,
6846 opt ...metric.Int64CounterOption,
6847 ) (PodNetworkErrors, error) {
6848 // Check if the meter is nil.
6849 if m == nil {
6850 return PodNetworkErrors{noop.Int64Counter{}}, nil
6851 }
6852
6853 if len(opt) == 0 {
6854 opt = newPodNetworkErrorsOpts
6855 } else {
6856 opt = append(opt, newPodNetworkErrorsOpts...)
6857 }
6858
6859 i, err := m.Int64Counter(
6860 "k8s.pod.network.errors",
6861 opt...,
6862 )
6863 if err != nil {
6864 return PodNetworkErrors{noop.Int64Counter{}}, err
6865 }
6866 return PodNetworkErrors{i}, nil
6867 }
6868
6869 // Inst returns the underlying metric instrument.
6870 func (m PodNetworkErrors) Inst() metric.Int64Counter {
6871 return m.Int64Counter
6872 }
6873
6874 // Name returns the semantic convention name of the instrument.
6875 func (PodNetworkErrors) Name() string {
6876 return "k8s.pod.network.errors"
6877 }
6878
6879 // Unit returns the semantic convention unit of the instrument
6880 func (PodNetworkErrors) Unit() string {
6881 return "{error}"
6882 }
6883
6884 // Description returns the semantic convention description of the instrument
6885 func (PodNetworkErrors) Description() string {
6886 return "Pod network errors."
6887 }
6888
6889 // Add adds incr to the existing count for attrs.
6890 //
6891 // All additional attrs passed are included in the recorded value.
6892 func (m PodNetworkErrors) Add(
6893 ctx context.Context,
6894 incr int64,
6895 attrs ...attribute.KeyValue,
6896 ) {
6897 if len(attrs) == 0 {
6898 m.Int64Counter.Add(ctx, incr)
6899 return
6900 }
6901
6902 o := addOptPool.Get().(*[]metric.AddOption)
6903 defer func() {
6904 *o = (*o)[:0]
6905 addOptPool.Put(o)
6906 }()
6907
6908 *o = append(
6909 *o,
6910 metric.WithAttributes(
6911 attrs...,
6912 ),
6913 )
6914
6915 m.Int64Counter.Add(ctx, incr, *o...)
6916 }
6917
6918 // AddSet adds incr to the existing count for set.
6919 func (m PodNetworkErrors) AddSet(ctx context.Context, incr int64, set attribute.Set) {
6920 if set.Len() == 0 {
6921 m.Int64Counter.Add(ctx, incr)
6922 return
6923 }
6924
6925 o := addOptPool.Get().(*[]metric.AddOption)
6926 defer func() {
6927 *o = (*o)[:0]
6928 addOptPool.Put(o)
6929 }()
6930
6931 *o = append(*o, metric.WithAttributeSet(set))
6932 m.Int64Counter.Add(ctx, incr, *o...)
6933 }
6934
6935 // AttrNetworkInterfaceName returns an optional attribute for the
6936 // "network.interface.name" semantic convention. It represents the network
6937 // interface name.
6938 func (PodNetworkErrors) AttrNetworkInterfaceName(val string) attribute.KeyValue {
6939 return attribute.String("network.interface.name", val)
6940 }
6941
6942 // AttrNetworkIODirection returns an optional attribute for the
6943 // "network.io.direction" semantic convention. It represents the network IO
6944 // operation direction.
6945 func (PodNetworkErrors) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue {
6946 return attribute.String("network.io.direction", string(val))
6947 }
6948
6949 // PodNetworkIO is an instrument used to record metric values conforming to the
6950 // "k8s.pod.network.io" semantic conventions. It represents the network bytes for
6951 // the Pod.
6952 type PodNetworkIO struct {
6953 metric.Int64Counter
6954 }
6955
6956 var newPodNetworkIOOpts = []metric.Int64CounterOption{
6957 metric.WithDescription("Network bytes for the Pod."),
6958 metric.WithUnit("By"),
6959 }
6960
6961 // NewPodNetworkIO returns a new PodNetworkIO instrument.
6962 func NewPodNetworkIO(
6963 m metric.Meter,
6964 opt ...metric.Int64CounterOption,
6965 ) (PodNetworkIO, error) {
6966 // Check if the meter is nil.
6967 if m == nil {
6968 return PodNetworkIO{noop.Int64Counter{}}, nil
6969 }
6970
6971 if len(opt) == 0 {
6972 opt = newPodNetworkIOOpts
6973 } else {
6974 opt = append(opt, newPodNetworkIOOpts...)
6975 }
6976
6977 i, err := m.Int64Counter(
6978 "k8s.pod.network.io",
6979 opt...,
6980 )
6981 if err != nil {
6982 return PodNetworkIO{noop.Int64Counter{}}, err
6983 }
6984 return PodNetworkIO{i}, nil
6985 }
6986
6987 // Inst returns the underlying metric instrument.
6988 func (m PodNetworkIO) Inst() metric.Int64Counter {
6989 return m.Int64Counter
6990 }
6991
6992 // Name returns the semantic convention name of the instrument.
6993 func (PodNetworkIO) Name() string {
6994 return "k8s.pod.network.io"
6995 }
6996
6997 // Unit returns the semantic convention unit of the instrument
6998 func (PodNetworkIO) Unit() string {
6999 return "By"
7000 }
7001
7002 // Description returns the semantic convention description of the instrument
7003 func (PodNetworkIO) Description() string {
7004 return "Network bytes for the Pod."
7005 }
7006
7007 // Add adds incr to the existing count for attrs.
7008 //
7009 // All additional attrs passed are included in the recorded value.
7010 func (m PodNetworkIO) Add(
7011 ctx context.Context,
7012 incr int64,
7013 attrs ...attribute.KeyValue,
7014 ) {
7015 if len(attrs) == 0 {
7016 m.Int64Counter.Add(ctx, incr)
7017 return
7018 }
7019
7020 o := addOptPool.Get().(*[]metric.AddOption)
7021 defer func() {
7022 *o = (*o)[:0]
7023 addOptPool.Put(o)
7024 }()
7025
7026 *o = append(
7027 *o,
7028 metric.WithAttributes(
7029 attrs...,
7030 ),
7031 )
7032
7033 m.Int64Counter.Add(ctx, incr, *o...)
7034 }
7035
7036 // AddSet adds incr to the existing count for set.
7037 func (m PodNetworkIO) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7038 if set.Len() == 0 {
7039 m.Int64Counter.Add(ctx, incr)
7040 return
7041 }
7042
7043 o := addOptPool.Get().(*[]metric.AddOption)
7044 defer func() {
7045 *o = (*o)[:0]
7046 addOptPool.Put(o)
7047 }()
7048
7049 *o = append(*o, metric.WithAttributeSet(set))
7050 m.Int64Counter.Add(ctx, incr, *o...)
7051 }
7052
7053 // AttrNetworkInterfaceName returns an optional attribute for the
7054 // "network.interface.name" semantic convention. It represents the network
7055 // interface name.
7056 func (PodNetworkIO) AttrNetworkInterfaceName(val string) attribute.KeyValue {
7057 return attribute.String("network.interface.name", val)
7058 }
7059
7060 // AttrNetworkIODirection returns an optional attribute for the
7061 // "network.io.direction" semantic convention. It represents the network IO
7062 // operation direction.
7063 func (PodNetworkIO) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue {
7064 return attribute.String("network.io.direction", string(val))
7065 }
7066
7067 // PodStatusPhase is an instrument used to record metric values conforming to the
7068 // "k8s.pod.status.phase" semantic conventions. It represents the describes
7069 // number of K8s Pods that are currently in a given phase.
7070 type PodStatusPhase struct {
7071 metric.Int64UpDownCounter
7072 }
7073
7074 var newPodStatusPhaseOpts = []metric.Int64UpDownCounterOption{
7075 metric.WithDescription("Describes number of K8s Pods that are currently in a given phase."),
7076 metric.WithUnit("{pod}"),
7077 }
7078
7079 // NewPodStatusPhase returns a new PodStatusPhase instrument.
7080 func NewPodStatusPhase(
7081 m metric.Meter,
7082 opt ...metric.Int64UpDownCounterOption,
7083 ) (PodStatusPhase, error) {
7084 // Check if the meter is nil.
7085 if m == nil {
7086 return PodStatusPhase{noop.Int64UpDownCounter{}}, nil
7087 }
7088
7089 if len(opt) == 0 {
7090 opt = newPodStatusPhaseOpts
7091 } else {
7092 opt = append(opt, newPodStatusPhaseOpts...)
7093 }
7094
7095 i, err := m.Int64UpDownCounter(
7096 "k8s.pod.status.phase",
7097 opt...,
7098 )
7099 if err != nil {
7100 return PodStatusPhase{noop.Int64UpDownCounter{}}, err
7101 }
7102 return PodStatusPhase{i}, nil
7103 }
7104
7105 // Inst returns the underlying metric instrument.
7106 func (m PodStatusPhase) Inst() metric.Int64UpDownCounter {
7107 return m.Int64UpDownCounter
7108 }
7109
7110 // Name returns the semantic convention name of the instrument.
7111 func (PodStatusPhase) Name() string {
7112 return "k8s.pod.status.phase"
7113 }
7114
7115 // Unit returns the semantic convention unit of the instrument
7116 func (PodStatusPhase) Unit() string {
7117 return "{pod}"
7118 }
7119
7120 // Description returns the semantic convention description of the instrument
7121 func (PodStatusPhase) Description() string {
7122 return "Describes number of K8s Pods that are currently in a given phase."
7123 }
7124
7125 // Add adds incr to the existing count for attrs.
7126 //
7127 // The podStatusPhase is the the phase for the pod. Corresponds to the `phase`
7128 // field of the: [K8s PodStatus]
7129 //
7130 // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core
7131 //
7132 // All possible pod phases will be reported at each time interval to avoid
7133 // missing metrics.
7134 // Only the value corresponding to the current phase will be non-zero.
7135 func (m PodStatusPhase) Add(
7136 ctx context.Context,
7137 incr int64,
7138 podStatusPhase PodStatusPhaseAttr,
7139 attrs ...attribute.KeyValue,
7140 ) {
7141 if len(attrs) == 0 {
7142 m.Int64UpDownCounter.Add(ctx, incr)
7143 return
7144 }
7145
7146 o := addOptPool.Get().(*[]metric.AddOption)
7147 defer func() {
7148 *o = (*o)[:0]
7149 addOptPool.Put(o)
7150 }()
7151
7152 *o = append(
7153 *o,
7154 metric.WithAttributes(
7155 append(
7156 attrs,
7157 attribute.String("k8s.pod.status.phase", string(podStatusPhase)),
7158 )...,
7159 ),
7160 )
7161
7162 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7163 }
7164
7165 // AddSet adds incr to the existing count for set.
7166 //
7167 // All possible pod phases will be reported at each time interval to avoid
7168 // missing metrics.
7169 // Only the value corresponding to the current phase will be non-zero.
7170 func (m PodStatusPhase) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7171 if set.Len() == 0 {
7172 m.Int64UpDownCounter.Add(ctx, incr)
7173 return
7174 }
7175
7176 o := addOptPool.Get().(*[]metric.AddOption)
7177 defer func() {
7178 *o = (*o)[:0]
7179 addOptPool.Put(o)
7180 }()
7181
7182 *o = append(*o, metric.WithAttributeSet(set))
7183 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7184 }
7185
7186 // PodStatusReason is an instrument used to record metric values conforming to
7187 // the "k8s.pod.status.reason" semantic conventions. It represents the describes
7188 // the number of K8s Pods that are currently in a state for a given reason.
7189 type PodStatusReason struct {
7190 metric.Int64UpDownCounter
7191 }
7192
7193 var newPodStatusReasonOpts = []metric.Int64UpDownCounterOption{
7194 metric.WithDescription("Describes the number of K8s Pods that are currently in a state for a given reason."),
7195 metric.WithUnit("{pod}"),
7196 }
7197
7198 // NewPodStatusReason returns a new PodStatusReason instrument.
7199 func NewPodStatusReason(
7200 m metric.Meter,
7201 opt ...metric.Int64UpDownCounterOption,
7202 ) (PodStatusReason, error) {
7203 // Check if the meter is nil.
7204 if m == nil {
7205 return PodStatusReason{noop.Int64UpDownCounter{}}, nil
7206 }
7207
7208 if len(opt) == 0 {
7209 opt = newPodStatusReasonOpts
7210 } else {
7211 opt = append(opt, newPodStatusReasonOpts...)
7212 }
7213
7214 i, err := m.Int64UpDownCounter(
7215 "k8s.pod.status.reason",
7216 opt...,
7217 )
7218 if err != nil {
7219 return PodStatusReason{noop.Int64UpDownCounter{}}, err
7220 }
7221 return PodStatusReason{i}, nil
7222 }
7223
7224 // Inst returns the underlying metric instrument.
7225 func (m PodStatusReason) Inst() metric.Int64UpDownCounter {
7226 return m.Int64UpDownCounter
7227 }
7228
7229 // Name returns the semantic convention name of the instrument.
7230 func (PodStatusReason) Name() string {
7231 return "k8s.pod.status.reason"
7232 }
7233
7234 // Unit returns the semantic convention unit of the instrument
7235 func (PodStatusReason) Unit() string {
7236 return "{pod}"
7237 }
7238
7239 // Description returns the semantic convention description of the instrument
7240 func (PodStatusReason) Description() string {
7241 return "Describes the number of K8s Pods that are currently in a state for a given reason."
7242 }
7243
7244 // Add adds incr to the existing count for attrs.
7245 //
7246 // The podStatusReason is the the reason for the pod state. Corresponds to the
7247 // `reason` field of the: [K8s PodStatus]
7248 //
7249 // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core
7250 //
7251 // All possible pod status reasons will be reported at each time interval to
7252 // avoid missing metrics.
7253 // Only the value corresponding to the current reason will be non-zero.
7254 func (m PodStatusReason) Add(
7255 ctx context.Context,
7256 incr int64,
7257 podStatusReason PodStatusReasonAttr,
7258 attrs ...attribute.KeyValue,
7259 ) {
7260 if len(attrs) == 0 {
7261 m.Int64UpDownCounter.Add(ctx, incr)
7262 return
7263 }
7264
7265 o := addOptPool.Get().(*[]metric.AddOption)
7266 defer func() {
7267 *o = (*o)[:0]
7268 addOptPool.Put(o)
7269 }()
7270
7271 *o = append(
7272 *o,
7273 metric.WithAttributes(
7274 append(
7275 attrs,
7276 attribute.String("k8s.pod.status.reason", string(podStatusReason)),
7277 )...,
7278 ),
7279 )
7280
7281 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7282 }
7283
7284 // AddSet adds incr to the existing count for set.
7285 //
7286 // All possible pod status reasons will be reported at each time interval to
7287 // avoid missing metrics.
7288 // Only the value corresponding to the current reason will be non-zero.
7289 func (m PodStatusReason) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7290 if set.Len() == 0 {
7291 m.Int64UpDownCounter.Add(ctx, incr)
7292 return
7293 }
7294
7295 o := addOptPool.Get().(*[]metric.AddOption)
7296 defer func() {
7297 *o = (*o)[:0]
7298 addOptPool.Put(o)
7299 }()
7300
7301 *o = append(*o, metric.WithAttributeSet(set))
7302 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7303 }
7304
7305 // PodUptime is an instrument used to record metric values conforming to the
7306 // "k8s.pod.uptime" semantic conventions. It represents the time the Pod has been
7307 // running.
7308 type PodUptime struct {
7309 metric.Float64Gauge
7310 }
7311
7312 var newPodUptimeOpts = []metric.Float64GaugeOption{
7313 metric.WithDescription("The time the Pod has been running."),
7314 metric.WithUnit("s"),
7315 }
7316
7317 // NewPodUptime returns a new PodUptime instrument.
7318 func NewPodUptime(
7319 m metric.Meter,
7320 opt ...metric.Float64GaugeOption,
7321 ) (PodUptime, error) {
7322 // Check if the meter is nil.
7323 if m == nil {
7324 return PodUptime{noop.Float64Gauge{}}, nil
7325 }
7326
7327 if len(opt) == 0 {
7328 opt = newPodUptimeOpts
7329 } else {
7330 opt = append(opt, newPodUptimeOpts...)
7331 }
7332
7333 i, err := m.Float64Gauge(
7334 "k8s.pod.uptime",
7335 opt...,
7336 )
7337 if err != nil {
7338 return PodUptime{noop.Float64Gauge{}}, err
7339 }
7340 return PodUptime{i}, nil
7341 }
7342
7343 // Inst returns the underlying metric instrument.
7344 func (m PodUptime) Inst() metric.Float64Gauge {
7345 return m.Float64Gauge
7346 }
7347
7348 // Name returns the semantic convention name of the instrument.
7349 func (PodUptime) Name() string {
7350 return "k8s.pod.uptime"
7351 }
7352
7353 // Unit returns the semantic convention unit of the instrument
7354 func (PodUptime) Unit() string {
7355 return "s"
7356 }
7357
7358 // Description returns the semantic convention description of the instrument
7359 func (PodUptime) Description() string {
7360 return "The time the Pod has been running."
7361 }
7362
7363 // Record records val to the current distribution for attrs.
7364 //
7365 // Instrumentations SHOULD use a gauge with type `double` and measure uptime in
7366 // seconds as a floating point number with the highest precision available.
7367 // The actual accuracy would depend on the instrumentation and operating system.
7368 func (m PodUptime) Record(ctx context.Context, val float64, attrs ...attribute.KeyValue) {
7369 if len(attrs) == 0 {
7370 m.Float64Gauge.Record(ctx, val)
7371 return
7372 }
7373
7374 o := recOptPool.Get().(*[]metric.RecordOption)
7375 defer func() {
7376 *o = (*o)[:0]
7377 recOptPool.Put(o)
7378 }()
7379
7380 *o = append(*o, metric.WithAttributes(attrs...))
7381 m.Float64Gauge.Record(ctx, val, *o...)
7382 }
7383
7384 // RecordSet records val to the current distribution for set.
7385 //
7386 // Instrumentations SHOULD use a gauge with type `double` and measure uptime in
7387 // seconds as a floating point number with the highest precision available.
7388 // The actual accuracy would depend on the instrumentation and operating system.
7389 func (m PodUptime) RecordSet(ctx context.Context, val float64, set attribute.Set) {
7390 if set.Len() == 0 {
7391 m.Float64Gauge.Record(ctx, val)
7392 return
7393 }
7394
7395 o := recOptPool.Get().(*[]metric.RecordOption)
7396 defer func() {
7397 *o = (*o)[:0]
7398 recOptPool.Put(o)
7399 }()
7400
7401 *o = append(*o, metric.WithAttributeSet(set))
7402 m.Float64Gauge.Record(ctx, val, *o...)
7403 }
7404
7405 // PodVolumeAvailable is an instrument used to record metric values conforming to
7406 // the "k8s.pod.volume.available" semantic conventions. It represents the pod
7407 // volume storage space available.
7408 type PodVolumeAvailable struct {
7409 metric.Int64UpDownCounter
7410 }
7411
7412 var newPodVolumeAvailableOpts = []metric.Int64UpDownCounterOption{
7413 metric.WithDescription("Pod volume storage space available."),
7414 metric.WithUnit("By"),
7415 }
7416
7417 // NewPodVolumeAvailable returns a new PodVolumeAvailable instrument.
7418 func NewPodVolumeAvailable(
7419 m metric.Meter,
7420 opt ...metric.Int64UpDownCounterOption,
7421 ) (PodVolumeAvailable, error) {
7422 // Check if the meter is nil.
7423 if m == nil {
7424 return PodVolumeAvailable{noop.Int64UpDownCounter{}}, nil
7425 }
7426
7427 if len(opt) == 0 {
7428 opt = newPodVolumeAvailableOpts
7429 } else {
7430 opt = append(opt, newPodVolumeAvailableOpts...)
7431 }
7432
7433 i, err := m.Int64UpDownCounter(
7434 "k8s.pod.volume.available",
7435 opt...,
7436 )
7437 if err != nil {
7438 return PodVolumeAvailable{noop.Int64UpDownCounter{}}, err
7439 }
7440 return PodVolumeAvailable{i}, nil
7441 }
7442
7443 // Inst returns the underlying metric instrument.
7444 func (m PodVolumeAvailable) Inst() metric.Int64UpDownCounter {
7445 return m.Int64UpDownCounter
7446 }
7447
7448 // Name returns the semantic convention name of the instrument.
7449 func (PodVolumeAvailable) Name() string {
7450 return "k8s.pod.volume.available"
7451 }
7452
7453 // Unit returns the semantic convention unit of the instrument
7454 func (PodVolumeAvailable) Unit() string {
7455 return "By"
7456 }
7457
7458 // Description returns the semantic convention description of the instrument
7459 func (PodVolumeAvailable) Description() string {
7460 return "Pod volume storage space available."
7461 }
7462
7463 // Add adds incr to the existing count for attrs.
7464 //
7465 // The volumeName is the the name of the K8s volume.
7466 //
7467 // All additional attrs passed are included in the recorded value.
7468 //
7469 // This metric is derived from the
7470 // [VolumeStats.AvailableBytes] field
7471 // of the [PodStats] of the
7472 // Kubelet's stats API.
7473 //
7474 // [VolumeStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7475 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7476 func (m PodVolumeAvailable) Add(
7477 ctx context.Context,
7478 incr int64,
7479 volumeName string,
7480 attrs ...attribute.KeyValue,
7481 ) {
7482 if len(attrs) == 0 {
7483 m.Int64UpDownCounter.Add(ctx, incr)
7484 return
7485 }
7486
7487 o := addOptPool.Get().(*[]metric.AddOption)
7488 defer func() {
7489 *o = (*o)[:0]
7490 addOptPool.Put(o)
7491 }()
7492
7493 *o = append(
7494 *o,
7495 metric.WithAttributes(
7496 append(
7497 attrs,
7498 attribute.String("k8s.volume.name", volumeName),
7499 )...,
7500 ),
7501 )
7502
7503 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7504 }
7505
7506 // AddSet adds incr to the existing count for set.
7507 //
7508 // This metric is derived from the
7509 // [VolumeStats.AvailableBytes] field
7510 // of the [PodStats] of the
7511 // Kubelet's stats API.
7512 //
7513 // [VolumeStats.AvailableBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7514 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7515 func (m PodVolumeAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7516 if set.Len() == 0 {
7517 m.Int64UpDownCounter.Add(ctx, incr)
7518 return
7519 }
7520
7521 o := addOptPool.Get().(*[]metric.AddOption)
7522 defer func() {
7523 *o = (*o)[:0]
7524 addOptPool.Put(o)
7525 }()
7526
7527 *o = append(*o, metric.WithAttributeSet(set))
7528 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7529 }
7530
7531 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
7532 // semantic convention. It represents the type of the K8s volume.
7533 func (PodVolumeAvailable) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
7534 return attribute.String("k8s.volume.type", string(val))
7535 }
7536
7537 // PodVolumeCapacity is an instrument used to record metric values conforming to
7538 // the "k8s.pod.volume.capacity" semantic conventions. It represents the pod
7539 // volume total capacity.
7540 type PodVolumeCapacity struct {
7541 metric.Int64UpDownCounter
7542 }
7543
7544 var newPodVolumeCapacityOpts = []metric.Int64UpDownCounterOption{
7545 metric.WithDescription("Pod volume total capacity."),
7546 metric.WithUnit("By"),
7547 }
7548
7549 // NewPodVolumeCapacity returns a new PodVolumeCapacity instrument.
7550 func NewPodVolumeCapacity(
7551 m metric.Meter,
7552 opt ...metric.Int64UpDownCounterOption,
7553 ) (PodVolumeCapacity, error) {
7554 // Check if the meter is nil.
7555 if m == nil {
7556 return PodVolumeCapacity{noop.Int64UpDownCounter{}}, nil
7557 }
7558
7559 if len(opt) == 0 {
7560 opt = newPodVolumeCapacityOpts
7561 } else {
7562 opt = append(opt, newPodVolumeCapacityOpts...)
7563 }
7564
7565 i, err := m.Int64UpDownCounter(
7566 "k8s.pod.volume.capacity",
7567 opt...,
7568 )
7569 if err != nil {
7570 return PodVolumeCapacity{noop.Int64UpDownCounter{}}, err
7571 }
7572 return PodVolumeCapacity{i}, nil
7573 }
7574
7575 // Inst returns the underlying metric instrument.
7576 func (m PodVolumeCapacity) Inst() metric.Int64UpDownCounter {
7577 return m.Int64UpDownCounter
7578 }
7579
7580 // Name returns the semantic convention name of the instrument.
7581 func (PodVolumeCapacity) Name() string {
7582 return "k8s.pod.volume.capacity"
7583 }
7584
7585 // Unit returns the semantic convention unit of the instrument
7586 func (PodVolumeCapacity) Unit() string {
7587 return "By"
7588 }
7589
7590 // Description returns the semantic convention description of the instrument
7591 func (PodVolumeCapacity) Description() string {
7592 return "Pod volume total capacity."
7593 }
7594
7595 // Add adds incr to the existing count for attrs.
7596 //
7597 // The volumeName is the the name of the K8s volume.
7598 //
7599 // All additional attrs passed are included in the recorded value.
7600 //
7601 // This metric is derived from the
7602 // [VolumeStats.CapacityBytes] field
7603 // of the [PodStats] of the
7604 // Kubelet's stats API.
7605 //
7606 // [VolumeStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7607 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7608 func (m PodVolumeCapacity) Add(
7609 ctx context.Context,
7610 incr int64,
7611 volumeName string,
7612 attrs ...attribute.KeyValue,
7613 ) {
7614 if len(attrs) == 0 {
7615 m.Int64UpDownCounter.Add(ctx, incr)
7616 return
7617 }
7618
7619 o := addOptPool.Get().(*[]metric.AddOption)
7620 defer func() {
7621 *o = (*o)[:0]
7622 addOptPool.Put(o)
7623 }()
7624
7625 *o = append(
7626 *o,
7627 metric.WithAttributes(
7628 append(
7629 attrs,
7630 attribute.String("k8s.volume.name", volumeName),
7631 )...,
7632 ),
7633 )
7634
7635 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7636 }
7637
7638 // AddSet adds incr to the existing count for set.
7639 //
7640 // This metric is derived from the
7641 // [VolumeStats.CapacityBytes] field
7642 // of the [PodStats] of the
7643 // Kubelet's stats API.
7644 //
7645 // [VolumeStats.CapacityBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7646 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7647 func (m PodVolumeCapacity) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7648 if set.Len() == 0 {
7649 m.Int64UpDownCounter.Add(ctx, incr)
7650 return
7651 }
7652
7653 o := addOptPool.Get().(*[]metric.AddOption)
7654 defer func() {
7655 *o = (*o)[:0]
7656 addOptPool.Put(o)
7657 }()
7658
7659 *o = append(*o, metric.WithAttributeSet(set))
7660 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7661 }
7662
7663 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
7664 // semantic convention. It represents the type of the K8s volume.
7665 func (PodVolumeCapacity) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
7666 return attribute.String("k8s.volume.type", string(val))
7667 }
7668
7669 // PodVolumeInodeCount is an instrument used to record metric values conforming
7670 // to the "k8s.pod.volume.inode.count" semantic conventions. It represents the
7671 // total inodes in the filesystem of the Pod's volume.
7672 type PodVolumeInodeCount struct {
7673 metric.Int64UpDownCounter
7674 }
7675
7676 var newPodVolumeInodeCountOpts = []metric.Int64UpDownCounterOption{
7677 metric.WithDescription("The total inodes in the filesystem of the Pod's volume."),
7678 metric.WithUnit("{inode}"),
7679 }
7680
7681 // NewPodVolumeInodeCount returns a new PodVolumeInodeCount instrument.
7682 func NewPodVolumeInodeCount(
7683 m metric.Meter,
7684 opt ...metric.Int64UpDownCounterOption,
7685 ) (PodVolumeInodeCount, error) {
7686 // Check if the meter is nil.
7687 if m == nil {
7688 return PodVolumeInodeCount{noop.Int64UpDownCounter{}}, nil
7689 }
7690
7691 if len(opt) == 0 {
7692 opt = newPodVolumeInodeCountOpts
7693 } else {
7694 opt = append(opt, newPodVolumeInodeCountOpts...)
7695 }
7696
7697 i, err := m.Int64UpDownCounter(
7698 "k8s.pod.volume.inode.count",
7699 opt...,
7700 )
7701 if err != nil {
7702 return PodVolumeInodeCount{noop.Int64UpDownCounter{}}, err
7703 }
7704 return PodVolumeInodeCount{i}, nil
7705 }
7706
7707 // Inst returns the underlying metric instrument.
7708 func (m PodVolumeInodeCount) Inst() metric.Int64UpDownCounter {
7709 return m.Int64UpDownCounter
7710 }
7711
7712 // Name returns the semantic convention name of the instrument.
7713 func (PodVolumeInodeCount) Name() string {
7714 return "k8s.pod.volume.inode.count"
7715 }
7716
7717 // Unit returns the semantic convention unit of the instrument
7718 func (PodVolumeInodeCount) Unit() string {
7719 return "{inode}"
7720 }
7721
7722 // Description returns the semantic convention description of the instrument
7723 func (PodVolumeInodeCount) Description() string {
7724 return "The total inodes in the filesystem of the Pod's volume."
7725 }
7726
7727 // Add adds incr to the existing count for attrs.
7728 //
7729 // The volumeName is the the name of the K8s volume.
7730 //
7731 // All additional attrs passed are included in the recorded value.
7732 //
7733 // This metric is derived from the
7734 // [VolumeStats.Inodes] field
7735 // of the [PodStats] of the
7736 // Kubelet's stats API.
7737 //
7738 // [VolumeStats.Inodes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7739 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7740 func (m PodVolumeInodeCount) Add(
7741 ctx context.Context,
7742 incr int64,
7743 volumeName string,
7744 attrs ...attribute.KeyValue,
7745 ) {
7746 if len(attrs) == 0 {
7747 m.Int64UpDownCounter.Add(ctx, incr)
7748 return
7749 }
7750
7751 o := addOptPool.Get().(*[]metric.AddOption)
7752 defer func() {
7753 *o = (*o)[:0]
7754 addOptPool.Put(o)
7755 }()
7756
7757 *o = append(
7758 *o,
7759 metric.WithAttributes(
7760 append(
7761 attrs,
7762 attribute.String("k8s.volume.name", volumeName),
7763 )...,
7764 ),
7765 )
7766
7767 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7768 }
7769
7770 // AddSet adds incr to the existing count for set.
7771 //
7772 // This metric is derived from the
7773 // [VolumeStats.Inodes] field
7774 // of the [PodStats] of the
7775 // Kubelet's stats API.
7776 //
7777 // [VolumeStats.Inodes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7778 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7779 func (m PodVolumeInodeCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7780 if set.Len() == 0 {
7781 m.Int64UpDownCounter.Add(ctx, incr)
7782 return
7783 }
7784
7785 o := addOptPool.Get().(*[]metric.AddOption)
7786 defer func() {
7787 *o = (*o)[:0]
7788 addOptPool.Put(o)
7789 }()
7790
7791 *o = append(*o, metric.WithAttributeSet(set))
7792 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7793 }
7794
7795 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
7796 // semantic convention. It represents the type of the K8s volume.
7797 func (PodVolumeInodeCount) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
7798 return attribute.String("k8s.volume.type", string(val))
7799 }
7800
7801 // PodVolumeInodeFree is an instrument used to record metric values conforming to
7802 // the "k8s.pod.volume.inode.free" semantic conventions. It represents the free
7803 // inodes in the filesystem of the Pod's volume.
7804 type PodVolumeInodeFree struct {
7805 metric.Int64UpDownCounter
7806 }
7807
7808 var newPodVolumeInodeFreeOpts = []metric.Int64UpDownCounterOption{
7809 metric.WithDescription("The free inodes in the filesystem of the Pod's volume."),
7810 metric.WithUnit("{inode}"),
7811 }
7812
7813 // NewPodVolumeInodeFree returns a new PodVolumeInodeFree instrument.
7814 func NewPodVolumeInodeFree(
7815 m metric.Meter,
7816 opt ...metric.Int64UpDownCounterOption,
7817 ) (PodVolumeInodeFree, error) {
7818 // Check if the meter is nil.
7819 if m == nil {
7820 return PodVolumeInodeFree{noop.Int64UpDownCounter{}}, nil
7821 }
7822
7823 if len(opt) == 0 {
7824 opt = newPodVolumeInodeFreeOpts
7825 } else {
7826 opt = append(opt, newPodVolumeInodeFreeOpts...)
7827 }
7828
7829 i, err := m.Int64UpDownCounter(
7830 "k8s.pod.volume.inode.free",
7831 opt...,
7832 )
7833 if err != nil {
7834 return PodVolumeInodeFree{noop.Int64UpDownCounter{}}, err
7835 }
7836 return PodVolumeInodeFree{i}, nil
7837 }
7838
7839 // Inst returns the underlying metric instrument.
7840 func (m PodVolumeInodeFree) Inst() metric.Int64UpDownCounter {
7841 return m.Int64UpDownCounter
7842 }
7843
7844 // Name returns the semantic convention name of the instrument.
7845 func (PodVolumeInodeFree) Name() string {
7846 return "k8s.pod.volume.inode.free"
7847 }
7848
7849 // Unit returns the semantic convention unit of the instrument
7850 func (PodVolumeInodeFree) Unit() string {
7851 return "{inode}"
7852 }
7853
7854 // Description returns the semantic convention description of the instrument
7855 func (PodVolumeInodeFree) Description() string {
7856 return "The free inodes in the filesystem of the Pod's volume."
7857 }
7858
7859 // Add adds incr to the existing count for attrs.
7860 //
7861 // The volumeName is the the name of the K8s volume.
7862 //
7863 // All additional attrs passed are included in the recorded value.
7864 //
7865 // This metric is derived from the
7866 // [VolumeStats.InodesFree] field
7867 // of the [PodStats] of the
7868 // Kubelet's stats API.
7869 //
7870 // [VolumeStats.InodesFree]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7871 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7872 func (m PodVolumeInodeFree) Add(
7873 ctx context.Context,
7874 incr int64,
7875 volumeName string,
7876 attrs ...attribute.KeyValue,
7877 ) {
7878 if len(attrs) == 0 {
7879 m.Int64UpDownCounter.Add(ctx, incr)
7880 return
7881 }
7882
7883 o := addOptPool.Get().(*[]metric.AddOption)
7884 defer func() {
7885 *o = (*o)[:0]
7886 addOptPool.Put(o)
7887 }()
7888
7889 *o = append(
7890 *o,
7891 metric.WithAttributes(
7892 append(
7893 attrs,
7894 attribute.String("k8s.volume.name", volumeName),
7895 )...,
7896 ),
7897 )
7898
7899 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7900 }
7901
7902 // AddSet adds incr to the existing count for set.
7903 //
7904 // This metric is derived from the
7905 // [VolumeStats.InodesFree] field
7906 // of the [PodStats] of the
7907 // Kubelet's stats API.
7908 //
7909 // [VolumeStats.InodesFree]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
7910 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
7911 func (m PodVolumeInodeFree) AddSet(ctx context.Context, incr int64, set attribute.Set) {
7912 if set.Len() == 0 {
7913 m.Int64UpDownCounter.Add(ctx, incr)
7914 return
7915 }
7916
7917 o := addOptPool.Get().(*[]metric.AddOption)
7918 defer func() {
7919 *o = (*o)[:0]
7920 addOptPool.Put(o)
7921 }()
7922
7923 *o = append(*o, metric.WithAttributeSet(set))
7924 m.Int64UpDownCounter.Add(ctx, incr, *o...)
7925 }
7926
7927 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
7928 // semantic convention. It represents the type of the K8s volume.
7929 func (PodVolumeInodeFree) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
7930 return attribute.String("k8s.volume.type", string(val))
7931 }
7932
7933 // PodVolumeInodeUsed is an instrument used to record metric values conforming to
7934 // the "k8s.pod.volume.inode.used" semantic conventions. It represents the inodes
7935 // used by the filesystem of the Pod's volume.
7936 type PodVolumeInodeUsed struct {
7937 metric.Int64UpDownCounter
7938 }
7939
7940 var newPodVolumeInodeUsedOpts = []metric.Int64UpDownCounterOption{
7941 metric.WithDescription("The inodes used by the filesystem of the Pod's volume."),
7942 metric.WithUnit("{inode}"),
7943 }
7944
7945 // NewPodVolumeInodeUsed returns a new PodVolumeInodeUsed instrument.
7946 func NewPodVolumeInodeUsed(
7947 m metric.Meter,
7948 opt ...metric.Int64UpDownCounterOption,
7949 ) (PodVolumeInodeUsed, error) {
7950 // Check if the meter is nil.
7951 if m == nil {
7952 return PodVolumeInodeUsed{noop.Int64UpDownCounter{}}, nil
7953 }
7954
7955 if len(opt) == 0 {
7956 opt = newPodVolumeInodeUsedOpts
7957 } else {
7958 opt = append(opt, newPodVolumeInodeUsedOpts...)
7959 }
7960
7961 i, err := m.Int64UpDownCounter(
7962 "k8s.pod.volume.inode.used",
7963 opt...,
7964 )
7965 if err != nil {
7966 return PodVolumeInodeUsed{noop.Int64UpDownCounter{}}, err
7967 }
7968 return PodVolumeInodeUsed{i}, nil
7969 }
7970
7971 // Inst returns the underlying metric instrument.
7972 func (m PodVolumeInodeUsed) Inst() metric.Int64UpDownCounter {
7973 return m.Int64UpDownCounter
7974 }
7975
7976 // Name returns the semantic convention name of the instrument.
7977 func (PodVolumeInodeUsed) Name() string {
7978 return "k8s.pod.volume.inode.used"
7979 }
7980
7981 // Unit returns the semantic convention unit of the instrument
7982 func (PodVolumeInodeUsed) Unit() string {
7983 return "{inode}"
7984 }
7985
7986 // Description returns the semantic convention description of the instrument
7987 func (PodVolumeInodeUsed) Description() string {
7988 return "The inodes used by the filesystem of the Pod's volume."
7989 }
7990
7991 // Add adds incr to the existing count for attrs.
7992 //
7993 // The volumeName is the the name of the K8s volume.
7994 //
7995 // All additional attrs passed are included in the recorded value.
7996 //
7997 // This metric is derived from the
7998 // [VolumeStats.InodesUsed] field
7999 // of the [PodStats] of the
8000 // Kubelet's stats API.
8001 //
8002 // This may not be equal to `inodes - free` because filesystem may share inodes
8003 // with other filesystems.
8004 //
8005 // [VolumeStats.InodesUsed]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
8006 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
8007 func (m PodVolumeInodeUsed) Add(
8008 ctx context.Context,
8009 incr int64,
8010 volumeName string,
8011 attrs ...attribute.KeyValue,
8012 ) {
8013 if len(attrs) == 0 {
8014 m.Int64UpDownCounter.Add(ctx, incr)
8015 return
8016 }
8017
8018 o := addOptPool.Get().(*[]metric.AddOption)
8019 defer func() {
8020 *o = (*o)[:0]
8021 addOptPool.Put(o)
8022 }()
8023
8024 *o = append(
8025 *o,
8026 metric.WithAttributes(
8027 append(
8028 attrs,
8029 attribute.String("k8s.volume.name", volumeName),
8030 )...,
8031 ),
8032 )
8033
8034 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8035 }
8036
8037 // AddSet adds incr to the existing count for set.
8038 //
8039 // This metric is derived from the
8040 // [VolumeStats.InodesUsed] field
8041 // of the [PodStats] of the
8042 // Kubelet's stats API.
8043 //
8044 // This may not be equal to `inodes - free` because filesystem may share inodes
8045 // with other filesystems.
8046 //
8047 // [VolumeStats.InodesUsed]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
8048 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
8049 func (m PodVolumeInodeUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8050 if set.Len() == 0 {
8051 m.Int64UpDownCounter.Add(ctx, incr)
8052 return
8053 }
8054
8055 o := addOptPool.Get().(*[]metric.AddOption)
8056 defer func() {
8057 *o = (*o)[:0]
8058 addOptPool.Put(o)
8059 }()
8060
8061 *o = append(*o, metric.WithAttributeSet(set))
8062 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8063 }
8064
8065 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
8066 // semantic convention. It represents the type of the K8s volume.
8067 func (PodVolumeInodeUsed) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
8068 return attribute.String("k8s.volume.type", string(val))
8069 }
8070
8071 // PodVolumeUsage is an instrument used to record metric values conforming to the
8072 // "k8s.pod.volume.usage" semantic conventions. It represents the pod volume
8073 // usage.
8074 type PodVolumeUsage struct {
8075 metric.Int64UpDownCounter
8076 }
8077
8078 var newPodVolumeUsageOpts = []metric.Int64UpDownCounterOption{
8079 metric.WithDescription("Pod volume usage."),
8080 metric.WithUnit("By"),
8081 }
8082
8083 // NewPodVolumeUsage returns a new PodVolumeUsage instrument.
8084 func NewPodVolumeUsage(
8085 m metric.Meter,
8086 opt ...metric.Int64UpDownCounterOption,
8087 ) (PodVolumeUsage, error) {
8088 // Check if the meter is nil.
8089 if m == nil {
8090 return PodVolumeUsage{noop.Int64UpDownCounter{}}, nil
8091 }
8092
8093 if len(opt) == 0 {
8094 opt = newPodVolumeUsageOpts
8095 } else {
8096 opt = append(opt, newPodVolumeUsageOpts...)
8097 }
8098
8099 i, err := m.Int64UpDownCounter(
8100 "k8s.pod.volume.usage",
8101 opt...,
8102 )
8103 if err != nil {
8104 return PodVolumeUsage{noop.Int64UpDownCounter{}}, err
8105 }
8106 return PodVolumeUsage{i}, nil
8107 }
8108
8109 // Inst returns the underlying metric instrument.
8110 func (m PodVolumeUsage) Inst() metric.Int64UpDownCounter {
8111 return m.Int64UpDownCounter
8112 }
8113
8114 // Name returns the semantic convention name of the instrument.
8115 func (PodVolumeUsage) Name() string {
8116 return "k8s.pod.volume.usage"
8117 }
8118
8119 // Unit returns the semantic convention unit of the instrument
8120 func (PodVolumeUsage) Unit() string {
8121 return "By"
8122 }
8123
8124 // Description returns the semantic convention description of the instrument
8125 func (PodVolumeUsage) Description() string {
8126 return "Pod volume usage."
8127 }
8128
8129 // Add adds incr to the existing count for attrs.
8130 //
8131 // The volumeName is the the name of the K8s volume.
8132 //
8133 // All additional attrs passed are included in the recorded value.
8134 //
8135 // This may not equal capacity - available.
8136 //
8137 // This metric is derived from the
8138 // [VolumeStats.UsedBytes] field
8139 // of the [PodStats] of the
8140 // Kubelet's stats API.
8141 //
8142 // [VolumeStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
8143 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
8144 func (m PodVolumeUsage) Add(
8145 ctx context.Context,
8146 incr int64,
8147 volumeName string,
8148 attrs ...attribute.KeyValue,
8149 ) {
8150 if len(attrs) == 0 {
8151 m.Int64UpDownCounter.Add(ctx, incr)
8152 return
8153 }
8154
8155 o := addOptPool.Get().(*[]metric.AddOption)
8156 defer func() {
8157 *o = (*o)[:0]
8158 addOptPool.Put(o)
8159 }()
8160
8161 *o = append(
8162 *o,
8163 metric.WithAttributes(
8164 append(
8165 attrs,
8166 attribute.String("k8s.volume.name", volumeName),
8167 )...,
8168 ),
8169 )
8170
8171 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8172 }
8173
8174 // AddSet adds incr to the existing count for set.
8175 //
8176 // This may not equal capacity - available.
8177 //
8178 // This metric is derived from the
8179 // [VolumeStats.UsedBytes] field
8180 // of the [PodStats] of the
8181 // Kubelet's stats API.
8182 //
8183 // [VolumeStats.UsedBytes]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#VolumeStats
8184 // [PodStats]: https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats
8185 func (m PodVolumeUsage) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8186 if set.Len() == 0 {
8187 m.Int64UpDownCounter.Add(ctx, incr)
8188 return
8189 }
8190
8191 o := addOptPool.Get().(*[]metric.AddOption)
8192 defer func() {
8193 *o = (*o)[:0]
8194 addOptPool.Put(o)
8195 }()
8196
8197 *o = append(*o, metric.WithAttributeSet(set))
8198 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8199 }
8200
8201 // AttrVolumeType returns an optional attribute for the "k8s.volume.type"
8202 // semantic convention. It represents the type of the K8s volume.
8203 func (PodVolumeUsage) AttrVolumeType(val VolumeTypeAttr) attribute.KeyValue {
8204 return attribute.String("k8s.volume.type", string(val))
8205 }
8206
8207 // ReplicaSetPodAvailable is an instrument used to record metric values
8208 // conforming to the "k8s.replicaset.pod.available" semantic conventions. It
8209 // represents the total number of available replica pods (ready for at least
8210 // minReadySeconds) targeted by this replicaset.
8211 type ReplicaSetPodAvailable struct {
8212 metric.Int64UpDownCounter
8213 }
8214
8215 var newReplicaSetPodAvailableOpts = []metric.Int64UpDownCounterOption{
8216 metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset."),
8217 metric.WithUnit("{pod}"),
8218 }
8219
8220 // NewReplicaSetPodAvailable returns a new ReplicaSetPodAvailable instrument.
8221 func NewReplicaSetPodAvailable(
8222 m metric.Meter,
8223 opt ...metric.Int64UpDownCounterOption,
8224 ) (ReplicaSetPodAvailable, error) {
8225 // Check if the meter is nil.
8226 if m == nil {
8227 return ReplicaSetPodAvailable{noop.Int64UpDownCounter{}}, nil
8228 }
8229
8230 if len(opt) == 0 {
8231 opt = newReplicaSetPodAvailableOpts
8232 } else {
8233 opt = append(opt, newReplicaSetPodAvailableOpts...)
8234 }
8235
8236 i, err := m.Int64UpDownCounter(
8237 "k8s.replicaset.pod.available",
8238 opt...,
8239 )
8240 if err != nil {
8241 return ReplicaSetPodAvailable{noop.Int64UpDownCounter{}}, err
8242 }
8243 return ReplicaSetPodAvailable{i}, nil
8244 }
8245
8246 // Inst returns the underlying metric instrument.
8247 func (m ReplicaSetPodAvailable) Inst() metric.Int64UpDownCounter {
8248 return m.Int64UpDownCounter
8249 }
8250
8251 // Name returns the semantic convention name of the instrument.
8252 func (ReplicaSetPodAvailable) Name() string {
8253 return "k8s.replicaset.pod.available"
8254 }
8255
8256 // Unit returns the semantic convention unit of the instrument
8257 func (ReplicaSetPodAvailable) Unit() string {
8258 return "{pod}"
8259 }
8260
8261 // Description returns the semantic convention description of the instrument
8262 func (ReplicaSetPodAvailable) Description() string {
8263 return "Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset."
8264 }
8265
8266 // Add adds incr to the existing count for attrs.
8267 //
8268 // This metric aligns with the `availableReplicas` field of the
8269 // [K8s ReplicaSetStatus].
8270 //
8271 // [K8s ReplicaSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps
8272 func (m ReplicaSetPodAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8273 if len(attrs) == 0 {
8274 m.Int64UpDownCounter.Add(ctx, incr)
8275 return
8276 }
8277
8278 o := addOptPool.Get().(*[]metric.AddOption)
8279 defer func() {
8280 *o = (*o)[:0]
8281 addOptPool.Put(o)
8282 }()
8283
8284 *o = append(*o, metric.WithAttributes(attrs...))
8285 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8286 }
8287
8288 // AddSet adds incr to the existing count for set.
8289 //
8290 // This metric aligns with the `availableReplicas` field of the
8291 // [K8s ReplicaSetStatus].
8292 //
8293 // [K8s ReplicaSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps
8294 func (m ReplicaSetPodAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8295 if set.Len() == 0 {
8296 m.Int64UpDownCounter.Add(ctx, incr)
8297 return
8298 }
8299
8300 o := addOptPool.Get().(*[]metric.AddOption)
8301 defer func() {
8302 *o = (*o)[:0]
8303 addOptPool.Put(o)
8304 }()
8305
8306 *o = append(*o, metric.WithAttributeSet(set))
8307 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8308 }
8309
8310 // ReplicaSetPodDesired is an instrument used to record metric values conforming
8311 // to the "k8s.replicaset.pod.desired" semantic conventions. It represents the
8312 // number of desired replica pods in this replicaset.
8313 type ReplicaSetPodDesired struct {
8314 metric.Int64UpDownCounter
8315 }
8316
8317 var newReplicaSetPodDesiredOpts = []metric.Int64UpDownCounterOption{
8318 metric.WithDescription("Number of desired replica pods in this replicaset."),
8319 metric.WithUnit("{pod}"),
8320 }
8321
8322 // NewReplicaSetPodDesired returns a new ReplicaSetPodDesired instrument.
8323 func NewReplicaSetPodDesired(
8324 m metric.Meter,
8325 opt ...metric.Int64UpDownCounterOption,
8326 ) (ReplicaSetPodDesired, error) {
8327 // Check if the meter is nil.
8328 if m == nil {
8329 return ReplicaSetPodDesired{noop.Int64UpDownCounter{}}, nil
8330 }
8331
8332 if len(opt) == 0 {
8333 opt = newReplicaSetPodDesiredOpts
8334 } else {
8335 opt = append(opt, newReplicaSetPodDesiredOpts...)
8336 }
8337
8338 i, err := m.Int64UpDownCounter(
8339 "k8s.replicaset.pod.desired",
8340 opt...,
8341 )
8342 if err != nil {
8343 return ReplicaSetPodDesired{noop.Int64UpDownCounter{}}, err
8344 }
8345 return ReplicaSetPodDesired{i}, nil
8346 }
8347
8348 // Inst returns the underlying metric instrument.
8349 func (m ReplicaSetPodDesired) Inst() metric.Int64UpDownCounter {
8350 return m.Int64UpDownCounter
8351 }
8352
8353 // Name returns the semantic convention name of the instrument.
8354 func (ReplicaSetPodDesired) Name() string {
8355 return "k8s.replicaset.pod.desired"
8356 }
8357
8358 // Unit returns the semantic convention unit of the instrument
8359 func (ReplicaSetPodDesired) Unit() string {
8360 return "{pod}"
8361 }
8362
8363 // Description returns the semantic convention description of the instrument
8364 func (ReplicaSetPodDesired) Description() string {
8365 return "Number of desired replica pods in this replicaset."
8366 }
8367
8368 // Add adds incr to the existing count for attrs.
8369 //
8370 // This metric aligns with the `replicas` field of the
8371 // [K8s ReplicaSetSpec].
8372 //
8373 // [K8s ReplicaSetSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps
8374 func (m ReplicaSetPodDesired) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8375 if len(attrs) == 0 {
8376 m.Int64UpDownCounter.Add(ctx, incr)
8377 return
8378 }
8379
8380 o := addOptPool.Get().(*[]metric.AddOption)
8381 defer func() {
8382 *o = (*o)[:0]
8383 addOptPool.Put(o)
8384 }()
8385
8386 *o = append(*o, metric.WithAttributes(attrs...))
8387 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8388 }
8389
8390 // AddSet adds incr to the existing count for set.
8391 //
8392 // This metric aligns with the `replicas` field of the
8393 // [K8s ReplicaSetSpec].
8394 //
8395 // [K8s ReplicaSetSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps
8396 func (m ReplicaSetPodDesired) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8397 if set.Len() == 0 {
8398 m.Int64UpDownCounter.Add(ctx, incr)
8399 return
8400 }
8401
8402 o := addOptPool.Get().(*[]metric.AddOption)
8403 defer func() {
8404 *o = (*o)[:0]
8405 addOptPool.Put(o)
8406 }()
8407
8408 *o = append(*o, metric.WithAttributeSet(set))
8409 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8410 }
8411
8412 // ReplicationControllerPodAvailable is an instrument used to record metric
8413 // values conforming to the "k8s.replicationcontroller.pod.available" semantic
8414 // conventions. It represents the total number of available replica pods (ready
8415 // for at least minReadySeconds) targeted by this replication controller.
8416 type ReplicationControllerPodAvailable struct {
8417 metric.Int64UpDownCounter
8418 }
8419
8420 var newReplicationControllerPodAvailableOpts = []metric.Int64UpDownCounterOption{
8421 metric.WithDescription("Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller."),
8422 metric.WithUnit("{pod}"),
8423 }
8424
8425 // NewReplicationControllerPodAvailable returns a new
8426 // ReplicationControllerPodAvailable instrument.
8427 func NewReplicationControllerPodAvailable(
8428 m metric.Meter,
8429 opt ...metric.Int64UpDownCounterOption,
8430 ) (ReplicationControllerPodAvailable, error) {
8431 // Check if the meter is nil.
8432 if m == nil {
8433 return ReplicationControllerPodAvailable{noop.Int64UpDownCounter{}}, nil
8434 }
8435
8436 if len(opt) == 0 {
8437 opt = newReplicationControllerPodAvailableOpts
8438 } else {
8439 opt = append(opt, newReplicationControllerPodAvailableOpts...)
8440 }
8441
8442 i, err := m.Int64UpDownCounter(
8443 "k8s.replicationcontroller.pod.available",
8444 opt...,
8445 )
8446 if err != nil {
8447 return ReplicationControllerPodAvailable{noop.Int64UpDownCounter{}}, err
8448 }
8449 return ReplicationControllerPodAvailable{i}, nil
8450 }
8451
8452 // Inst returns the underlying metric instrument.
8453 func (m ReplicationControllerPodAvailable) Inst() metric.Int64UpDownCounter {
8454 return m.Int64UpDownCounter
8455 }
8456
8457 // Name returns the semantic convention name of the instrument.
8458 func (ReplicationControllerPodAvailable) Name() string {
8459 return "k8s.replicationcontroller.pod.available"
8460 }
8461
8462 // Unit returns the semantic convention unit of the instrument
8463 func (ReplicationControllerPodAvailable) Unit() string {
8464 return "{pod}"
8465 }
8466
8467 // Description returns the semantic convention description of the instrument
8468 func (ReplicationControllerPodAvailable) Description() string {
8469 return "Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller."
8470 }
8471
8472 // Add adds incr to the existing count for attrs.
8473 //
8474 // This metric aligns with the `availableReplicas` field of the
8475 // [K8s ReplicationControllerStatus]
8476 //
8477 // [K8s ReplicationControllerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core
8478 func (m ReplicationControllerPodAvailable) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8479 if len(attrs) == 0 {
8480 m.Int64UpDownCounter.Add(ctx, incr)
8481 return
8482 }
8483
8484 o := addOptPool.Get().(*[]metric.AddOption)
8485 defer func() {
8486 *o = (*o)[:0]
8487 addOptPool.Put(o)
8488 }()
8489
8490 *o = append(*o, metric.WithAttributes(attrs...))
8491 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8492 }
8493
8494 // AddSet adds incr to the existing count for set.
8495 //
8496 // This metric aligns with the `availableReplicas` field of the
8497 // [K8s ReplicationControllerStatus]
8498 //
8499 // [K8s ReplicationControllerStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core
8500 func (m ReplicationControllerPodAvailable) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8501 if set.Len() == 0 {
8502 m.Int64UpDownCounter.Add(ctx, incr)
8503 return
8504 }
8505
8506 o := addOptPool.Get().(*[]metric.AddOption)
8507 defer func() {
8508 *o = (*o)[:0]
8509 addOptPool.Put(o)
8510 }()
8511
8512 *o = append(*o, metric.WithAttributeSet(set))
8513 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8514 }
8515
8516 // ReplicationControllerPodDesired is an instrument used to record metric values
8517 // conforming to the "k8s.replicationcontroller.pod.desired" semantic
8518 // conventions. It represents the number of desired replica pods in this
8519 // replication controller.
8520 type ReplicationControllerPodDesired struct {
8521 metric.Int64UpDownCounter
8522 }
8523
8524 var newReplicationControllerPodDesiredOpts = []metric.Int64UpDownCounterOption{
8525 metric.WithDescription("Number of desired replica pods in this replication controller."),
8526 metric.WithUnit("{pod}"),
8527 }
8528
8529 // NewReplicationControllerPodDesired returns a new
8530 // ReplicationControllerPodDesired instrument.
8531 func NewReplicationControllerPodDesired(
8532 m metric.Meter,
8533 opt ...metric.Int64UpDownCounterOption,
8534 ) (ReplicationControllerPodDesired, error) {
8535 // Check if the meter is nil.
8536 if m == nil {
8537 return ReplicationControllerPodDesired{noop.Int64UpDownCounter{}}, nil
8538 }
8539
8540 if len(opt) == 0 {
8541 opt = newReplicationControllerPodDesiredOpts
8542 } else {
8543 opt = append(opt, newReplicationControllerPodDesiredOpts...)
8544 }
8545
8546 i, err := m.Int64UpDownCounter(
8547 "k8s.replicationcontroller.pod.desired",
8548 opt...,
8549 )
8550 if err != nil {
8551 return ReplicationControllerPodDesired{noop.Int64UpDownCounter{}}, err
8552 }
8553 return ReplicationControllerPodDesired{i}, nil
8554 }
8555
8556 // Inst returns the underlying metric instrument.
8557 func (m ReplicationControllerPodDesired) Inst() metric.Int64UpDownCounter {
8558 return m.Int64UpDownCounter
8559 }
8560
8561 // Name returns the semantic convention name of the instrument.
8562 func (ReplicationControllerPodDesired) Name() string {
8563 return "k8s.replicationcontroller.pod.desired"
8564 }
8565
8566 // Unit returns the semantic convention unit of the instrument
8567 func (ReplicationControllerPodDesired) Unit() string {
8568 return "{pod}"
8569 }
8570
8571 // Description returns the semantic convention description of the instrument
8572 func (ReplicationControllerPodDesired) Description() string {
8573 return "Number of desired replica pods in this replication controller."
8574 }
8575
8576 // Add adds incr to the existing count for attrs.
8577 //
8578 // This metric aligns with the `replicas` field of the
8579 // [K8s ReplicationControllerSpec]
8580 //
8581 // [K8s ReplicationControllerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core
8582 func (m ReplicationControllerPodDesired) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8583 if len(attrs) == 0 {
8584 m.Int64UpDownCounter.Add(ctx, incr)
8585 return
8586 }
8587
8588 o := addOptPool.Get().(*[]metric.AddOption)
8589 defer func() {
8590 *o = (*o)[:0]
8591 addOptPool.Put(o)
8592 }()
8593
8594 *o = append(*o, metric.WithAttributes(attrs...))
8595 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8596 }
8597
8598 // AddSet adds incr to the existing count for set.
8599 //
8600 // This metric aligns with the `replicas` field of the
8601 // [K8s ReplicationControllerSpec]
8602 //
8603 // [K8s ReplicationControllerSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core
8604 func (m ReplicationControllerPodDesired) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8605 if set.Len() == 0 {
8606 m.Int64UpDownCounter.Add(ctx, incr)
8607 return
8608 }
8609
8610 o := addOptPool.Get().(*[]metric.AddOption)
8611 defer func() {
8612 *o = (*o)[:0]
8613 addOptPool.Put(o)
8614 }()
8615
8616 *o = append(*o, metric.WithAttributeSet(set))
8617 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8618 }
8619
8620 // ResourceQuotaCPULimitHard is an instrument used to record metric values
8621 // conforming to the "k8s.resourcequota.cpu.limit.hard" semantic conventions. It
8622 // represents the CPU limits in a specific namespace.
8623 // The value represents the configured quota limit of the resource in the
8624 // namespace.
8625 type ResourceQuotaCPULimitHard struct {
8626 metric.Int64UpDownCounter
8627 }
8628
8629 var newResourceQuotaCPULimitHardOpts = []metric.Int64UpDownCounterOption{
8630 metric.WithDescription("The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
8631 metric.WithUnit("{cpu}"),
8632 }
8633
8634 // NewResourceQuotaCPULimitHard returns a new ResourceQuotaCPULimitHard
8635 // instrument.
8636 func NewResourceQuotaCPULimitHard(
8637 m metric.Meter,
8638 opt ...metric.Int64UpDownCounterOption,
8639 ) (ResourceQuotaCPULimitHard, error) {
8640 // Check if the meter is nil.
8641 if m == nil {
8642 return ResourceQuotaCPULimitHard{noop.Int64UpDownCounter{}}, nil
8643 }
8644
8645 if len(opt) == 0 {
8646 opt = newResourceQuotaCPULimitHardOpts
8647 } else {
8648 opt = append(opt, newResourceQuotaCPULimitHardOpts...)
8649 }
8650
8651 i, err := m.Int64UpDownCounter(
8652 "k8s.resourcequota.cpu.limit.hard",
8653 opt...,
8654 )
8655 if err != nil {
8656 return ResourceQuotaCPULimitHard{noop.Int64UpDownCounter{}}, err
8657 }
8658 return ResourceQuotaCPULimitHard{i}, nil
8659 }
8660
8661 // Inst returns the underlying metric instrument.
8662 func (m ResourceQuotaCPULimitHard) Inst() metric.Int64UpDownCounter {
8663 return m.Int64UpDownCounter
8664 }
8665
8666 // Name returns the semantic convention name of the instrument.
8667 func (ResourceQuotaCPULimitHard) Name() string {
8668 return "k8s.resourcequota.cpu.limit.hard"
8669 }
8670
8671 // Unit returns the semantic convention unit of the instrument
8672 func (ResourceQuotaCPULimitHard) Unit() string {
8673 return "{cpu}"
8674 }
8675
8676 // Description returns the semantic convention description of the instrument
8677 func (ResourceQuotaCPULimitHard) Description() string {
8678 return "The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
8679 }
8680
8681 // Add adds incr to the existing count for attrs.
8682 //
8683 // This metric is retrieved from the `hard` field of the
8684 // [K8s ResourceQuotaStatus].
8685 //
8686 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8687 func (m ResourceQuotaCPULimitHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8688 if len(attrs) == 0 {
8689 m.Int64UpDownCounter.Add(ctx, incr)
8690 return
8691 }
8692
8693 o := addOptPool.Get().(*[]metric.AddOption)
8694 defer func() {
8695 *o = (*o)[:0]
8696 addOptPool.Put(o)
8697 }()
8698
8699 *o = append(*o, metric.WithAttributes(attrs...))
8700 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8701 }
8702
8703 // AddSet adds incr to the existing count for set.
8704 //
8705 // This metric is retrieved from the `hard` field of the
8706 // [K8s ResourceQuotaStatus].
8707 //
8708 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8709 func (m ResourceQuotaCPULimitHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8710 if set.Len() == 0 {
8711 m.Int64UpDownCounter.Add(ctx, incr)
8712 return
8713 }
8714
8715 o := addOptPool.Get().(*[]metric.AddOption)
8716 defer func() {
8717 *o = (*o)[:0]
8718 addOptPool.Put(o)
8719 }()
8720
8721 *o = append(*o, metric.WithAttributeSet(set))
8722 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8723 }
8724
8725 // ResourceQuotaCPULimitUsed is an instrument used to record metric values
8726 // conforming to the "k8s.resourcequota.cpu.limit.used" semantic conventions. It
8727 // represents the CPU limits in a specific namespace.
8728 // The value represents the current observed total usage of the resource in the
8729 // namespace.
8730 type ResourceQuotaCPULimitUsed struct {
8731 metric.Int64UpDownCounter
8732 }
8733
8734 var newResourceQuotaCPULimitUsedOpts = []metric.Int64UpDownCounterOption{
8735 metric.WithDescription("The CPU limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
8736 metric.WithUnit("{cpu}"),
8737 }
8738
8739 // NewResourceQuotaCPULimitUsed returns a new ResourceQuotaCPULimitUsed
8740 // instrument.
8741 func NewResourceQuotaCPULimitUsed(
8742 m metric.Meter,
8743 opt ...metric.Int64UpDownCounterOption,
8744 ) (ResourceQuotaCPULimitUsed, error) {
8745 // Check if the meter is nil.
8746 if m == nil {
8747 return ResourceQuotaCPULimitUsed{noop.Int64UpDownCounter{}}, nil
8748 }
8749
8750 if len(opt) == 0 {
8751 opt = newResourceQuotaCPULimitUsedOpts
8752 } else {
8753 opt = append(opt, newResourceQuotaCPULimitUsedOpts...)
8754 }
8755
8756 i, err := m.Int64UpDownCounter(
8757 "k8s.resourcequota.cpu.limit.used",
8758 opt...,
8759 )
8760 if err != nil {
8761 return ResourceQuotaCPULimitUsed{noop.Int64UpDownCounter{}}, err
8762 }
8763 return ResourceQuotaCPULimitUsed{i}, nil
8764 }
8765
8766 // Inst returns the underlying metric instrument.
8767 func (m ResourceQuotaCPULimitUsed) Inst() metric.Int64UpDownCounter {
8768 return m.Int64UpDownCounter
8769 }
8770
8771 // Name returns the semantic convention name of the instrument.
8772 func (ResourceQuotaCPULimitUsed) Name() string {
8773 return "k8s.resourcequota.cpu.limit.used"
8774 }
8775
8776 // Unit returns the semantic convention unit of the instrument
8777 func (ResourceQuotaCPULimitUsed) Unit() string {
8778 return "{cpu}"
8779 }
8780
8781 // Description returns the semantic convention description of the instrument
8782 func (ResourceQuotaCPULimitUsed) Description() string {
8783 return "The CPU limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
8784 }
8785
8786 // Add adds incr to the existing count for attrs.
8787 //
8788 // This metric is retrieved from the `used` field of the
8789 // [K8s ResourceQuotaStatus].
8790 //
8791 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8792 func (m ResourceQuotaCPULimitUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8793 if len(attrs) == 0 {
8794 m.Int64UpDownCounter.Add(ctx, incr)
8795 return
8796 }
8797
8798 o := addOptPool.Get().(*[]metric.AddOption)
8799 defer func() {
8800 *o = (*o)[:0]
8801 addOptPool.Put(o)
8802 }()
8803
8804 *o = append(*o, metric.WithAttributes(attrs...))
8805 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8806 }
8807
8808 // AddSet adds incr to the existing count for set.
8809 //
8810 // This metric is retrieved from the `used` field of the
8811 // [K8s ResourceQuotaStatus].
8812 //
8813 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8814 func (m ResourceQuotaCPULimitUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8815 if set.Len() == 0 {
8816 m.Int64UpDownCounter.Add(ctx, incr)
8817 return
8818 }
8819
8820 o := addOptPool.Get().(*[]metric.AddOption)
8821 defer func() {
8822 *o = (*o)[:0]
8823 addOptPool.Put(o)
8824 }()
8825
8826 *o = append(*o, metric.WithAttributeSet(set))
8827 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8828 }
8829
8830 // ResourceQuotaCPURequestHard is an instrument used to record metric values
8831 // conforming to the "k8s.resourcequota.cpu.request.hard" semantic conventions.
8832 // It represents the CPU requests in a specific namespace.
8833 // The value represents the configured quota limit of the resource in the
8834 // namespace.
8835 type ResourceQuotaCPURequestHard struct {
8836 metric.Int64UpDownCounter
8837 }
8838
8839 var newResourceQuotaCPURequestHardOpts = []metric.Int64UpDownCounterOption{
8840 metric.WithDescription("The CPU requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
8841 metric.WithUnit("{cpu}"),
8842 }
8843
8844 // NewResourceQuotaCPURequestHard returns a new ResourceQuotaCPURequestHard
8845 // instrument.
8846 func NewResourceQuotaCPURequestHard(
8847 m metric.Meter,
8848 opt ...metric.Int64UpDownCounterOption,
8849 ) (ResourceQuotaCPURequestHard, error) {
8850 // Check if the meter is nil.
8851 if m == nil {
8852 return ResourceQuotaCPURequestHard{noop.Int64UpDownCounter{}}, nil
8853 }
8854
8855 if len(opt) == 0 {
8856 opt = newResourceQuotaCPURequestHardOpts
8857 } else {
8858 opt = append(opt, newResourceQuotaCPURequestHardOpts...)
8859 }
8860
8861 i, err := m.Int64UpDownCounter(
8862 "k8s.resourcequota.cpu.request.hard",
8863 opt...,
8864 )
8865 if err != nil {
8866 return ResourceQuotaCPURequestHard{noop.Int64UpDownCounter{}}, err
8867 }
8868 return ResourceQuotaCPURequestHard{i}, nil
8869 }
8870
8871 // Inst returns the underlying metric instrument.
8872 func (m ResourceQuotaCPURequestHard) Inst() metric.Int64UpDownCounter {
8873 return m.Int64UpDownCounter
8874 }
8875
8876 // Name returns the semantic convention name of the instrument.
8877 func (ResourceQuotaCPURequestHard) Name() string {
8878 return "k8s.resourcequota.cpu.request.hard"
8879 }
8880
8881 // Unit returns the semantic convention unit of the instrument
8882 func (ResourceQuotaCPURequestHard) Unit() string {
8883 return "{cpu}"
8884 }
8885
8886 // Description returns the semantic convention description of the instrument
8887 func (ResourceQuotaCPURequestHard) Description() string {
8888 return "The CPU requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
8889 }
8890
8891 // Add adds incr to the existing count for attrs.
8892 //
8893 // This metric is retrieved from the `hard` field of the
8894 // [K8s ResourceQuotaStatus].
8895 //
8896 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8897 func (m ResourceQuotaCPURequestHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
8898 if len(attrs) == 0 {
8899 m.Int64UpDownCounter.Add(ctx, incr)
8900 return
8901 }
8902
8903 o := addOptPool.Get().(*[]metric.AddOption)
8904 defer func() {
8905 *o = (*o)[:0]
8906 addOptPool.Put(o)
8907 }()
8908
8909 *o = append(*o, metric.WithAttributes(attrs...))
8910 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8911 }
8912
8913 // AddSet adds incr to the existing count for set.
8914 //
8915 // This metric is retrieved from the `hard` field of the
8916 // [K8s ResourceQuotaStatus].
8917 //
8918 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
8919 func (m ResourceQuotaCPURequestHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
8920 if set.Len() == 0 {
8921 m.Int64UpDownCounter.Add(ctx, incr)
8922 return
8923 }
8924
8925 o := addOptPool.Get().(*[]metric.AddOption)
8926 defer func() {
8927 *o = (*o)[:0]
8928 addOptPool.Put(o)
8929 }()
8930
8931 *o = append(*o, metric.WithAttributeSet(set))
8932 m.Int64UpDownCounter.Add(ctx, incr, *o...)
8933 }
8934
8935 // ResourceQuotaCPURequestUsed is an instrument used to record metric values
8936 // conforming to the "k8s.resourcequota.cpu.request.used" semantic conventions.
8937 // It represents the CPU requests in a specific namespace.
8938 // The value represents the current observed total usage of the resource in the
8939 // namespace.
8940 type ResourceQuotaCPURequestUsed struct {
8941 metric.Int64UpDownCounter
8942 }
8943
8944 var newResourceQuotaCPURequestUsedOpts = []metric.Int64UpDownCounterOption{
8945 metric.WithDescription("The CPU requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
8946 metric.WithUnit("{cpu}"),
8947 }
8948
8949 // NewResourceQuotaCPURequestUsed returns a new ResourceQuotaCPURequestUsed
8950 // instrument.
8951 func NewResourceQuotaCPURequestUsed(
8952 m metric.Meter,
8953 opt ...metric.Int64UpDownCounterOption,
8954 ) (ResourceQuotaCPURequestUsed, error) {
8955 // Check if the meter is nil.
8956 if m == nil {
8957 return ResourceQuotaCPURequestUsed{noop.Int64UpDownCounter{}}, nil
8958 }
8959
8960 if len(opt) == 0 {
8961 opt = newResourceQuotaCPURequestUsedOpts
8962 } else {
8963 opt = append(opt, newResourceQuotaCPURequestUsedOpts...)
8964 }
8965
8966 i, err := m.Int64UpDownCounter(
8967 "k8s.resourcequota.cpu.request.used",
8968 opt...,
8969 )
8970 if err != nil {
8971 return ResourceQuotaCPURequestUsed{noop.Int64UpDownCounter{}}, err
8972 }
8973 return ResourceQuotaCPURequestUsed{i}, nil
8974 }
8975
8976 // Inst returns the underlying metric instrument.
8977 func (m ResourceQuotaCPURequestUsed) Inst() metric.Int64UpDownCounter {
8978 return m.Int64UpDownCounter
8979 }
8980
8981 // Name returns the semantic convention name of the instrument.
8982 func (ResourceQuotaCPURequestUsed) Name() string {
8983 return "k8s.resourcequota.cpu.request.used"
8984 }
8985
8986 // Unit returns the semantic convention unit of the instrument
8987 func (ResourceQuotaCPURequestUsed) Unit() string {
8988 return "{cpu}"
8989 }
8990
8991 // Description returns the semantic convention description of the instrument
8992 func (ResourceQuotaCPURequestUsed) Description() string {
8993 return "The CPU requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
8994 }
8995
8996 // Add adds incr to the existing count for attrs.
8997 //
8998 // This metric is retrieved from the `used` field of the
8999 // [K8s ResourceQuotaStatus].
9000 //
9001 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9002 func (m ResourceQuotaCPURequestUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9003 if len(attrs) == 0 {
9004 m.Int64UpDownCounter.Add(ctx, incr)
9005 return
9006 }
9007
9008 o := addOptPool.Get().(*[]metric.AddOption)
9009 defer func() {
9010 *o = (*o)[:0]
9011 addOptPool.Put(o)
9012 }()
9013
9014 *o = append(*o, metric.WithAttributes(attrs...))
9015 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9016 }
9017
9018 // AddSet adds incr to the existing count for set.
9019 //
9020 // This metric is retrieved from the `used` field of the
9021 // [K8s ResourceQuotaStatus].
9022 //
9023 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9024 func (m ResourceQuotaCPURequestUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9025 if set.Len() == 0 {
9026 m.Int64UpDownCounter.Add(ctx, incr)
9027 return
9028 }
9029
9030 o := addOptPool.Get().(*[]metric.AddOption)
9031 defer func() {
9032 *o = (*o)[:0]
9033 addOptPool.Put(o)
9034 }()
9035
9036 *o = append(*o, metric.WithAttributeSet(set))
9037 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9038 }
9039
9040 // ResourceQuotaEphemeralStorageLimitHard is an instrument used to record metric
9041 // values conforming to the "k8s.resourcequota.ephemeral_storage.limit.hard"
9042 // semantic conventions. It represents the sum of local ephemeral storage limits
9043 // in the namespace.
9044 // The value represents the configured quota limit of the resource in the
9045 // namespace.
9046 type ResourceQuotaEphemeralStorageLimitHard struct {
9047 metric.Int64UpDownCounter
9048 }
9049
9050 var newResourceQuotaEphemeralStorageLimitHardOpts = []metric.Int64UpDownCounterOption{
9051 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."),
9052 metric.WithUnit("By"),
9053 }
9054
9055 // NewResourceQuotaEphemeralStorageLimitHard returns a new
9056 // ResourceQuotaEphemeralStorageLimitHard instrument.
9057 func NewResourceQuotaEphemeralStorageLimitHard(
9058 m metric.Meter,
9059 opt ...metric.Int64UpDownCounterOption,
9060 ) (ResourceQuotaEphemeralStorageLimitHard, error) {
9061 // Check if the meter is nil.
9062 if m == nil {
9063 return ResourceQuotaEphemeralStorageLimitHard{noop.Int64UpDownCounter{}}, nil
9064 }
9065
9066 if len(opt) == 0 {
9067 opt = newResourceQuotaEphemeralStorageLimitHardOpts
9068 } else {
9069 opt = append(opt, newResourceQuotaEphemeralStorageLimitHardOpts...)
9070 }
9071
9072 i, err := m.Int64UpDownCounter(
9073 "k8s.resourcequota.ephemeral_storage.limit.hard",
9074 opt...,
9075 )
9076 if err != nil {
9077 return ResourceQuotaEphemeralStorageLimitHard{noop.Int64UpDownCounter{}}, err
9078 }
9079 return ResourceQuotaEphemeralStorageLimitHard{i}, nil
9080 }
9081
9082 // Inst returns the underlying metric instrument.
9083 func (m ResourceQuotaEphemeralStorageLimitHard) Inst() metric.Int64UpDownCounter {
9084 return m.Int64UpDownCounter
9085 }
9086
9087 // Name returns the semantic convention name of the instrument.
9088 func (ResourceQuotaEphemeralStorageLimitHard) Name() string {
9089 return "k8s.resourcequota.ephemeral_storage.limit.hard"
9090 }
9091
9092 // Unit returns the semantic convention unit of the instrument
9093 func (ResourceQuotaEphemeralStorageLimitHard) Unit() string {
9094 return "By"
9095 }
9096
9097 // Description returns the semantic convention description of the instrument
9098 func (ResourceQuotaEphemeralStorageLimitHard) Description() string {
9099 return "The sum of local ephemeral storage limits in the namespace. The value represents the configured quota limit of the resource in the namespace."
9100 }
9101
9102 // Add adds incr to the existing count for attrs.
9103 //
9104 // This metric is retrieved from the `hard` field of the
9105 // [K8s ResourceQuotaStatus].
9106 //
9107 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9108 func (m ResourceQuotaEphemeralStorageLimitHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9109 if len(attrs) == 0 {
9110 m.Int64UpDownCounter.Add(ctx, incr)
9111 return
9112 }
9113
9114 o := addOptPool.Get().(*[]metric.AddOption)
9115 defer func() {
9116 *o = (*o)[:0]
9117 addOptPool.Put(o)
9118 }()
9119
9120 *o = append(*o, metric.WithAttributes(attrs...))
9121 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9122 }
9123
9124 // AddSet adds incr to the existing count for set.
9125 //
9126 // This metric is retrieved from the `hard` field of the
9127 // [K8s ResourceQuotaStatus].
9128 //
9129 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9130 func (m ResourceQuotaEphemeralStorageLimitHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9131 if set.Len() == 0 {
9132 m.Int64UpDownCounter.Add(ctx, incr)
9133 return
9134 }
9135
9136 o := addOptPool.Get().(*[]metric.AddOption)
9137 defer func() {
9138 *o = (*o)[:0]
9139 addOptPool.Put(o)
9140 }()
9141
9142 *o = append(*o, metric.WithAttributeSet(set))
9143 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9144 }
9145
9146 // ResourceQuotaEphemeralStorageLimitUsed is an instrument used to record metric
9147 // values conforming to the "k8s.resourcequota.ephemeral_storage.limit.used"
9148 // semantic conventions. It represents the sum of local ephemeral storage limits
9149 // in the namespace.
9150 // The value represents the current observed total usage of the resource in the
9151 // namespace.
9152 type ResourceQuotaEphemeralStorageLimitUsed struct {
9153 metric.Int64UpDownCounter
9154 }
9155
9156 var newResourceQuotaEphemeralStorageLimitUsedOpts = []metric.Int64UpDownCounterOption{
9157 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."),
9158 metric.WithUnit("By"),
9159 }
9160
9161 // NewResourceQuotaEphemeralStorageLimitUsed returns a new
9162 // ResourceQuotaEphemeralStorageLimitUsed instrument.
9163 func NewResourceQuotaEphemeralStorageLimitUsed(
9164 m metric.Meter,
9165 opt ...metric.Int64UpDownCounterOption,
9166 ) (ResourceQuotaEphemeralStorageLimitUsed, error) {
9167 // Check if the meter is nil.
9168 if m == nil {
9169 return ResourceQuotaEphemeralStorageLimitUsed{noop.Int64UpDownCounter{}}, nil
9170 }
9171
9172 if len(opt) == 0 {
9173 opt = newResourceQuotaEphemeralStorageLimitUsedOpts
9174 } else {
9175 opt = append(opt, newResourceQuotaEphemeralStorageLimitUsedOpts...)
9176 }
9177
9178 i, err := m.Int64UpDownCounter(
9179 "k8s.resourcequota.ephemeral_storage.limit.used",
9180 opt...,
9181 )
9182 if err != nil {
9183 return ResourceQuotaEphemeralStorageLimitUsed{noop.Int64UpDownCounter{}}, err
9184 }
9185 return ResourceQuotaEphemeralStorageLimitUsed{i}, nil
9186 }
9187
9188 // Inst returns the underlying metric instrument.
9189 func (m ResourceQuotaEphemeralStorageLimitUsed) Inst() metric.Int64UpDownCounter {
9190 return m.Int64UpDownCounter
9191 }
9192
9193 // Name returns the semantic convention name of the instrument.
9194 func (ResourceQuotaEphemeralStorageLimitUsed) Name() string {
9195 return "k8s.resourcequota.ephemeral_storage.limit.used"
9196 }
9197
9198 // Unit returns the semantic convention unit of the instrument
9199 func (ResourceQuotaEphemeralStorageLimitUsed) Unit() string {
9200 return "By"
9201 }
9202
9203 // Description returns the semantic convention description of the instrument
9204 func (ResourceQuotaEphemeralStorageLimitUsed) Description() string {
9205 return "The sum of local ephemeral storage limits in the namespace. The value represents the current observed total usage of the resource in the namespace."
9206 }
9207
9208 // Add adds incr to the existing count for attrs.
9209 //
9210 // This metric is retrieved from the `used` field of the
9211 // [K8s ResourceQuotaStatus].
9212 //
9213 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9214 func (m ResourceQuotaEphemeralStorageLimitUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9215 if len(attrs) == 0 {
9216 m.Int64UpDownCounter.Add(ctx, incr)
9217 return
9218 }
9219
9220 o := addOptPool.Get().(*[]metric.AddOption)
9221 defer func() {
9222 *o = (*o)[:0]
9223 addOptPool.Put(o)
9224 }()
9225
9226 *o = append(*o, metric.WithAttributes(attrs...))
9227 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9228 }
9229
9230 // AddSet adds incr to the existing count for set.
9231 //
9232 // This metric is retrieved from the `used` field of the
9233 // [K8s ResourceQuotaStatus].
9234 //
9235 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9236 func (m ResourceQuotaEphemeralStorageLimitUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9237 if set.Len() == 0 {
9238 m.Int64UpDownCounter.Add(ctx, incr)
9239 return
9240 }
9241
9242 o := addOptPool.Get().(*[]metric.AddOption)
9243 defer func() {
9244 *o = (*o)[:0]
9245 addOptPool.Put(o)
9246 }()
9247
9248 *o = append(*o, metric.WithAttributeSet(set))
9249 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9250 }
9251
9252 // ResourceQuotaEphemeralStorageRequestHard is an instrument used to record
9253 // metric values conforming to the
9254 // "k8s.resourcequota.ephemeral_storage.request.hard" semantic conventions. It
9255 // represents the sum of local ephemeral storage requests in the namespace.
9256 // The value represents the configured quota limit of the resource in the
9257 // namespace.
9258 type ResourceQuotaEphemeralStorageRequestHard struct {
9259 metric.Int64UpDownCounter
9260 }
9261
9262 var newResourceQuotaEphemeralStorageRequestHardOpts = []metric.Int64UpDownCounterOption{
9263 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."),
9264 metric.WithUnit("By"),
9265 }
9266
9267 // NewResourceQuotaEphemeralStorageRequestHard returns a new
9268 // ResourceQuotaEphemeralStorageRequestHard instrument.
9269 func NewResourceQuotaEphemeralStorageRequestHard(
9270 m metric.Meter,
9271 opt ...metric.Int64UpDownCounterOption,
9272 ) (ResourceQuotaEphemeralStorageRequestHard, error) {
9273 // Check if the meter is nil.
9274 if m == nil {
9275 return ResourceQuotaEphemeralStorageRequestHard{noop.Int64UpDownCounter{}}, nil
9276 }
9277
9278 if len(opt) == 0 {
9279 opt = newResourceQuotaEphemeralStorageRequestHardOpts
9280 } else {
9281 opt = append(opt, newResourceQuotaEphemeralStorageRequestHardOpts...)
9282 }
9283
9284 i, err := m.Int64UpDownCounter(
9285 "k8s.resourcequota.ephemeral_storage.request.hard",
9286 opt...,
9287 )
9288 if err != nil {
9289 return ResourceQuotaEphemeralStorageRequestHard{noop.Int64UpDownCounter{}}, err
9290 }
9291 return ResourceQuotaEphemeralStorageRequestHard{i}, nil
9292 }
9293
9294 // Inst returns the underlying metric instrument.
9295 func (m ResourceQuotaEphemeralStorageRequestHard) Inst() metric.Int64UpDownCounter {
9296 return m.Int64UpDownCounter
9297 }
9298
9299 // Name returns the semantic convention name of the instrument.
9300 func (ResourceQuotaEphemeralStorageRequestHard) Name() string {
9301 return "k8s.resourcequota.ephemeral_storage.request.hard"
9302 }
9303
9304 // Unit returns the semantic convention unit of the instrument
9305 func (ResourceQuotaEphemeralStorageRequestHard) Unit() string {
9306 return "By"
9307 }
9308
9309 // Description returns the semantic convention description of the instrument
9310 func (ResourceQuotaEphemeralStorageRequestHard) Description() string {
9311 return "The sum of local ephemeral storage requests in the namespace. The value represents the configured quota limit of the resource in the namespace."
9312 }
9313
9314 // Add adds incr to the existing count for attrs.
9315 //
9316 // This metric is retrieved from the `hard` field of the
9317 // [K8s ResourceQuotaStatus].
9318 //
9319 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9320 func (m ResourceQuotaEphemeralStorageRequestHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9321 if len(attrs) == 0 {
9322 m.Int64UpDownCounter.Add(ctx, incr)
9323 return
9324 }
9325
9326 o := addOptPool.Get().(*[]metric.AddOption)
9327 defer func() {
9328 *o = (*o)[:0]
9329 addOptPool.Put(o)
9330 }()
9331
9332 *o = append(*o, metric.WithAttributes(attrs...))
9333 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9334 }
9335
9336 // AddSet adds incr to the existing count for set.
9337 //
9338 // This metric is retrieved from the `hard` field of the
9339 // [K8s ResourceQuotaStatus].
9340 //
9341 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9342 func (m ResourceQuotaEphemeralStorageRequestHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9343 if set.Len() == 0 {
9344 m.Int64UpDownCounter.Add(ctx, incr)
9345 return
9346 }
9347
9348 o := addOptPool.Get().(*[]metric.AddOption)
9349 defer func() {
9350 *o = (*o)[:0]
9351 addOptPool.Put(o)
9352 }()
9353
9354 *o = append(*o, metric.WithAttributeSet(set))
9355 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9356 }
9357
9358 // ResourceQuotaEphemeralStorageRequestUsed is an instrument used to record
9359 // metric values conforming to the
9360 // "k8s.resourcequota.ephemeral_storage.request.used" semantic conventions. It
9361 // represents the sum of local ephemeral storage requests in the namespace.
9362 // The value represents the current observed total usage of the resource in the
9363 // namespace.
9364 type ResourceQuotaEphemeralStorageRequestUsed struct {
9365 metric.Int64UpDownCounter
9366 }
9367
9368 var newResourceQuotaEphemeralStorageRequestUsedOpts = []metric.Int64UpDownCounterOption{
9369 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."),
9370 metric.WithUnit("By"),
9371 }
9372
9373 // NewResourceQuotaEphemeralStorageRequestUsed returns a new
9374 // ResourceQuotaEphemeralStorageRequestUsed instrument.
9375 func NewResourceQuotaEphemeralStorageRequestUsed(
9376 m metric.Meter,
9377 opt ...metric.Int64UpDownCounterOption,
9378 ) (ResourceQuotaEphemeralStorageRequestUsed, error) {
9379 // Check if the meter is nil.
9380 if m == nil {
9381 return ResourceQuotaEphemeralStorageRequestUsed{noop.Int64UpDownCounter{}}, nil
9382 }
9383
9384 if len(opt) == 0 {
9385 opt = newResourceQuotaEphemeralStorageRequestUsedOpts
9386 } else {
9387 opt = append(opt, newResourceQuotaEphemeralStorageRequestUsedOpts...)
9388 }
9389
9390 i, err := m.Int64UpDownCounter(
9391 "k8s.resourcequota.ephemeral_storage.request.used",
9392 opt...,
9393 )
9394 if err != nil {
9395 return ResourceQuotaEphemeralStorageRequestUsed{noop.Int64UpDownCounter{}}, err
9396 }
9397 return ResourceQuotaEphemeralStorageRequestUsed{i}, nil
9398 }
9399
9400 // Inst returns the underlying metric instrument.
9401 func (m ResourceQuotaEphemeralStorageRequestUsed) Inst() metric.Int64UpDownCounter {
9402 return m.Int64UpDownCounter
9403 }
9404
9405 // Name returns the semantic convention name of the instrument.
9406 func (ResourceQuotaEphemeralStorageRequestUsed) Name() string {
9407 return "k8s.resourcequota.ephemeral_storage.request.used"
9408 }
9409
9410 // Unit returns the semantic convention unit of the instrument
9411 func (ResourceQuotaEphemeralStorageRequestUsed) Unit() string {
9412 return "By"
9413 }
9414
9415 // Description returns the semantic convention description of the instrument
9416 func (ResourceQuotaEphemeralStorageRequestUsed) Description() string {
9417 return "The sum of local ephemeral storage requests in the namespace. The value represents the current observed total usage of the resource in the namespace."
9418 }
9419
9420 // Add adds incr to the existing count for attrs.
9421 //
9422 // This metric is retrieved from the `used` field of the
9423 // [K8s ResourceQuotaStatus].
9424 //
9425 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9426 func (m ResourceQuotaEphemeralStorageRequestUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9427 if len(attrs) == 0 {
9428 m.Int64UpDownCounter.Add(ctx, incr)
9429 return
9430 }
9431
9432 o := addOptPool.Get().(*[]metric.AddOption)
9433 defer func() {
9434 *o = (*o)[:0]
9435 addOptPool.Put(o)
9436 }()
9437
9438 *o = append(*o, metric.WithAttributes(attrs...))
9439 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9440 }
9441
9442 // AddSet adds incr to the existing count for set.
9443 //
9444 // This metric is retrieved from the `used` field of the
9445 // [K8s ResourceQuotaStatus].
9446 //
9447 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9448 func (m ResourceQuotaEphemeralStorageRequestUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9449 if set.Len() == 0 {
9450 m.Int64UpDownCounter.Add(ctx, incr)
9451 return
9452 }
9453
9454 o := addOptPool.Get().(*[]metric.AddOption)
9455 defer func() {
9456 *o = (*o)[:0]
9457 addOptPool.Put(o)
9458 }()
9459
9460 *o = append(*o, metric.WithAttributeSet(set))
9461 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9462 }
9463
9464 // ResourceQuotaHugepageCountRequestHard is an instrument used to record metric
9465 // values conforming to the "k8s.resourcequota.hugepage_count.request.hard"
9466 // semantic conventions. It represents the huge page requests in a specific
9467 // namespace.
9468 // The value represents the configured quota limit of the resource in the
9469 // namespace.
9470 type ResourceQuotaHugepageCountRequestHard struct {
9471 metric.Int64UpDownCounter
9472 }
9473
9474 var newResourceQuotaHugepageCountRequestHardOpts = []metric.Int64UpDownCounterOption{
9475 metric.WithDescription("The huge page requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
9476 metric.WithUnit("{hugepage}"),
9477 }
9478
9479 // NewResourceQuotaHugepageCountRequestHard returns a new
9480 // ResourceQuotaHugepageCountRequestHard instrument.
9481 func NewResourceQuotaHugepageCountRequestHard(
9482 m metric.Meter,
9483 opt ...metric.Int64UpDownCounterOption,
9484 ) (ResourceQuotaHugepageCountRequestHard, error) {
9485 // Check if the meter is nil.
9486 if m == nil {
9487 return ResourceQuotaHugepageCountRequestHard{noop.Int64UpDownCounter{}}, nil
9488 }
9489
9490 if len(opt) == 0 {
9491 opt = newResourceQuotaHugepageCountRequestHardOpts
9492 } else {
9493 opt = append(opt, newResourceQuotaHugepageCountRequestHardOpts...)
9494 }
9495
9496 i, err := m.Int64UpDownCounter(
9497 "k8s.resourcequota.hugepage_count.request.hard",
9498 opt...,
9499 )
9500 if err != nil {
9501 return ResourceQuotaHugepageCountRequestHard{noop.Int64UpDownCounter{}}, err
9502 }
9503 return ResourceQuotaHugepageCountRequestHard{i}, nil
9504 }
9505
9506 // Inst returns the underlying metric instrument.
9507 func (m ResourceQuotaHugepageCountRequestHard) Inst() metric.Int64UpDownCounter {
9508 return m.Int64UpDownCounter
9509 }
9510
9511 // Name returns the semantic convention name of the instrument.
9512 func (ResourceQuotaHugepageCountRequestHard) Name() string {
9513 return "k8s.resourcequota.hugepage_count.request.hard"
9514 }
9515
9516 // Unit returns the semantic convention unit of the instrument
9517 func (ResourceQuotaHugepageCountRequestHard) Unit() string {
9518 return "{hugepage}"
9519 }
9520
9521 // Description returns the semantic convention description of the instrument
9522 func (ResourceQuotaHugepageCountRequestHard) Description() string {
9523 return "The huge page requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
9524 }
9525
9526 // Add adds incr to the existing count for attrs.
9527 //
9528 // The hugepageSize is the the size (identifier) of the K8s huge page.
9529 //
9530 // This metric is retrieved from the `hard` field of the
9531 // [K8s ResourceQuotaStatus].
9532 //
9533 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9534 func (m ResourceQuotaHugepageCountRequestHard) Add(
9535 ctx context.Context,
9536 incr int64,
9537 hugepageSize string,
9538 attrs ...attribute.KeyValue,
9539 ) {
9540 if len(attrs) == 0 {
9541 m.Int64UpDownCounter.Add(ctx, incr)
9542 return
9543 }
9544
9545 o := addOptPool.Get().(*[]metric.AddOption)
9546 defer func() {
9547 *o = (*o)[:0]
9548 addOptPool.Put(o)
9549 }()
9550
9551 *o = append(
9552 *o,
9553 metric.WithAttributes(
9554 append(
9555 attrs,
9556 attribute.String("k8s.hugepage.size", hugepageSize),
9557 )...,
9558 ),
9559 )
9560
9561 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9562 }
9563
9564 // AddSet adds incr to the existing count for set.
9565 //
9566 // This metric is retrieved from the `hard` field of the
9567 // [K8s ResourceQuotaStatus].
9568 //
9569 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9570 func (m ResourceQuotaHugepageCountRequestHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9571 if set.Len() == 0 {
9572 m.Int64UpDownCounter.Add(ctx, incr)
9573 return
9574 }
9575
9576 o := addOptPool.Get().(*[]metric.AddOption)
9577 defer func() {
9578 *o = (*o)[:0]
9579 addOptPool.Put(o)
9580 }()
9581
9582 *o = append(*o, metric.WithAttributeSet(set))
9583 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9584 }
9585
9586 // ResourceQuotaHugepageCountRequestUsed is an instrument used to record metric
9587 // values conforming to the "k8s.resourcequota.hugepage_count.request.used"
9588 // semantic conventions. It represents the huge page requests in a specific
9589 // namespace.
9590 // The value represents the current observed total usage of the resource in the
9591 // namespace.
9592 type ResourceQuotaHugepageCountRequestUsed struct {
9593 metric.Int64UpDownCounter
9594 }
9595
9596 var newResourceQuotaHugepageCountRequestUsedOpts = []metric.Int64UpDownCounterOption{
9597 metric.WithDescription("The huge page requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
9598 metric.WithUnit("{hugepage}"),
9599 }
9600
9601 // NewResourceQuotaHugepageCountRequestUsed returns a new
9602 // ResourceQuotaHugepageCountRequestUsed instrument.
9603 func NewResourceQuotaHugepageCountRequestUsed(
9604 m metric.Meter,
9605 opt ...metric.Int64UpDownCounterOption,
9606 ) (ResourceQuotaHugepageCountRequestUsed, error) {
9607 // Check if the meter is nil.
9608 if m == nil {
9609 return ResourceQuotaHugepageCountRequestUsed{noop.Int64UpDownCounter{}}, nil
9610 }
9611
9612 if len(opt) == 0 {
9613 opt = newResourceQuotaHugepageCountRequestUsedOpts
9614 } else {
9615 opt = append(opt, newResourceQuotaHugepageCountRequestUsedOpts...)
9616 }
9617
9618 i, err := m.Int64UpDownCounter(
9619 "k8s.resourcequota.hugepage_count.request.used",
9620 opt...,
9621 )
9622 if err != nil {
9623 return ResourceQuotaHugepageCountRequestUsed{noop.Int64UpDownCounter{}}, err
9624 }
9625 return ResourceQuotaHugepageCountRequestUsed{i}, nil
9626 }
9627
9628 // Inst returns the underlying metric instrument.
9629 func (m ResourceQuotaHugepageCountRequestUsed) Inst() metric.Int64UpDownCounter {
9630 return m.Int64UpDownCounter
9631 }
9632
9633 // Name returns the semantic convention name of the instrument.
9634 func (ResourceQuotaHugepageCountRequestUsed) Name() string {
9635 return "k8s.resourcequota.hugepage_count.request.used"
9636 }
9637
9638 // Unit returns the semantic convention unit of the instrument
9639 func (ResourceQuotaHugepageCountRequestUsed) Unit() string {
9640 return "{hugepage}"
9641 }
9642
9643 // Description returns the semantic convention description of the instrument
9644 func (ResourceQuotaHugepageCountRequestUsed) Description() string {
9645 return "The huge page requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
9646 }
9647
9648 // Add adds incr to the existing count for attrs.
9649 //
9650 // The hugepageSize is the the size (identifier) of the K8s huge page.
9651 //
9652 // This metric is retrieved from the `used` field of the
9653 // [K8s ResourceQuotaStatus].
9654 //
9655 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9656 func (m ResourceQuotaHugepageCountRequestUsed) Add(
9657 ctx context.Context,
9658 incr int64,
9659 hugepageSize string,
9660 attrs ...attribute.KeyValue,
9661 ) {
9662 if len(attrs) == 0 {
9663 m.Int64UpDownCounter.Add(ctx, incr)
9664 return
9665 }
9666
9667 o := addOptPool.Get().(*[]metric.AddOption)
9668 defer func() {
9669 *o = (*o)[:0]
9670 addOptPool.Put(o)
9671 }()
9672
9673 *o = append(
9674 *o,
9675 metric.WithAttributes(
9676 append(
9677 attrs,
9678 attribute.String("k8s.hugepage.size", hugepageSize),
9679 )...,
9680 ),
9681 )
9682
9683 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9684 }
9685
9686 // AddSet adds incr to the existing count for set.
9687 //
9688 // This metric is retrieved from the `used` field of the
9689 // [K8s ResourceQuotaStatus].
9690 //
9691 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9692 func (m ResourceQuotaHugepageCountRequestUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9693 if set.Len() == 0 {
9694 m.Int64UpDownCounter.Add(ctx, incr)
9695 return
9696 }
9697
9698 o := addOptPool.Get().(*[]metric.AddOption)
9699 defer func() {
9700 *o = (*o)[:0]
9701 addOptPool.Put(o)
9702 }()
9703
9704 *o = append(*o, metric.WithAttributeSet(set))
9705 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9706 }
9707
9708 // ResourceQuotaMemoryLimitHard is an instrument used to record metric values
9709 // conforming to the "k8s.resourcequota.memory.limit.hard" semantic conventions.
9710 // It represents the memory limits in a specific namespace.
9711 // The value represents the configured quota limit of the resource in the
9712 // namespace.
9713 type ResourceQuotaMemoryLimitHard struct {
9714 metric.Int64UpDownCounter
9715 }
9716
9717 var newResourceQuotaMemoryLimitHardOpts = []metric.Int64UpDownCounterOption{
9718 metric.WithDescription("The memory limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
9719 metric.WithUnit("By"),
9720 }
9721
9722 // NewResourceQuotaMemoryLimitHard returns a new ResourceQuotaMemoryLimitHard
9723 // instrument.
9724 func NewResourceQuotaMemoryLimitHard(
9725 m metric.Meter,
9726 opt ...metric.Int64UpDownCounterOption,
9727 ) (ResourceQuotaMemoryLimitHard, error) {
9728 // Check if the meter is nil.
9729 if m == nil {
9730 return ResourceQuotaMemoryLimitHard{noop.Int64UpDownCounter{}}, nil
9731 }
9732
9733 if len(opt) == 0 {
9734 opt = newResourceQuotaMemoryLimitHardOpts
9735 } else {
9736 opt = append(opt, newResourceQuotaMemoryLimitHardOpts...)
9737 }
9738
9739 i, err := m.Int64UpDownCounter(
9740 "k8s.resourcequota.memory.limit.hard",
9741 opt...,
9742 )
9743 if err != nil {
9744 return ResourceQuotaMemoryLimitHard{noop.Int64UpDownCounter{}}, err
9745 }
9746 return ResourceQuotaMemoryLimitHard{i}, nil
9747 }
9748
9749 // Inst returns the underlying metric instrument.
9750 func (m ResourceQuotaMemoryLimitHard) Inst() metric.Int64UpDownCounter {
9751 return m.Int64UpDownCounter
9752 }
9753
9754 // Name returns the semantic convention name of the instrument.
9755 func (ResourceQuotaMemoryLimitHard) Name() string {
9756 return "k8s.resourcequota.memory.limit.hard"
9757 }
9758
9759 // Unit returns the semantic convention unit of the instrument
9760 func (ResourceQuotaMemoryLimitHard) Unit() string {
9761 return "By"
9762 }
9763
9764 // Description returns the semantic convention description of the instrument
9765 func (ResourceQuotaMemoryLimitHard) Description() string {
9766 return "The memory limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
9767 }
9768
9769 // Add adds incr to the existing count for attrs.
9770 //
9771 // This metric is retrieved from the `hard` field of the
9772 // [K8s ResourceQuotaStatus].
9773 //
9774 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9775 func (m ResourceQuotaMemoryLimitHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9776 if len(attrs) == 0 {
9777 m.Int64UpDownCounter.Add(ctx, incr)
9778 return
9779 }
9780
9781 o := addOptPool.Get().(*[]metric.AddOption)
9782 defer func() {
9783 *o = (*o)[:0]
9784 addOptPool.Put(o)
9785 }()
9786
9787 *o = append(*o, metric.WithAttributes(attrs...))
9788 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9789 }
9790
9791 // AddSet adds incr to the existing count for set.
9792 //
9793 // This metric is retrieved from the `hard` field of the
9794 // [K8s ResourceQuotaStatus].
9795 //
9796 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9797 func (m ResourceQuotaMemoryLimitHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9798 if set.Len() == 0 {
9799 m.Int64UpDownCounter.Add(ctx, incr)
9800 return
9801 }
9802
9803 o := addOptPool.Get().(*[]metric.AddOption)
9804 defer func() {
9805 *o = (*o)[:0]
9806 addOptPool.Put(o)
9807 }()
9808
9809 *o = append(*o, metric.WithAttributeSet(set))
9810 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9811 }
9812
9813 // ResourceQuotaMemoryLimitUsed is an instrument used to record metric values
9814 // conforming to the "k8s.resourcequota.memory.limit.used" semantic conventions.
9815 // It represents the memory limits in a specific namespace.
9816 // The value represents the current observed total usage of the resource in the
9817 // namespace.
9818 type ResourceQuotaMemoryLimitUsed struct {
9819 metric.Int64UpDownCounter
9820 }
9821
9822 var newResourceQuotaMemoryLimitUsedOpts = []metric.Int64UpDownCounterOption{
9823 metric.WithDescription("The memory limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
9824 metric.WithUnit("By"),
9825 }
9826
9827 // NewResourceQuotaMemoryLimitUsed returns a new ResourceQuotaMemoryLimitUsed
9828 // instrument.
9829 func NewResourceQuotaMemoryLimitUsed(
9830 m metric.Meter,
9831 opt ...metric.Int64UpDownCounterOption,
9832 ) (ResourceQuotaMemoryLimitUsed, error) {
9833 // Check if the meter is nil.
9834 if m == nil {
9835 return ResourceQuotaMemoryLimitUsed{noop.Int64UpDownCounter{}}, nil
9836 }
9837
9838 if len(opt) == 0 {
9839 opt = newResourceQuotaMemoryLimitUsedOpts
9840 } else {
9841 opt = append(opt, newResourceQuotaMemoryLimitUsedOpts...)
9842 }
9843
9844 i, err := m.Int64UpDownCounter(
9845 "k8s.resourcequota.memory.limit.used",
9846 opt...,
9847 )
9848 if err != nil {
9849 return ResourceQuotaMemoryLimitUsed{noop.Int64UpDownCounter{}}, err
9850 }
9851 return ResourceQuotaMemoryLimitUsed{i}, nil
9852 }
9853
9854 // Inst returns the underlying metric instrument.
9855 func (m ResourceQuotaMemoryLimitUsed) Inst() metric.Int64UpDownCounter {
9856 return m.Int64UpDownCounter
9857 }
9858
9859 // Name returns the semantic convention name of the instrument.
9860 func (ResourceQuotaMemoryLimitUsed) Name() string {
9861 return "k8s.resourcequota.memory.limit.used"
9862 }
9863
9864 // Unit returns the semantic convention unit of the instrument
9865 func (ResourceQuotaMemoryLimitUsed) Unit() string {
9866 return "By"
9867 }
9868
9869 // Description returns the semantic convention description of the instrument
9870 func (ResourceQuotaMemoryLimitUsed) Description() string {
9871 return "The memory limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
9872 }
9873
9874 // Add adds incr to the existing count for attrs.
9875 //
9876 // This metric is retrieved from the `used` field of the
9877 // [K8s ResourceQuotaStatus].
9878 //
9879 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9880 func (m ResourceQuotaMemoryLimitUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9881 if len(attrs) == 0 {
9882 m.Int64UpDownCounter.Add(ctx, incr)
9883 return
9884 }
9885
9886 o := addOptPool.Get().(*[]metric.AddOption)
9887 defer func() {
9888 *o = (*o)[:0]
9889 addOptPool.Put(o)
9890 }()
9891
9892 *o = append(*o, metric.WithAttributes(attrs...))
9893 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9894 }
9895
9896 // AddSet adds incr to the existing count for set.
9897 //
9898 // This metric is retrieved from the `used` field of the
9899 // [K8s ResourceQuotaStatus].
9900 //
9901 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9902 func (m ResourceQuotaMemoryLimitUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
9903 if set.Len() == 0 {
9904 m.Int64UpDownCounter.Add(ctx, incr)
9905 return
9906 }
9907
9908 o := addOptPool.Get().(*[]metric.AddOption)
9909 defer func() {
9910 *o = (*o)[:0]
9911 addOptPool.Put(o)
9912 }()
9913
9914 *o = append(*o, metric.WithAttributeSet(set))
9915 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9916 }
9917
9918 // ResourceQuotaMemoryRequestHard is an instrument used to record metric values
9919 // conforming to the "k8s.resourcequota.memory.request.hard" semantic
9920 // conventions. It represents the memory requests in a specific namespace.
9921 // The value represents the configured quota limit of the resource in the
9922 // namespace.
9923 type ResourceQuotaMemoryRequestHard struct {
9924 metric.Int64UpDownCounter
9925 }
9926
9927 var newResourceQuotaMemoryRequestHardOpts = []metric.Int64UpDownCounterOption{
9928 metric.WithDescription("The memory requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
9929 metric.WithUnit("By"),
9930 }
9931
9932 // NewResourceQuotaMemoryRequestHard returns a new ResourceQuotaMemoryRequestHard
9933 // instrument.
9934 func NewResourceQuotaMemoryRequestHard(
9935 m metric.Meter,
9936 opt ...metric.Int64UpDownCounterOption,
9937 ) (ResourceQuotaMemoryRequestHard, error) {
9938 // Check if the meter is nil.
9939 if m == nil {
9940 return ResourceQuotaMemoryRequestHard{noop.Int64UpDownCounter{}}, nil
9941 }
9942
9943 if len(opt) == 0 {
9944 opt = newResourceQuotaMemoryRequestHardOpts
9945 } else {
9946 opt = append(opt, newResourceQuotaMemoryRequestHardOpts...)
9947 }
9948
9949 i, err := m.Int64UpDownCounter(
9950 "k8s.resourcequota.memory.request.hard",
9951 opt...,
9952 )
9953 if err != nil {
9954 return ResourceQuotaMemoryRequestHard{noop.Int64UpDownCounter{}}, err
9955 }
9956 return ResourceQuotaMemoryRequestHard{i}, nil
9957 }
9958
9959 // Inst returns the underlying metric instrument.
9960 func (m ResourceQuotaMemoryRequestHard) Inst() metric.Int64UpDownCounter {
9961 return m.Int64UpDownCounter
9962 }
9963
9964 // Name returns the semantic convention name of the instrument.
9965 func (ResourceQuotaMemoryRequestHard) Name() string {
9966 return "k8s.resourcequota.memory.request.hard"
9967 }
9968
9969 // Unit returns the semantic convention unit of the instrument
9970 func (ResourceQuotaMemoryRequestHard) Unit() string {
9971 return "By"
9972 }
9973
9974 // Description returns the semantic convention description of the instrument
9975 func (ResourceQuotaMemoryRequestHard) Description() string {
9976 return "The memory requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
9977 }
9978
9979 // Add adds incr to the existing count for attrs.
9980 //
9981 // This metric is retrieved from the `hard` field of the
9982 // [K8s ResourceQuotaStatus].
9983 //
9984 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
9985 func (m ResourceQuotaMemoryRequestHard) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
9986 if len(attrs) == 0 {
9987 m.Int64UpDownCounter.Add(ctx, incr)
9988 return
9989 }
9990
9991 o := addOptPool.Get().(*[]metric.AddOption)
9992 defer func() {
9993 *o = (*o)[:0]
9994 addOptPool.Put(o)
9995 }()
9996
9997 *o = append(*o, metric.WithAttributes(attrs...))
9998 m.Int64UpDownCounter.Add(ctx, incr, *o...)
9999 }
10000
10001 // AddSet adds incr to the existing count for set.
10002 //
10003 // This metric is retrieved from the `hard` field of the
10004 // [K8s ResourceQuotaStatus].
10005 //
10006 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10007 func (m ResourceQuotaMemoryRequestHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10008 if set.Len() == 0 {
10009 m.Int64UpDownCounter.Add(ctx, incr)
10010 return
10011 }
10012
10013 o := addOptPool.Get().(*[]metric.AddOption)
10014 defer func() {
10015 *o = (*o)[:0]
10016 addOptPool.Put(o)
10017 }()
10018
10019 *o = append(*o, metric.WithAttributeSet(set))
10020 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10021 }
10022
10023 // ResourceQuotaMemoryRequestUsed is an instrument used to record metric values
10024 // conforming to the "k8s.resourcequota.memory.request.used" semantic
10025 // conventions. It represents the memory requests in a specific namespace.
10026 // The value represents the current observed total usage of the resource in the
10027 // namespace.
10028 type ResourceQuotaMemoryRequestUsed struct {
10029 metric.Int64UpDownCounter
10030 }
10031
10032 var newResourceQuotaMemoryRequestUsedOpts = []metric.Int64UpDownCounterOption{
10033 metric.WithDescription("The memory requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
10034 metric.WithUnit("By"),
10035 }
10036
10037 // NewResourceQuotaMemoryRequestUsed returns a new ResourceQuotaMemoryRequestUsed
10038 // instrument.
10039 func NewResourceQuotaMemoryRequestUsed(
10040 m metric.Meter,
10041 opt ...metric.Int64UpDownCounterOption,
10042 ) (ResourceQuotaMemoryRequestUsed, error) {
10043 // Check if the meter is nil.
10044 if m == nil {
10045 return ResourceQuotaMemoryRequestUsed{noop.Int64UpDownCounter{}}, nil
10046 }
10047
10048 if len(opt) == 0 {
10049 opt = newResourceQuotaMemoryRequestUsedOpts
10050 } else {
10051 opt = append(opt, newResourceQuotaMemoryRequestUsedOpts...)
10052 }
10053
10054 i, err := m.Int64UpDownCounter(
10055 "k8s.resourcequota.memory.request.used",
10056 opt...,
10057 )
10058 if err != nil {
10059 return ResourceQuotaMemoryRequestUsed{noop.Int64UpDownCounter{}}, err
10060 }
10061 return ResourceQuotaMemoryRequestUsed{i}, nil
10062 }
10063
10064 // Inst returns the underlying metric instrument.
10065 func (m ResourceQuotaMemoryRequestUsed) Inst() metric.Int64UpDownCounter {
10066 return m.Int64UpDownCounter
10067 }
10068
10069 // Name returns the semantic convention name of the instrument.
10070 func (ResourceQuotaMemoryRequestUsed) Name() string {
10071 return "k8s.resourcequota.memory.request.used"
10072 }
10073
10074 // Unit returns the semantic convention unit of the instrument
10075 func (ResourceQuotaMemoryRequestUsed) Unit() string {
10076 return "By"
10077 }
10078
10079 // Description returns the semantic convention description of the instrument
10080 func (ResourceQuotaMemoryRequestUsed) Description() string {
10081 return "The memory requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
10082 }
10083
10084 // Add adds incr to the existing count for attrs.
10085 //
10086 // This metric is retrieved from the `used` field of the
10087 // [K8s ResourceQuotaStatus].
10088 //
10089 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10090 func (m ResourceQuotaMemoryRequestUsed) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
10091 if len(attrs) == 0 {
10092 m.Int64UpDownCounter.Add(ctx, incr)
10093 return
10094 }
10095
10096 o := addOptPool.Get().(*[]metric.AddOption)
10097 defer func() {
10098 *o = (*o)[:0]
10099 addOptPool.Put(o)
10100 }()
10101
10102 *o = append(*o, metric.WithAttributes(attrs...))
10103 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10104 }
10105
10106 // AddSet adds incr to the existing count for set.
10107 //
10108 // This metric is retrieved from the `used` field of the
10109 // [K8s ResourceQuotaStatus].
10110 //
10111 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10112 func (m ResourceQuotaMemoryRequestUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10113 if set.Len() == 0 {
10114 m.Int64UpDownCounter.Add(ctx, incr)
10115 return
10116 }
10117
10118 o := addOptPool.Get().(*[]metric.AddOption)
10119 defer func() {
10120 *o = (*o)[:0]
10121 addOptPool.Put(o)
10122 }()
10123
10124 *o = append(*o, metric.WithAttributeSet(set))
10125 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10126 }
10127
10128 // ResourceQuotaObjectCountHard is an instrument used to record metric values
10129 // conforming to the "k8s.resourcequota.object_count.hard" semantic conventions.
10130 // It represents the object count limits in a specific namespace.
10131 // The value represents the configured quota limit of the resource in the
10132 // namespace.
10133 type ResourceQuotaObjectCountHard struct {
10134 metric.Int64UpDownCounter
10135 }
10136
10137 var newResourceQuotaObjectCountHardOpts = []metric.Int64UpDownCounterOption{
10138 metric.WithDescription("The object count limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
10139 metric.WithUnit("{object}"),
10140 }
10141
10142 // NewResourceQuotaObjectCountHard returns a new ResourceQuotaObjectCountHard
10143 // instrument.
10144 func NewResourceQuotaObjectCountHard(
10145 m metric.Meter,
10146 opt ...metric.Int64UpDownCounterOption,
10147 ) (ResourceQuotaObjectCountHard, error) {
10148 // Check if the meter is nil.
10149 if m == nil {
10150 return ResourceQuotaObjectCountHard{noop.Int64UpDownCounter{}}, nil
10151 }
10152
10153 if len(opt) == 0 {
10154 opt = newResourceQuotaObjectCountHardOpts
10155 } else {
10156 opt = append(opt, newResourceQuotaObjectCountHardOpts...)
10157 }
10158
10159 i, err := m.Int64UpDownCounter(
10160 "k8s.resourcequota.object_count.hard",
10161 opt...,
10162 )
10163 if err != nil {
10164 return ResourceQuotaObjectCountHard{noop.Int64UpDownCounter{}}, err
10165 }
10166 return ResourceQuotaObjectCountHard{i}, nil
10167 }
10168
10169 // Inst returns the underlying metric instrument.
10170 func (m ResourceQuotaObjectCountHard) Inst() metric.Int64UpDownCounter {
10171 return m.Int64UpDownCounter
10172 }
10173
10174 // Name returns the semantic convention name of the instrument.
10175 func (ResourceQuotaObjectCountHard) Name() string {
10176 return "k8s.resourcequota.object_count.hard"
10177 }
10178
10179 // Unit returns the semantic convention unit of the instrument
10180 func (ResourceQuotaObjectCountHard) Unit() string {
10181 return "{object}"
10182 }
10183
10184 // Description returns the semantic convention description of the instrument
10185 func (ResourceQuotaObjectCountHard) Description() string {
10186 return "The object count limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
10187 }
10188
10189 // Add adds incr to the existing count for attrs.
10190 //
10191 // The resourcequotaResourceName is the the name of the K8s resource a resource
10192 // quota defines.
10193 //
10194 // This metric is retrieved from the `hard` field of the
10195 // [K8s ResourceQuotaStatus].
10196 //
10197 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10198 func (m ResourceQuotaObjectCountHard) Add(
10199 ctx context.Context,
10200 incr int64,
10201 resourcequotaResourceName string,
10202 attrs ...attribute.KeyValue,
10203 ) {
10204 if len(attrs) == 0 {
10205 m.Int64UpDownCounter.Add(ctx, incr)
10206 return
10207 }
10208
10209 o := addOptPool.Get().(*[]metric.AddOption)
10210 defer func() {
10211 *o = (*o)[:0]
10212 addOptPool.Put(o)
10213 }()
10214
10215 *o = append(
10216 *o,
10217 metric.WithAttributes(
10218 append(
10219 attrs,
10220 attribute.String("k8s.resourcequota.resource_name", resourcequotaResourceName),
10221 )...,
10222 ),
10223 )
10224
10225 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10226 }
10227
10228 // AddSet adds incr to the existing count for set.
10229 //
10230 // This metric is retrieved from the `hard` field of the
10231 // [K8s ResourceQuotaStatus].
10232 //
10233 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10234 func (m ResourceQuotaObjectCountHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10235 if set.Len() == 0 {
10236 m.Int64UpDownCounter.Add(ctx, incr)
10237 return
10238 }
10239
10240 o := addOptPool.Get().(*[]metric.AddOption)
10241 defer func() {
10242 *o = (*o)[:0]
10243 addOptPool.Put(o)
10244 }()
10245
10246 *o = append(*o, metric.WithAttributeSet(set))
10247 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10248 }
10249
10250 // ResourceQuotaObjectCountUsed is an instrument used to record metric values
10251 // conforming to the "k8s.resourcequota.object_count.used" semantic conventions.
10252 // It represents the object count limits in a specific namespace.
10253 // The value represents the current observed total usage of the resource in the
10254 // namespace.
10255 type ResourceQuotaObjectCountUsed struct {
10256 metric.Int64UpDownCounter
10257 }
10258
10259 var newResourceQuotaObjectCountUsedOpts = []metric.Int64UpDownCounterOption{
10260 metric.WithDescription("The object count limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
10261 metric.WithUnit("{object}"),
10262 }
10263
10264 // NewResourceQuotaObjectCountUsed returns a new ResourceQuotaObjectCountUsed
10265 // instrument.
10266 func NewResourceQuotaObjectCountUsed(
10267 m metric.Meter,
10268 opt ...metric.Int64UpDownCounterOption,
10269 ) (ResourceQuotaObjectCountUsed, error) {
10270 // Check if the meter is nil.
10271 if m == nil {
10272 return ResourceQuotaObjectCountUsed{noop.Int64UpDownCounter{}}, nil
10273 }
10274
10275 if len(opt) == 0 {
10276 opt = newResourceQuotaObjectCountUsedOpts
10277 } else {
10278 opt = append(opt, newResourceQuotaObjectCountUsedOpts...)
10279 }
10280
10281 i, err := m.Int64UpDownCounter(
10282 "k8s.resourcequota.object_count.used",
10283 opt...,
10284 )
10285 if err != nil {
10286 return ResourceQuotaObjectCountUsed{noop.Int64UpDownCounter{}}, err
10287 }
10288 return ResourceQuotaObjectCountUsed{i}, nil
10289 }
10290
10291 // Inst returns the underlying metric instrument.
10292 func (m ResourceQuotaObjectCountUsed) Inst() metric.Int64UpDownCounter {
10293 return m.Int64UpDownCounter
10294 }
10295
10296 // Name returns the semantic convention name of the instrument.
10297 func (ResourceQuotaObjectCountUsed) Name() string {
10298 return "k8s.resourcequota.object_count.used"
10299 }
10300
10301 // Unit returns the semantic convention unit of the instrument
10302 func (ResourceQuotaObjectCountUsed) Unit() string {
10303 return "{object}"
10304 }
10305
10306 // Description returns the semantic convention description of the instrument
10307 func (ResourceQuotaObjectCountUsed) Description() string {
10308 return "The object count limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
10309 }
10310
10311 // Add adds incr to the existing count for attrs.
10312 //
10313 // The resourcequotaResourceName is the the name of the K8s resource a resource
10314 // quota defines.
10315 //
10316 // This metric is retrieved from the `used` field of the
10317 // [K8s ResourceQuotaStatus].
10318 //
10319 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10320 func (m ResourceQuotaObjectCountUsed) Add(
10321 ctx context.Context,
10322 incr int64,
10323 resourcequotaResourceName string,
10324 attrs ...attribute.KeyValue,
10325 ) {
10326 if len(attrs) == 0 {
10327 m.Int64UpDownCounter.Add(ctx, incr)
10328 return
10329 }
10330
10331 o := addOptPool.Get().(*[]metric.AddOption)
10332 defer func() {
10333 *o = (*o)[:0]
10334 addOptPool.Put(o)
10335 }()
10336
10337 *o = append(
10338 *o,
10339 metric.WithAttributes(
10340 append(
10341 attrs,
10342 attribute.String("k8s.resourcequota.resource_name", resourcequotaResourceName),
10343 )...,
10344 ),
10345 )
10346
10347 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10348 }
10349
10350 // AddSet adds incr to the existing count for set.
10351 //
10352 // This metric is retrieved from the `used` field of the
10353 // [K8s ResourceQuotaStatus].
10354 //
10355 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10356 func (m ResourceQuotaObjectCountUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10357 if set.Len() == 0 {
10358 m.Int64UpDownCounter.Add(ctx, incr)
10359 return
10360 }
10361
10362 o := addOptPool.Get().(*[]metric.AddOption)
10363 defer func() {
10364 *o = (*o)[:0]
10365 addOptPool.Put(o)
10366 }()
10367
10368 *o = append(*o, metric.WithAttributeSet(set))
10369 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10370 }
10371
10372 // ResourceQuotaPersistentvolumeclaimCountHard is an instrument used to record
10373 // metric values conforming to the
10374 // "k8s.resourcequota.persistentvolumeclaim_count.hard" semantic conventions. It
10375 // represents the total number of PersistentVolumeClaims that can exist in the
10376 // namespace.
10377 // The value represents the configured quota limit of the resource in the
10378 // namespace.
10379 type ResourceQuotaPersistentvolumeclaimCountHard struct {
10380 metric.Int64UpDownCounter
10381 }
10382
10383 var newResourceQuotaPersistentvolumeclaimCountHardOpts = []metric.Int64UpDownCounterOption{
10384 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."),
10385 metric.WithUnit("{persistentvolumeclaim}"),
10386 }
10387
10388 // NewResourceQuotaPersistentvolumeclaimCountHard returns a new
10389 // ResourceQuotaPersistentvolumeclaimCountHard instrument.
10390 func NewResourceQuotaPersistentvolumeclaimCountHard(
10391 m metric.Meter,
10392 opt ...metric.Int64UpDownCounterOption,
10393 ) (ResourceQuotaPersistentvolumeclaimCountHard, error) {
10394 // Check if the meter is nil.
10395 if m == nil {
10396 return ResourceQuotaPersistentvolumeclaimCountHard{noop.Int64UpDownCounter{}}, nil
10397 }
10398
10399 if len(opt) == 0 {
10400 opt = newResourceQuotaPersistentvolumeclaimCountHardOpts
10401 } else {
10402 opt = append(opt, newResourceQuotaPersistentvolumeclaimCountHardOpts...)
10403 }
10404
10405 i, err := m.Int64UpDownCounter(
10406 "k8s.resourcequota.persistentvolumeclaim_count.hard",
10407 opt...,
10408 )
10409 if err != nil {
10410 return ResourceQuotaPersistentvolumeclaimCountHard{noop.Int64UpDownCounter{}}, err
10411 }
10412 return ResourceQuotaPersistentvolumeclaimCountHard{i}, nil
10413 }
10414
10415 // Inst returns the underlying metric instrument.
10416 func (m ResourceQuotaPersistentvolumeclaimCountHard) Inst() metric.Int64UpDownCounter {
10417 return m.Int64UpDownCounter
10418 }
10419
10420 // Name returns the semantic convention name of the instrument.
10421 func (ResourceQuotaPersistentvolumeclaimCountHard) Name() string {
10422 return "k8s.resourcequota.persistentvolumeclaim_count.hard"
10423 }
10424
10425 // Unit returns the semantic convention unit of the instrument
10426 func (ResourceQuotaPersistentvolumeclaimCountHard) Unit() string {
10427 return "{persistentvolumeclaim}"
10428 }
10429
10430 // Description returns the semantic convention description of the instrument
10431 func (ResourceQuotaPersistentvolumeclaimCountHard) Description() string {
10432 return "The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the configured quota limit of the resource in the namespace."
10433 }
10434
10435 // Add adds incr to the existing count for attrs.
10436 //
10437 // All additional attrs passed are included in the recorded value.
10438 //
10439 // This metric is retrieved from the `hard` field of the
10440 // [K8s ResourceQuotaStatus].
10441 //
10442 // The `k8s.storageclass.name` should be required when a resource quota is
10443 // defined for a specific
10444 // storage class.
10445 //
10446 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10447 func (m ResourceQuotaPersistentvolumeclaimCountHard) Add(
10448 ctx context.Context,
10449 incr int64,
10450 attrs ...attribute.KeyValue,
10451 ) {
10452 if len(attrs) == 0 {
10453 m.Int64UpDownCounter.Add(ctx, incr)
10454 return
10455 }
10456
10457 o := addOptPool.Get().(*[]metric.AddOption)
10458 defer func() {
10459 *o = (*o)[:0]
10460 addOptPool.Put(o)
10461 }()
10462
10463 *o = append(
10464 *o,
10465 metric.WithAttributes(
10466 attrs...,
10467 ),
10468 )
10469
10470 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10471 }
10472
10473 // AddSet adds incr to the existing count for set.
10474 //
10475 // This metric is retrieved from the `hard` field of the
10476 // [K8s ResourceQuotaStatus].
10477 //
10478 // The `k8s.storageclass.name` should be required when a resource quota is
10479 // defined for a specific
10480 // storage class.
10481 //
10482 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10483 func (m ResourceQuotaPersistentvolumeclaimCountHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10484 if set.Len() == 0 {
10485 m.Int64UpDownCounter.Add(ctx, incr)
10486 return
10487 }
10488
10489 o := addOptPool.Get().(*[]metric.AddOption)
10490 defer func() {
10491 *o = (*o)[:0]
10492 addOptPool.Put(o)
10493 }()
10494
10495 *o = append(*o, metric.WithAttributeSet(set))
10496 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10497 }
10498
10499 // AttrStorageclassName returns an optional attribute for the
10500 // "k8s.storageclass.name" semantic convention. It represents the name of K8s
10501 // [StorageClass] object.
10502 //
10503 // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io
10504 func (ResourceQuotaPersistentvolumeclaimCountHard) AttrStorageclassName(val string) attribute.KeyValue {
10505 return attribute.String("k8s.storageclass.name", val)
10506 }
10507
10508 // ResourceQuotaPersistentvolumeclaimCountUsed is an instrument used to record
10509 // metric values conforming to the
10510 // "k8s.resourcequota.persistentvolumeclaim_count.used" semantic conventions. It
10511 // represents the total number of PersistentVolumeClaims that can exist in the
10512 // namespace.
10513 // The value represents the current observed total usage of the resource in the
10514 // namespace.
10515 type ResourceQuotaPersistentvolumeclaimCountUsed struct {
10516 metric.Int64UpDownCounter
10517 }
10518
10519 var newResourceQuotaPersistentvolumeclaimCountUsedOpts = []metric.Int64UpDownCounterOption{
10520 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."),
10521 metric.WithUnit("{persistentvolumeclaim}"),
10522 }
10523
10524 // NewResourceQuotaPersistentvolumeclaimCountUsed returns a new
10525 // ResourceQuotaPersistentvolumeclaimCountUsed instrument.
10526 func NewResourceQuotaPersistentvolumeclaimCountUsed(
10527 m metric.Meter,
10528 opt ...metric.Int64UpDownCounterOption,
10529 ) (ResourceQuotaPersistentvolumeclaimCountUsed, error) {
10530 // Check if the meter is nil.
10531 if m == nil {
10532 return ResourceQuotaPersistentvolumeclaimCountUsed{noop.Int64UpDownCounter{}}, nil
10533 }
10534
10535 if len(opt) == 0 {
10536 opt = newResourceQuotaPersistentvolumeclaimCountUsedOpts
10537 } else {
10538 opt = append(opt, newResourceQuotaPersistentvolumeclaimCountUsedOpts...)
10539 }
10540
10541 i, err := m.Int64UpDownCounter(
10542 "k8s.resourcequota.persistentvolumeclaim_count.used",
10543 opt...,
10544 )
10545 if err != nil {
10546 return ResourceQuotaPersistentvolumeclaimCountUsed{noop.Int64UpDownCounter{}}, err
10547 }
10548 return ResourceQuotaPersistentvolumeclaimCountUsed{i}, nil
10549 }
10550
10551 // Inst returns the underlying metric instrument.
10552 func (m ResourceQuotaPersistentvolumeclaimCountUsed) Inst() metric.Int64UpDownCounter {
10553 return m.Int64UpDownCounter
10554 }
10555
10556 // Name returns the semantic convention name of the instrument.
10557 func (ResourceQuotaPersistentvolumeclaimCountUsed) Name() string {
10558 return "k8s.resourcequota.persistentvolumeclaim_count.used"
10559 }
10560
10561 // Unit returns the semantic convention unit of the instrument
10562 func (ResourceQuotaPersistentvolumeclaimCountUsed) Unit() string {
10563 return "{persistentvolumeclaim}"
10564 }
10565
10566 // Description returns the semantic convention description of the instrument
10567 func (ResourceQuotaPersistentvolumeclaimCountUsed) Description() string {
10568 return "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."
10569 }
10570
10571 // Add adds incr to the existing count for attrs.
10572 //
10573 // All additional attrs passed are included in the recorded value.
10574 //
10575 // This metric is retrieved from the `used` field of the
10576 // [K8s ResourceQuotaStatus].
10577 //
10578 // The `k8s.storageclass.name` should be required when a resource quota is
10579 // defined for a specific
10580 // storage class.
10581 //
10582 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10583 func (m ResourceQuotaPersistentvolumeclaimCountUsed) Add(
10584 ctx context.Context,
10585 incr int64,
10586 attrs ...attribute.KeyValue,
10587 ) {
10588 if len(attrs) == 0 {
10589 m.Int64UpDownCounter.Add(ctx, incr)
10590 return
10591 }
10592
10593 o := addOptPool.Get().(*[]metric.AddOption)
10594 defer func() {
10595 *o = (*o)[:0]
10596 addOptPool.Put(o)
10597 }()
10598
10599 *o = append(
10600 *o,
10601 metric.WithAttributes(
10602 attrs...,
10603 ),
10604 )
10605
10606 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10607 }
10608
10609 // AddSet adds incr to the existing count for set.
10610 //
10611 // This metric is retrieved from the `used` field of the
10612 // [K8s ResourceQuotaStatus].
10613 //
10614 // The `k8s.storageclass.name` should be required when a resource quota is
10615 // defined for a specific
10616 // storage class.
10617 //
10618 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10619 func (m ResourceQuotaPersistentvolumeclaimCountUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10620 if set.Len() == 0 {
10621 m.Int64UpDownCounter.Add(ctx, incr)
10622 return
10623 }
10624
10625 o := addOptPool.Get().(*[]metric.AddOption)
10626 defer func() {
10627 *o = (*o)[:0]
10628 addOptPool.Put(o)
10629 }()
10630
10631 *o = append(*o, metric.WithAttributeSet(set))
10632 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10633 }
10634
10635 // AttrStorageclassName returns an optional attribute for the
10636 // "k8s.storageclass.name" semantic convention. It represents the name of K8s
10637 // [StorageClass] object.
10638 //
10639 // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io
10640 func (ResourceQuotaPersistentvolumeclaimCountUsed) AttrStorageclassName(val string) attribute.KeyValue {
10641 return attribute.String("k8s.storageclass.name", val)
10642 }
10643
10644 // ResourceQuotaStorageRequestHard is an instrument used to record metric values
10645 // conforming to the "k8s.resourcequota.storage.request.hard" semantic
10646 // conventions. It represents the storage requests in a specific namespace.
10647 // The value represents the configured quota limit of the resource in the
10648 // namespace.
10649 type ResourceQuotaStorageRequestHard struct {
10650 metric.Int64UpDownCounter
10651 }
10652
10653 var newResourceQuotaStorageRequestHardOpts = []metric.Int64UpDownCounterOption{
10654 metric.WithDescription("The storage requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."),
10655 metric.WithUnit("By"),
10656 }
10657
10658 // NewResourceQuotaStorageRequestHard returns a new
10659 // ResourceQuotaStorageRequestHard instrument.
10660 func NewResourceQuotaStorageRequestHard(
10661 m metric.Meter,
10662 opt ...metric.Int64UpDownCounterOption,
10663 ) (ResourceQuotaStorageRequestHard, error) {
10664 // Check if the meter is nil.
10665 if m == nil {
10666 return ResourceQuotaStorageRequestHard{noop.Int64UpDownCounter{}}, nil
10667 }
10668
10669 if len(opt) == 0 {
10670 opt = newResourceQuotaStorageRequestHardOpts
10671 } else {
10672 opt = append(opt, newResourceQuotaStorageRequestHardOpts...)
10673 }
10674
10675 i, err := m.Int64UpDownCounter(
10676 "k8s.resourcequota.storage.request.hard",
10677 opt...,
10678 )
10679 if err != nil {
10680 return ResourceQuotaStorageRequestHard{noop.Int64UpDownCounter{}}, err
10681 }
10682 return ResourceQuotaStorageRequestHard{i}, nil
10683 }
10684
10685 // Inst returns the underlying metric instrument.
10686 func (m ResourceQuotaStorageRequestHard) Inst() metric.Int64UpDownCounter {
10687 return m.Int64UpDownCounter
10688 }
10689
10690 // Name returns the semantic convention name of the instrument.
10691 func (ResourceQuotaStorageRequestHard) Name() string {
10692 return "k8s.resourcequota.storage.request.hard"
10693 }
10694
10695 // Unit returns the semantic convention unit of the instrument
10696 func (ResourceQuotaStorageRequestHard) Unit() string {
10697 return "By"
10698 }
10699
10700 // Description returns the semantic convention description of the instrument
10701 func (ResourceQuotaStorageRequestHard) Description() string {
10702 return "The storage requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace."
10703 }
10704
10705 // Add adds incr to the existing count for attrs.
10706 //
10707 // All additional attrs passed are included in the recorded value.
10708 //
10709 // This metric is retrieved from the `hard` field of the
10710 // [K8s ResourceQuotaStatus].
10711 //
10712 // The `k8s.storageclass.name` should be required when a resource quota is
10713 // defined for a specific
10714 // storage class.
10715 //
10716 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10717 func (m ResourceQuotaStorageRequestHard) Add(
10718 ctx context.Context,
10719 incr int64,
10720 attrs ...attribute.KeyValue,
10721 ) {
10722 if len(attrs) == 0 {
10723 m.Int64UpDownCounter.Add(ctx, incr)
10724 return
10725 }
10726
10727 o := addOptPool.Get().(*[]metric.AddOption)
10728 defer func() {
10729 *o = (*o)[:0]
10730 addOptPool.Put(o)
10731 }()
10732
10733 *o = append(
10734 *o,
10735 metric.WithAttributes(
10736 attrs...,
10737 ),
10738 )
10739
10740 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10741 }
10742
10743 // AddSet adds incr to the existing count for set.
10744 //
10745 // This metric is retrieved from the `hard` field of the
10746 // [K8s ResourceQuotaStatus].
10747 //
10748 // The `k8s.storageclass.name` should be required when a resource quota is
10749 // defined for a specific
10750 // storage class.
10751 //
10752 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10753 func (m ResourceQuotaStorageRequestHard) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10754 if set.Len() == 0 {
10755 m.Int64UpDownCounter.Add(ctx, incr)
10756 return
10757 }
10758
10759 o := addOptPool.Get().(*[]metric.AddOption)
10760 defer func() {
10761 *o = (*o)[:0]
10762 addOptPool.Put(o)
10763 }()
10764
10765 *o = append(*o, metric.WithAttributeSet(set))
10766 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10767 }
10768
10769 // AttrStorageclassName returns an optional attribute for the
10770 // "k8s.storageclass.name" semantic convention. It represents the name of K8s
10771 // [StorageClass] object.
10772 //
10773 // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io
10774 func (ResourceQuotaStorageRequestHard) AttrStorageclassName(val string) attribute.KeyValue {
10775 return attribute.String("k8s.storageclass.name", val)
10776 }
10777
10778 // ResourceQuotaStorageRequestUsed is an instrument used to record metric values
10779 // conforming to the "k8s.resourcequota.storage.request.used" semantic
10780 // conventions. It represents the storage requests in a specific namespace.
10781 // The value represents the current observed total usage of the resource in the
10782 // namespace.
10783 type ResourceQuotaStorageRequestUsed struct {
10784 metric.Int64UpDownCounter
10785 }
10786
10787 var newResourceQuotaStorageRequestUsedOpts = []metric.Int64UpDownCounterOption{
10788 metric.WithDescription("The storage requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."),
10789 metric.WithUnit("By"),
10790 }
10791
10792 // NewResourceQuotaStorageRequestUsed returns a new
10793 // ResourceQuotaStorageRequestUsed instrument.
10794 func NewResourceQuotaStorageRequestUsed(
10795 m metric.Meter,
10796 opt ...metric.Int64UpDownCounterOption,
10797 ) (ResourceQuotaStorageRequestUsed, error) {
10798 // Check if the meter is nil.
10799 if m == nil {
10800 return ResourceQuotaStorageRequestUsed{noop.Int64UpDownCounter{}}, nil
10801 }
10802
10803 if len(opt) == 0 {
10804 opt = newResourceQuotaStorageRequestUsedOpts
10805 } else {
10806 opt = append(opt, newResourceQuotaStorageRequestUsedOpts...)
10807 }
10808
10809 i, err := m.Int64UpDownCounter(
10810 "k8s.resourcequota.storage.request.used",
10811 opt...,
10812 )
10813 if err != nil {
10814 return ResourceQuotaStorageRequestUsed{noop.Int64UpDownCounter{}}, err
10815 }
10816 return ResourceQuotaStorageRequestUsed{i}, nil
10817 }
10818
10819 // Inst returns the underlying metric instrument.
10820 func (m ResourceQuotaStorageRequestUsed) Inst() metric.Int64UpDownCounter {
10821 return m.Int64UpDownCounter
10822 }
10823
10824 // Name returns the semantic convention name of the instrument.
10825 func (ResourceQuotaStorageRequestUsed) Name() string {
10826 return "k8s.resourcequota.storage.request.used"
10827 }
10828
10829 // Unit returns the semantic convention unit of the instrument
10830 func (ResourceQuotaStorageRequestUsed) Unit() string {
10831 return "By"
10832 }
10833
10834 // Description returns the semantic convention description of the instrument
10835 func (ResourceQuotaStorageRequestUsed) Description() string {
10836 return "The storage requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace."
10837 }
10838
10839 // Add adds incr to the existing count for attrs.
10840 //
10841 // All additional attrs passed are included in the recorded value.
10842 //
10843 // This metric is retrieved from the `used` field of the
10844 // [K8s ResourceQuotaStatus].
10845 //
10846 // The `k8s.storageclass.name` should be required when a resource quota is
10847 // defined for a specific
10848 // storage class.
10849 //
10850 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10851 func (m ResourceQuotaStorageRequestUsed) Add(
10852 ctx context.Context,
10853 incr int64,
10854 attrs ...attribute.KeyValue,
10855 ) {
10856 if len(attrs) == 0 {
10857 m.Int64UpDownCounter.Add(ctx, incr)
10858 return
10859 }
10860
10861 o := addOptPool.Get().(*[]metric.AddOption)
10862 defer func() {
10863 *o = (*o)[:0]
10864 addOptPool.Put(o)
10865 }()
10866
10867 *o = append(
10868 *o,
10869 metric.WithAttributes(
10870 attrs...,
10871 ),
10872 )
10873
10874 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10875 }
10876
10877 // AddSet adds incr to the existing count for set.
10878 //
10879 // This metric is retrieved from the `used` field of the
10880 // [K8s ResourceQuotaStatus].
10881 //
10882 // The `k8s.storageclass.name` should be required when a resource quota is
10883 // defined for a specific
10884 // storage class.
10885 //
10886 // [K8s ResourceQuotaStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core
10887 func (m ResourceQuotaStorageRequestUsed) AddSet(ctx context.Context, incr int64, set attribute.Set) {
10888 if set.Len() == 0 {
10889 m.Int64UpDownCounter.Add(ctx, incr)
10890 return
10891 }
10892
10893 o := addOptPool.Get().(*[]metric.AddOption)
10894 defer func() {
10895 *o = (*o)[:0]
10896 addOptPool.Put(o)
10897 }()
10898
10899 *o = append(*o, metric.WithAttributeSet(set))
10900 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10901 }
10902
10903 // AttrStorageclassName returns an optional attribute for the
10904 // "k8s.storageclass.name" semantic convention. It represents the name of K8s
10905 // [StorageClass] object.
10906 //
10907 // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io
10908 func (ResourceQuotaStorageRequestUsed) AttrStorageclassName(val string) attribute.KeyValue {
10909 return attribute.String("k8s.storageclass.name", val)
10910 }
10911
10912 // StatefulSetPodCurrent is an instrument used to record metric values conforming
10913 // to the "k8s.statefulset.pod.current" semantic conventions. It represents the
10914 // number of replica pods created by the statefulset controller from the
10915 // statefulset version indicated by currentRevision.
10916 type StatefulSetPodCurrent struct {
10917 metric.Int64UpDownCounter
10918 }
10919
10920 var newStatefulSetPodCurrentOpts = []metric.Int64UpDownCounterOption{
10921 metric.WithDescription("The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision."),
10922 metric.WithUnit("{pod}"),
10923 }
10924
10925 // NewStatefulSetPodCurrent returns a new StatefulSetPodCurrent instrument.
10926 func NewStatefulSetPodCurrent(
10927 m metric.Meter,
10928 opt ...metric.Int64UpDownCounterOption,
10929 ) (StatefulSetPodCurrent, error) {
10930 // Check if the meter is nil.
10931 if m == nil {
10932 return StatefulSetPodCurrent{noop.Int64UpDownCounter{}}, nil
10933 }
10934
10935 if len(opt) == 0 {
10936 opt = newStatefulSetPodCurrentOpts
10937 } else {
10938 opt = append(opt, newStatefulSetPodCurrentOpts...)
10939 }
10940
10941 i, err := m.Int64UpDownCounter(
10942 "k8s.statefulset.pod.current",
10943 opt...,
10944 )
10945 if err != nil {
10946 return StatefulSetPodCurrent{noop.Int64UpDownCounter{}}, err
10947 }
10948 return StatefulSetPodCurrent{i}, nil
10949 }
10950
10951 // Inst returns the underlying metric instrument.
10952 func (m StatefulSetPodCurrent) Inst() metric.Int64UpDownCounter {
10953 return m.Int64UpDownCounter
10954 }
10955
10956 // Name returns the semantic convention name of the instrument.
10957 func (StatefulSetPodCurrent) Name() string {
10958 return "k8s.statefulset.pod.current"
10959 }
10960
10961 // Unit returns the semantic convention unit of the instrument
10962 func (StatefulSetPodCurrent) Unit() string {
10963 return "{pod}"
10964 }
10965
10966 // Description returns the semantic convention description of the instrument
10967 func (StatefulSetPodCurrent) Description() string {
10968 return "The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision."
10969 }
10970
10971 // Add adds incr to the existing count for attrs.
10972 //
10973 // This metric aligns with the `currentReplicas` field of the
10974 // [K8s StatefulSetStatus].
10975 //
10976 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
10977 func (m StatefulSetPodCurrent) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
10978 if len(attrs) == 0 {
10979 m.Int64UpDownCounter.Add(ctx, incr)
10980 return
10981 }
10982
10983 o := addOptPool.Get().(*[]metric.AddOption)
10984 defer func() {
10985 *o = (*o)[:0]
10986 addOptPool.Put(o)
10987 }()
10988
10989 *o = append(*o, metric.WithAttributes(attrs...))
10990 m.Int64UpDownCounter.Add(ctx, incr, *o...)
10991 }
10992
10993 // AddSet adds incr to the existing count for set.
10994 //
10995 // This metric aligns with the `currentReplicas` field of the
10996 // [K8s StatefulSetStatus].
10997 //
10998 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
10999 func (m StatefulSetPodCurrent) AddSet(ctx context.Context, incr int64, set attribute.Set) {
11000 if set.Len() == 0 {
11001 m.Int64UpDownCounter.Add(ctx, incr)
11002 return
11003 }
11004
11005 o := addOptPool.Get().(*[]metric.AddOption)
11006 defer func() {
11007 *o = (*o)[:0]
11008 addOptPool.Put(o)
11009 }()
11010
11011 *o = append(*o, metric.WithAttributeSet(set))
11012 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11013 }
11014
11015 // StatefulSetPodDesired is an instrument used to record metric values conforming
11016 // to the "k8s.statefulset.pod.desired" semantic conventions. It represents the
11017 // number of desired replica pods in this statefulset.
11018 type StatefulSetPodDesired struct {
11019 metric.Int64UpDownCounter
11020 }
11021
11022 var newStatefulSetPodDesiredOpts = []metric.Int64UpDownCounterOption{
11023 metric.WithDescription("Number of desired replica pods in this statefulset."),
11024 metric.WithUnit("{pod}"),
11025 }
11026
11027 // NewStatefulSetPodDesired returns a new StatefulSetPodDesired instrument.
11028 func NewStatefulSetPodDesired(
11029 m metric.Meter,
11030 opt ...metric.Int64UpDownCounterOption,
11031 ) (StatefulSetPodDesired, error) {
11032 // Check if the meter is nil.
11033 if m == nil {
11034 return StatefulSetPodDesired{noop.Int64UpDownCounter{}}, nil
11035 }
11036
11037 if len(opt) == 0 {
11038 opt = newStatefulSetPodDesiredOpts
11039 } else {
11040 opt = append(opt, newStatefulSetPodDesiredOpts...)
11041 }
11042
11043 i, err := m.Int64UpDownCounter(
11044 "k8s.statefulset.pod.desired",
11045 opt...,
11046 )
11047 if err != nil {
11048 return StatefulSetPodDesired{noop.Int64UpDownCounter{}}, err
11049 }
11050 return StatefulSetPodDesired{i}, nil
11051 }
11052
11053 // Inst returns the underlying metric instrument.
11054 func (m StatefulSetPodDesired) Inst() metric.Int64UpDownCounter {
11055 return m.Int64UpDownCounter
11056 }
11057
11058 // Name returns the semantic convention name of the instrument.
11059 func (StatefulSetPodDesired) Name() string {
11060 return "k8s.statefulset.pod.desired"
11061 }
11062
11063 // Unit returns the semantic convention unit of the instrument
11064 func (StatefulSetPodDesired) Unit() string {
11065 return "{pod}"
11066 }
11067
11068 // Description returns the semantic convention description of the instrument
11069 func (StatefulSetPodDesired) Description() string {
11070 return "Number of desired replica pods in this statefulset."
11071 }
11072
11073 // Add adds incr to the existing count for attrs.
11074 //
11075 // This metric aligns with the `replicas` field of the
11076 // [K8s StatefulSetSpec].
11077 //
11078 // [K8s StatefulSetSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetspec-v1-apps
11079 func (m StatefulSetPodDesired) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
11080 if len(attrs) == 0 {
11081 m.Int64UpDownCounter.Add(ctx, incr)
11082 return
11083 }
11084
11085 o := addOptPool.Get().(*[]metric.AddOption)
11086 defer func() {
11087 *o = (*o)[:0]
11088 addOptPool.Put(o)
11089 }()
11090
11091 *o = append(*o, metric.WithAttributes(attrs...))
11092 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11093 }
11094
11095 // AddSet adds incr to the existing count for set.
11096 //
11097 // This metric aligns with the `replicas` field of the
11098 // [K8s StatefulSetSpec].
11099 //
11100 // [K8s StatefulSetSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetspec-v1-apps
11101 func (m StatefulSetPodDesired) AddSet(ctx context.Context, incr int64, set attribute.Set) {
11102 if set.Len() == 0 {
11103 m.Int64UpDownCounter.Add(ctx, incr)
11104 return
11105 }
11106
11107 o := addOptPool.Get().(*[]metric.AddOption)
11108 defer func() {
11109 *o = (*o)[:0]
11110 addOptPool.Put(o)
11111 }()
11112
11113 *o = append(*o, metric.WithAttributeSet(set))
11114 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11115 }
11116
11117 // StatefulSetPodReady is an instrument used to record metric values conforming
11118 // to the "k8s.statefulset.pod.ready" semantic conventions. It represents the
11119 // number of replica pods created for this statefulset with a Ready Condition.
11120 type StatefulSetPodReady struct {
11121 metric.Int64UpDownCounter
11122 }
11123
11124 var newStatefulSetPodReadyOpts = []metric.Int64UpDownCounterOption{
11125 metric.WithDescription("The number of replica pods created for this statefulset with a Ready Condition."),
11126 metric.WithUnit("{pod}"),
11127 }
11128
11129 // NewStatefulSetPodReady returns a new StatefulSetPodReady instrument.
11130 func NewStatefulSetPodReady(
11131 m metric.Meter,
11132 opt ...metric.Int64UpDownCounterOption,
11133 ) (StatefulSetPodReady, error) {
11134 // Check if the meter is nil.
11135 if m == nil {
11136 return StatefulSetPodReady{noop.Int64UpDownCounter{}}, nil
11137 }
11138
11139 if len(opt) == 0 {
11140 opt = newStatefulSetPodReadyOpts
11141 } else {
11142 opt = append(opt, newStatefulSetPodReadyOpts...)
11143 }
11144
11145 i, err := m.Int64UpDownCounter(
11146 "k8s.statefulset.pod.ready",
11147 opt...,
11148 )
11149 if err != nil {
11150 return StatefulSetPodReady{noop.Int64UpDownCounter{}}, err
11151 }
11152 return StatefulSetPodReady{i}, nil
11153 }
11154
11155 // Inst returns the underlying metric instrument.
11156 func (m StatefulSetPodReady) Inst() metric.Int64UpDownCounter {
11157 return m.Int64UpDownCounter
11158 }
11159
11160 // Name returns the semantic convention name of the instrument.
11161 func (StatefulSetPodReady) Name() string {
11162 return "k8s.statefulset.pod.ready"
11163 }
11164
11165 // Unit returns the semantic convention unit of the instrument
11166 func (StatefulSetPodReady) Unit() string {
11167 return "{pod}"
11168 }
11169
11170 // Description returns the semantic convention description of the instrument
11171 func (StatefulSetPodReady) Description() string {
11172 return "The number of replica pods created for this statefulset with a Ready Condition."
11173 }
11174
11175 // Add adds incr to the existing count for attrs.
11176 //
11177 // This metric aligns with the `readyReplicas` field of the
11178 // [K8s StatefulSetStatus].
11179 //
11180 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
11181 func (m StatefulSetPodReady) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
11182 if len(attrs) == 0 {
11183 m.Int64UpDownCounter.Add(ctx, incr)
11184 return
11185 }
11186
11187 o := addOptPool.Get().(*[]metric.AddOption)
11188 defer func() {
11189 *o = (*o)[:0]
11190 addOptPool.Put(o)
11191 }()
11192
11193 *o = append(*o, metric.WithAttributes(attrs...))
11194 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11195 }
11196
11197 // AddSet adds incr to the existing count for set.
11198 //
11199 // This metric aligns with the `readyReplicas` field of the
11200 // [K8s StatefulSetStatus].
11201 //
11202 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
11203 func (m StatefulSetPodReady) AddSet(ctx context.Context, incr int64, set attribute.Set) {
11204 if set.Len() == 0 {
11205 m.Int64UpDownCounter.Add(ctx, incr)
11206 return
11207 }
11208
11209 o := addOptPool.Get().(*[]metric.AddOption)
11210 defer func() {
11211 *o = (*o)[:0]
11212 addOptPool.Put(o)
11213 }()
11214
11215 *o = append(*o, metric.WithAttributeSet(set))
11216 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11217 }
11218
11219 // StatefulSetPodUpdated is an instrument used to record metric values conforming
11220 // to the "k8s.statefulset.pod.updated" semantic conventions. It represents the
11221 // number of replica pods created by the statefulset controller from the
11222 // statefulset version indicated by updateRevision.
11223 type StatefulSetPodUpdated struct {
11224 metric.Int64UpDownCounter
11225 }
11226
11227 var newStatefulSetPodUpdatedOpts = []metric.Int64UpDownCounterOption{
11228 metric.WithDescription("Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision."),
11229 metric.WithUnit("{pod}"),
11230 }
11231
11232 // NewStatefulSetPodUpdated returns a new StatefulSetPodUpdated instrument.
11233 func NewStatefulSetPodUpdated(
11234 m metric.Meter,
11235 opt ...metric.Int64UpDownCounterOption,
11236 ) (StatefulSetPodUpdated, error) {
11237 // Check if the meter is nil.
11238 if m == nil {
11239 return StatefulSetPodUpdated{noop.Int64UpDownCounter{}}, nil
11240 }
11241
11242 if len(opt) == 0 {
11243 opt = newStatefulSetPodUpdatedOpts
11244 } else {
11245 opt = append(opt, newStatefulSetPodUpdatedOpts...)
11246 }
11247
11248 i, err := m.Int64UpDownCounter(
11249 "k8s.statefulset.pod.updated",
11250 opt...,
11251 )
11252 if err != nil {
11253 return StatefulSetPodUpdated{noop.Int64UpDownCounter{}}, err
11254 }
11255 return StatefulSetPodUpdated{i}, nil
11256 }
11257
11258 // Inst returns the underlying metric instrument.
11259 func (m StatefulSetPodUpdated) Inst() metric.Int64UpDownCounter {
11260 return m.Int64UpDownCounter
11261 }
11262
11263 // Name returns the semantic convention name of the instrument.
11264 func (StatefulSetPodUpdated) Name() string {
11265 return "k8s.statefulset.pod.updated"
11266 }
11267
11268 // Unit returns the semantic convention unit of the instrument
11269 func (StatefulSetPodUpdated) Unit() string {
11270 return "{pod}"
11271 }
11272
11273 // Description returns the semantic convention description of the instrument
11274 func (StatefulSetPodUpdated) Description() string {
11275 return "Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision."
11276 }
11277
11278 // Add adds incr to the existing count for attrs.
11279 //
11280 // This metric aligns with the `updatedReplicas` field of the
11281 // [K8s StatefulSetStatus].
11282 //
11283 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
11284 func (m StatefulSetPodUpdated) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
11285 if len(attrs) == 0 {
11286 m.Int64UpDownCounter.Add(ctx, incr)
11287 return
11288 }
11289
11290 o := addOptPool.Get().(*[]metric.AddOption)
11291 defer func() {
11292 *o = (*o)[:0]
11293 addOptPool.Put(o)
11294 }()
11295
11296 *o = append(*o, metric.WithAttributes(attrs...))
11297 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11298 }
11299
11300 // AddSet adds incr to the existing count for set.
11301 //
11302 // This metric aligns with the `updatedReplicas` field of the
11303 // [K8s StatefulSetStatus].
11304 //
11305 // [K8s StatefulSetStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps
11306 func (m StatefulSetPodUpdated) AddSet(ctx context.Context, incr int64, set attribute.Set) {
11307 if set.Len() == 0 {
11308 m.Int64UpDownCounter.Add(ctx, incr)
11309 return
11310 }
11311
11312 o := addOptPool.Get().(*[]metric.AddOption)
11313 defer func() {
11314 *o = (*o)[:0]
11315 addOptPool.Put(o)
11316 }()
11317
11318 *o = append(*o, metric.WithAttributeSet(set))
11319 m.Int64UpDownCounter.Add(ctx, incr, *o...)
11320 }