Debian Codegraph @

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