Debian Codegraph @

semconv/v1.40.0/nfsconv/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 nfsconv provides types and functionality for OpenTelemetry semantic
7 // conventions in the "nfs" namespace.
8 package nfsconv
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 // ErrorTypeAttr is an attribute conforming to the error.type semantic
25 // conventions. It represents the describes a class of error the operation ended
26 // with.
27 type ErrorTypeAttr string
28
29 var (
30 // ErrorTypeOther is a fallback error value to be used when the instrumentation
31 // doesn't define a custom value.
32 ErrorTypeOther ErrorTypeAttr = "_OTHER"
33 )
34
35 // NetworkIODirectionAttr is an attribute conforming to the network.io.direction
36 // semantic conventions. It represents the network IO operation direction.
37 type NetworkIODirectionAttr string
38
39 var (
40 // NetworkIODirectionTransmit is the standardized value "transmit" of
41 // NetworkIODirectionAttr.
42 NetworkIODirectionTransmit NetworkIODirectionAttr = "transmit"
43 // NetworkIODirectionReceive is the standardized value "receive" of
44 // NetworkIODirectionAttr.
45 NetworkIODirectionReceive NetworkIODirectionAttr = "receive"
46 )
47
48 // NetworkTransportAttr is an attribute conforming to the network.transport
49 // semantic conventions. It represents the [OSI transport layer] or
50 // [inter-process communication method].
51 //
52 // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer
53 // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication
54 type NetworkTransportAttr string
55
56 var (
57 // NetworkTransportTCP is the TCP.
58 NetworkTransportTCP NetworkTransportAttr = "tcp"
59 // NetworkTransportUDP is the UDP.
60 NetworkTransportUDP NetworkTransportAttr = "udp"
61 // NetworkTransportPipe is the named or anonymous pipe.
62 NetworkTransportPipe NetworkTransportAttr = "pipe"
63 // NetworkTransportUnix is the unix domain socket.
64 NetworkTransportUnix NetworkTransportAttr = "unix"
65 // NetworkTransportQUIC is the QUIC.
66 NetworkTransportQUIC NetworkTransportAttr = "quic"
67 )
68
69 // ClientNetCount is an instrument used to record metric values conforming to the
70 // "nfs.client.net.count" semantic conventions. It represents the reports the
71 // count of kernel NFS client TCP segments and UDP datagrams handled.
72 type ClientNetCount struct {
73 metric.Int64Counter
74 }
75
76 var newClientNetCountOpts = []metric.Int64CounterOption{
77 metric.WithDescription("Reports the count of kernel NFS client TCP segments and UDP datagrams handled."),
78 metric.WithUnit("{record}"),
79 }
80
81 // NewClientNetCount returns a new ClientNetCount instrument.
82 func NewClientNetCount(
83 m metric.Meter,
84 opt ...metric.Int64CounterOption,
85 ) (ClientNetCount, error) {
86 // Check if the meter is nil.
87 if m == nil {
88 return ClientNetCount{noop.Int64Counter{}}, nil
89 }
90
91 if len(opt) == 0 {
92 opt = newClientNetCountOpts
93 } else {
94 opt = append(opt, newClientNetCountOpts...)
95 }
96
97 i, err := m.Int64Counter(
98 "nfs.client.net.count",
99 opt...,
100 )
101 if err != nil {
102 return ClientNetCount{noop.Int64Counter{}}, err
103 }
104 return ClientNetCount{i}, nil
105 }
106
107 // Inst returns the underlying metric instrument.
108 func (m ClientNetCount) Inst() metric.Int64Counter {
109 return m.Int64Counter
110 }
111
112 // Name returns the semantic convention name of the instrument.
113 func (ClientNetCount) Name() string {
114 return "nfs.client.net.count"
115 }
116
117 // Unit returns the semantic convention unit of the instrument
118 func (ClientNetCount) Unit() string {
119 return "{record}"
120 }
121
122 // Description returns the semantic convention description of the instrument
123 func (ClientNetCount) Description() string {
124 return "Reports the count of kernel NFS client TCP segments and UDP datagrams handled."
125 }
126
127 // Add adds incr to the existing count for attrs.
128 //
129 // All additional attrs passed are included in the recorded value.
130 //
131 // Linux: this metric is taken from the Linux kernel's svc_stat.netudpcnt and
132 // svc_stat.nettcpcnt
133 func (m ClientNetCount) Add(
134 ctx context.Context,
135 incr int64,
136 attrs ...attribute.KeyValue,
137 ) {
138 if len(attrs) == 0 {
139 m.Int64Counter.Add(ctx, incr)
140 return
141 }
142
143 o := addOptPool.Get().(*[]metric.AddOption)
144 defer func() {
145 *o = (*o)[:0]
146 addOptPool.Put(o)
147 }()
148
149 *o = append(
150 *o,
151 metric.WithAttributes(
152 attrs...,
153 ),
154 )
155
156 m.Int64Counter.Add(ctx, incr, *o...)
157 }
158
159 // AddSet adds incr to the existing count for set.
160 //
161 // Linux: this metric is taken from the Linux kernel's svc_stat.netudpcnt and
162 // svc_stat.nettcpcnt
163 func (m ClientNetCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
164 if set.Len() == 0 {
165 m.Int64Counter.Add(ctx, incr)
166 return
167 }
168
169 o := addOptPool.Get().(*[]metric.AddOption)
170 defer func() {
171 *o = (*o)[:0]
172 addOptPool.Put(o)
173 }()
174
175 *o = append(*o, metric.WithAttributeSet(set))
176 m.Int64Counter.Add(ctx, incr, *o...)
177 }
178
179 // AttrNetworkTransport returns an optional attribute for the "network.transport"
180 // semantic convention. It represents the [OSI transport layer] or
181 // [inter-process communication method].
182 //
183 // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer
184 // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication
185 func (ClientNetCount) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue {
186 return attribute.String("network.transport", string(val))
187 }
188
189 // ClientNetTCPConnectionAccepted is an instrument used to record metric values
190 // conforming to the "nfs.client.net.tcp.connection.accepted" semantic
191 // conventions. It represents the reports the count of kernel NFS client TCP
192 // connections accepted.
193 type ClientNetTCPConnectionAccepted struct {
194 metric.Int64Counter
195 }
196
197 var newClientNetTCPConnectionAcceptedOpts = []metric.Int64CounterOption{
198 metric.WithDescription("Reports the count of kernel NFS client TCP connections accepted."),
199 metric.WithUnit("{connection}"),
200 }
201
202 // NewClientNetTCPConnectionAccepted returns a new ClientNetTCPConnectionAccepted
203 // instrument.
204 func NewClientNetTCPConnectionAccepted(
205 m metric.Meter,
206 opt ...metric.Int64CounterOption,
207 ) (ClientNetTCPConnectionAccepted, error) {
208 // Check if the meter is nil.
209 if m == nil {
210 return ClientNetTCPConnectionAccepted{noop.Int64Counter{}}, nil
211 }
212
213 if len(opt) == 0 {
214 opt = newClientNetTCPConnectionAcceptedOpts
215 } else {
216 opt = append(opt, newClientNetTCPConnectionAcceptedOpts...)
217 }
218
219 i, err := m.Int64Counter(
220 "nfs.client.net.tcp.connection.accepted",
221 opt...,
222 )
223 if err != nil {
224 return ClientNetTCPConnectionAccepted{noop.Int64Counter{}}, err
225 }
226 return ClientNetTCPConnectionAccepted{i}, nil
227 }
228
229 // Inst returns the underlying metric instrument.
230 func (m ClientNetTCPConnectionAccepted) Inst() metric.Int64Counter {
231 return m.Int64Counter
232 }
233
234 // Name returns the semantic convention name of the instrument.
235 func (ClientNetTCPConnectionAccepted) Name() string {
236 return "nfs.client.net.tcp.connection.accepted"
237 }
238
239 // Unit returns the semantic convention unit of the instrument
240 func (ClientNetTCPConnectionAccepted) Unit() string {
241 return "{connection}"
242 }
243
244 // Description returns the semantic convention description of the instrument
245 func (ClientNetTCPConnectionAccepted) Description() string {
246 return "Reports the count of kernel NFS client TCP connections accepted."
247 }
248
249 // Add adds incr to the existing count for attrs.
250 //
251 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn
252 func (m ClientNetTCPConnectionAccepted) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
253 if len(attrs) == 0 {
254 m.Int64Counter.Add(ctx, incr)
255 return
256 }
257
258 o := addOptPool.Get().(*[]metric.AddOption)
259 defer func() {
260 *o = (*o)[:0]
261 addOptPool.Put(o)
262 }()
263
264 *o = append(*o, metric.WithAttributes(attrs...))
265 m.Int64Counter.Add(ctx, incr, *o...)
266 }
267
268 // AddSet adds incr to the existing count for set.
269 //
270 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn
271 func (m ClientNetTCPConnectionAccepted) AddSet(ctx context.Context, incr int64, set attribute.Set) {
272 if set.Len() == 0 {
273 m.Int64Counter.Add(ctx, incr)
274 return
275 }
276
277 o := addOptPool.Get().(*[]metric.AddOption)
278 defer func() {
279 *o = (*o)[:0]
280 addOptPool.Put(o)
281 }()
282
283 *o = append(*o, metric.WithAttributeSet(set))
284 m.Int64Counter.Add(ctx, incr, *o...)
285 }
286
287 // ClientOperationCount is an instrument used to record metric values conforming
288 // to the "nfs.client.operation.count" semantic conventions. It represents the
289 // reports the count of kernel NFSv4+ client operations.
290 type ClientOperationCount struct {
291 metric.Int64Counter
292 }
293
294 var newClientOperationCountOpts = []metric.Int64CounterOption{
295 metric.WithDescription("Reports the count of kernel NFSv4+ client operations."),
296 metric.WithUnit("{operation}"),
297 }
298
299 // NewClientOperationCount returns a new ClientOperationCount instrument.
300 func NewClientOperationCount(
301 m metric.Meter,
302 opt ...metric.Int64CounterOption,
303 ) (ClientOperationCount, error) {
304 // Check if the meter is nil.
305 if m == nil {
306 return ClientOperationCount{noop.Int64Counter{}}, nil
307 }
308
309 if len(opt) == 0 {
310 opt = newClientOperationCountOpts
311 } else {
312 opt = append(opt, newClientOperationCountOpts...)
313 }
314
315 i, err := m.Int64Counter(
316 "nfs.client.operation.count",
317 opt...,
318 )
319 if err != nil {
320 return ClientOperationCount{noop.Int64Counter{}}, err
321 }
322 return ClientOperationCount{i}, nil
323 }
324
325 // Inst returns the underlying metric instrument.
326 func (m ClientOperationCount) Inst() metric.Int64Counter {
327 return m.Int64Counter
328 }
329
330 // Name returns the semantic convention name of the instrument.
331 func (ClientOperationCount) Name() string {
332 return "nfs.client.operation.count"
333 }
334
335 // Unit returns the semantic convention unit of the instrument
336 func (ClientOperationCount) Unit() string {
337 return "{operation}"
338 }
339
340 // Description returns the semantic convention description of the instrument
341 func (ClientOperationCount) Description() string {
342 return "Reports the count of kernel NFSv4+ client operations."
343 }
344
345 // Add adds incr to the existing count for attrs.
346 //
347 // All additional attrs passed are included in the recorded value.
348 func (m ClientOperationCount) Add(
349 ctx context.Context,
350 incr int64,
351 attrs ...attribute.KeyValue,
352 ) {
353 if len(attrs) == 0 {
354 m.Int64Counter.Add(ctx, incr)
355 return
356 }
357
358 o := addOptPool.Get().(*[]metric.AddOption)
359 defer func() {
360 *o = (*o)[:0]
361 addOptPool.Put(o)
362 }()
363
364 *o = append(
365 *o,
366 metric.WithAttributes(
367 attrs...,
368 ),
369 )
370
371 m.Int64Counter.Add(ctx, incr, *o...)
372 }
373
374 // AddSet adds incr to the existing count for set.
375 func (m ClientOperationCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
376 if set.Len() == 0 {
377 m.Int64Counter.Add(ctx, incr)
378 return
379 }
380
381 o := addOptPool.Get().(*[]metric.AddOption)
382 defer func() {
383 *o = (*o)[:0]
384 addOptPool.Put(o)
385 }()
386
387 *o = append(*o, metric.WithAttributeSet(set))
388 m.Int64Counter.Add(ctx, incr, *o...)
389 }
390
391 // AttrOperationName returns an optional attribute for the "nfs.operation.name"
392 // semantic convention. It represents the NFSv4+ operation name.
393 func (ClientOperationCount) AttrOperationName(val string) attribute.KeyValue {
394 return attribute.String("nfs.operation.name", val)
395 }
396
397 // AttrOncRPCVersion returns an optional attribute for the "onc_rpc.version"
398 // semantic convention. It represents the ONC/Sun RPC program version.
399 func (ClientOperationCount) AttrOncRPCVersion(val int) attribute.KeyValue {
400 return attribute.Int("onc_rpc.version", val)
401 }
402
403 // ClientProcedureCount is an instrument used to record metric values conforming
404 // to the "nfs.client.procedure.count" semantic conventions. It represents the
405 // reports the count of kernel NFS client procedures.
406 type ClientProcedureCount struct {
407 metric.Int64Counter
408 }
409
410 var newClientProcedureCountOpts = []metric.Int64CounterOption{
411 metric.WithDescription("Reports the count of kernel NFS client procedures."),
412 metric.WithUnit("{procedure}"),
413 }
414
415 // NewClientProcedureCount returns a new ClientProcedureCount instrument.
416 func NewClientProcedureCount(
417 m metric.Meter,
418 opt ...metric.Int64CounterOption,
419 ) (ClientProcedureCount, error) {
420 // Check if the meter is nil.
421 if m == nil {
422 return ClientProcedureCount{noop.Int64Counter{}}, nil
423 }
424
425 if len(opt) == 0 {
426 opt = newClientProcedureCountOpts
427 } else {
428 opt = append(opt, newClientProcedureCountOpts...)
429 }
430
431 i, err := m.Int64Counter(
432 "nfs.client.procedure.count",
433 opt...,
434 )
435 if err != nil {
436 return ClientProcedureCount{noop.Int64Counter{}}, err
437 }
438 return ClientProcedureCount{i}, nil
439 }
440
441 // Inst returns the underlying metric instrument.
442 func (m ClientProcedureCount) Inst() metric.Int64Counter {
443 return m.Int64Counter
444 }
445
446 // Name returns the semantic convention name of the instrument.
447 func (ClientProcedureCount) Name() string {
448 return "nfs.client.procedure.count"
449 }
450
451 // Unit returns the semantic convention unit of the instrument
452 func (ClientProcedureCount) Unit() string {
453 return "{procedure}"
454 }
455
456 // Description returns the semantic convention description of the instrument
457 func (ClientProcedureCount) Description() string {
458 return "Reports the count of kernel NFS client procedures."
459 }
460
461 // Add adds incr to the existing count for attrs.
462 //
463 // All additional attrs passed are included in the recorded value.
464 func (m ClientProcedureCount) Add(
465 ctx context.Context,
466 incr int64,
467 attrs ...attribute.KeyValue,
468 ) {
469 if len(attrs) == 0 {
470 m.Int64Counter.Add(ctx, incr)
471 return
472 }
473
474 o := addOptPool.Get().(*[]metric.AddOption)
475 defer func() {
476 *o = (*o)[:0]
477 addOptPool.Put(o)
478 }()
479
480 *o = append(
481 *o,
482 metric.WithAttributes(
483 attrs...,
484 ),
485 )
486
487 m.Int64Counter.Add(ctx, incr, *o...)
488 }
489
490 // AddSet adds incr to the existing count for set.
491 func (m ClientProcedureCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
492 if set.Len() == 0 {
493 m.Int64Counter.Add(ctx, incr)
494 return
495 }
496
497 o := addOptPool.Get().(*[]metric.AddOption)
498 defer func() {
499 *o = (*o)[:0]
500 addOptPool.Put(o)
501 }()
502
503 *o = append(*o, metric.WithAttributeSet(set))
504 m.Int64Counter.Add(ctx, incr, *o...)
505 }
506
507 // AttrOncRPCProcedureName returns an optional attribute for the
508 // "onc_rpc.procedure.name" semantic convention. It represents the ONC/Sun RPC
509 // procedure name.
510 func (ClientProcedureCount) AttrOncRPCProcedureName(val string) attribute.KeyValue {
511 return attribute.String("onc_rpc.procedure.name", val)
512 }
513
514 // AttrOncRPCVersion returns an optional attribute for the "onc_rpc.version"
515 // semantic convention. It represents the ONC/Sun RPC program version.
516 func (ClientProcedureCount) AttrOncRPCVersion(val int) attribute.KeyValue {
517 return attribute.Int("onc_rpc.version", val)
518 }
519
520 // ClientRPCAuthrefreshCount is an instrument used to record metric values
521 // conforming to the "nfs.client.rpc.authrefresh.count" semantic conventions. It
522 // represents the reports the count of kernel NFS client RPC authentication
523 // refreshes.
524 type ClientRPCAuthrefreshCount struct {
525 metric.Int64Counter
526 }
527
528 var newClientRPCAuthrefreshCountOpts = []metric.Int64CounterOption{
529 metric.WithDescription("Reports the count of kernel NFS client RPC authentication refreshes."),
530 metric.WithUnit("{authrefresh}"),
531 }
532
533 // NewClientRPCAuthrefreshCount returns a new ClientRPCAuthrefreshCount
534 // instrument.
535 func NewClientRPCAuthrefreshCount(
536 m metric.Meter,
537 opt ...metric.Int64CounterOption,
538 ) (ClientRPCAuthrefreshCount, error) {
539 // Check if the meter is nil.
540 if m == nil {
541 return ClientRPCAuthrefreshCount{noop.Int64Counter{}}, nil
542 }
543
544 if len(opt) == 0 {
545 opt = newClientRPCAuthrefreshCountOpts
546 } else {
547 opt = append(opt, newClientRPCAuthrefreshCountOpts...)
548 }
549
550 i, err := m.Int64Counter(
551 "nfs.client.rpc.authrefresh.count",
552 opt...,
553 )
554 if err != nil {
555 return ClientRPCAuthrefreshCount{noop.Int64Counter{}}, err
556 }
557 return ClientRPCAuthrefreshCount{i}, nil
558 }
559
560 // Inst returns the underlying metric instrument.
561 func (m ClientRPCAuthrefreshCount) Inst() metric.Int64Counter {
562 return m.Int64Counter
563 }
564
565 // Name returns the semantic convention name of the instrument.
566 func (ClientRPCAuthrefreshCount) Name() string {
567 return "nfs.client.rpc.authrefresh.count"
568 }
569
570 // Unit returns the semantic convention unit of the instrument
571 func (ClientRPCAuthrefreshCount) Unit() string {
572 return "{authrefresh}"
573 }
574
575 // Description returns the semantic convention description of the instrument
576 func (ClientRPCAuthrefreshCount) Description() string {
577 return "Reports the count of kernel NFS client RPC authentication refreshes."
578 }
579
580 // Add adds incr to the existing count for attrs.
581 //
582 // Linux: this metric is taken from the Linux kernel's svc_stat.rpcauthrefresh
583 func (m ClientRPCAuthrefreshCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
584 if len(attrs) == 0 {
585 m.Int64Counter.Add(ctx, incr)
586 return
587 }
588
589 o := addOptPool.Get().(*[]metric.AddOption)
590 defer func() {
591 *o = (*o)[:0]
592 addOptPool.Put(o)
593 }()
594
595 *o = append(*o, metric.WithAttributes(attrs...))
596 m.Int64Counter.Add(ctx, incr, *o...)
597 }
598
599 // AddSet adds incr to the existing count for set.
600 //
601 // Linux: this metric is taken from the Linux kernel's svc_stat.rpcauthrefresh
602 func (m ClientRPCAuthrefreshCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
603 if set.Len() == 0 {
604 m.Int64Counter.Add(ctx, incr)
605 return
606 }
607
608 o := addOptPool.Get().(*[]metric.AddOption)
609 defer func() {
610 *o = (*o)[:0]
611 addOptPool.Put(o)
612 }()
613
614 *o = append(*o, metric.WithAttributeSet(set))
615 m.Int64Counter.Add(ctx, incr, *o...)
616 }
617
618 // ClientRPCCount is an instrument used to record metric values conforming to the
619 // "nfs.client.rpc.count" semantic conventions. It represents the reports the
620 // count of kernel NFS client RPCs sent, regardless of whether they're
621 // accepted/rejected by the server.
622 type ClientRPCCount struct {
623 metric.Int64Counter
624 }
625
626 var newClientRPCCountOpts = []metric.Int64CounterOption{
627 metric.WithDescription("Reports the count of kernel NFS client RPCs sent, regardless of whether they're accepted/rejected by the server."),
628 metric.WithUnit("{request}"),
629 }
630
631 // NewClientRPCCount returns a new ClientRPCCount instrument.
632 func NewClientRPCCount(
633 m metric.Meter,
634 opt ...metric.Int64CounterOption,
635 ) (ClientRPCCount, error) {
636 // Check if the meter is nil.
637 if m == nil {
638 return ClientRPCCount{noop.Int64Counter{}}, nil
639 }
640
641 if len(opt) == 0 {
642 opt = newClientRPCCountOpts
643 } else {
644 opt = append(opt, newClientRPCCountOpts...)
645 }
646
647 i, err := m.Int64Counter(
648 "nfs.client.rpc.count",
649 opt...,
650 )
651 if err != nil {
652 return ClientRPCCount{noop.Int64Counter{}}, err
653 }
654 return ClientRPCCount{i}, nil
655 }
656
657 // Inst returns the underlying metric instrument.
658 func (m ClientRPCCount) Inst() metric.Int64Counter {
659 return m.Int64Counter
660 }
661
662 // Name returns the semantic convention name of the instrument.
663 func (ClientRPCCount) Name() string {
664 return "nfs.client.rpc.count"
665 }
666
667 // Unit returns the semantic convention unit of the instrument
668 func (ClientRPCCount) Unit() string {
669 return "{request}"
670 }
671
672 // Description returns the semantic convention description of the instrument
673 func (ClientRPCCount) Description() string {
674 return "Reports the count of kernel NFS client RPCs sent, regardless of whether they're accepted/rejected by the server."
675 }
676
677 // Add adds incr to the existing count for attrs.
678 //
679 // Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt
680 func (m ClientRPCCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
681 if len(attrs) == 0 {
682 m.Int64Counter.Add(ctx, incr)
683 return
684 }
685
686 o := addOptPool.Get().(*[]metric.AddOption)
687 defer func() {
688 *o = (*o)[:0]
689 addOptPool.Put(o)
690 }()
691
692 *o = append(*o, metric.WithAttributes(attrs...))
693 m.Int64Counter.Add(ctx, incr, *o...)
694 }
695
696 // AddSet adds incr to the existing count for set.
697 //
698 // Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt
699 func (m ClientRPCCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
700 if set.Len() == 0 {
701 m.Int64Counter.Add(ctx, incr)
702 return
703 }
704
705 o := addOptPool.Get().(*[]metric.AddOption)
706 defer func() {
707 *o = (*o)[:0]
708 addOptPool.Put(o)
709 }()
710
711 *o = append(*o, metric.WithAttributeSet(set))
712 m.Int64Counter.Add(ctx, incr, *o...)
713 }
714
715 // ClientRPCRetransmitCount is an instrument used to record metric values
716 // conforming to the "nfs.client.rpc.retransmit.count" semantic conventions. It
717 // represents the reports the count of kernel NFS client RPC retransmits.
718 type ClientRPCRetransmitCount struct {
719 metric.Int64Counter
720 }
721
722 var newClientRPCRetransmitCountOpts = []metric.Int64CounterOption{
723 metric.WithDescription("Reports the count of kernel NFS client RPC retransmits."),
724 metric.WithUnit("{retransmit}"),
725 }
726
727 // NewClientRPCRetransmitCount returns a new ClientRPCRetransmitCount instrument.
728 func NewClientRPCRetransmitCount(
729 m metric.Meter,
730 opt ...metric.Int64CounterOption,
731 ) (ClientRPCRetransmitCount, error) {
732 // Check if the meter is nil.
733 if m == nil {
734 return ClientRPCRetransmitCount{noop.Int64Counter{}}, nil
735 }
736
737 if len(opt) == 0 {
738 opt = newClientRPCRetransmitCountOpts
739 } else {
740 opt = append(opt, newClientRPCRetransmitCountOpts...)
741 }
742
743 i, err := m.Int64Counter(
744 "nfs.client.rpc.retransmit.count",
745 opt...,
746 )
747 if err != nil {
748 return ClientRPCRetransmitCount{noop.Int64Counter{}}, err
749 }
750 return ClientRPCRetransmitCount{i}, nil
751 }
752
753 // Inst returns the underlying metric instrument.
754 func (m ClientRPCRetransmitCount) Inst() metric.Int64Counter {
755 return m.Int64Counter
756 }
757
758 // Name returns the semantic convention name of the instrument.
759 func (ClientRPCRetransmitCount) Name() string {
760 return "nfs.client.rpc.retransmit.count"
761 }
762
763 // Unit returns the semantic convention unit of the instrument
764 func (ClientRPCRetransmitCount) Unit() string {
765 return "{retransmit}"
766 }
767
768 // Description returns the semantic convention description of the instrument
769 func (ClientRPCRetransmitCount) Description() string {
770 return "Reports the count of kernel NFS client RPC retransmits."
771 }
772
773 // Add adds incr to the existing count for attrs.
774 //
775 // Linux: this metric is taken from the Linux kernel's svc_stat.rpcretrans
776 func (m ClientRPCRetransmitCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
777 if len(attrs) == 0 {
778 m.Int64Counter.Add(ctx, incr)
779 return
780 }
781
782 o := addOptPool.Get().(*[]metric.AddOption)
783 defer func() {
784 *o = (*o)[:0]
785 addOptPool.Put(o)
786 }()
787
788 *o = append(*o, metric.WithAttributes(attrs...))
789 m.Int64Counter.Add(ctx, incr, *o...)
790 }
791
792 // AddSet adds incr to the existing count for set.
793 //
794 // Linux: this metric is taken from the Linux kernel's svc_stat.rpcretrans
795 func (m ClientRPCRetransmitCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
796 if set.Len() == 0 {
797 m.Int64Counter.Add(ctx, incr)
798 return
799 }
800
801 o := addOptPool.Get().(*[]metric.AddOption)
802 defer func() {
803 *o = (*o)[:0]
804 addOptPool.Put(o)
805 }()
806
807 *o = append(*o, metric.WithAttributeSet(set))
808 m.Int64Counter.Add(ctx, incr, *o...)
809 }
810
811 // ServerFhStaleCount is an instrument used to record metric values conforming to
812 // the "nfs.server.fh.stale.count" semantic conventions. It represents the
813 // reports the count of kernel NFS server stale file handles.
814 type ServerFhStaleCount struct {
815 metric.Int64Counter
816 }
817
818 var newServerFhStaleCountOpts = []metric.Int64CounterOption{
819 metric.WithDescription("Reports the count of kernel NFS server stale file handles."),
820 metric.WithUnit("{fh}"),
821 }
822
823 // NewServerFhStaleCount returns a new ServerFhStaleCount instrument.
824 func NewServerFhStaleCount(
825 m metric.Meter,
826 opt ...metric.Int64CounterOption,
827 ) (ServerFhStaleCount, error) {
828 // Check if the meter is nil.
829 if m == nil {
830 return ServerFhStaleCount{noop.Int64Counter{}}, nil
831 }
832
833 if len(opt) == 0 {
834 opt = newServerFhStaleCountOpts
835 } else {
836 opt = append(opt, newServerFhStaleCountOpts...)
837 }
838
839 i, err := m.Int64Counter(
840 "nfs.server.fh.stale.count",
841 opt...,
842 )
843 if err != nil {
844 return ServerFhStaleCount{noop.Int64Counter{}}, err
845 }
846 return ServerFhStaleCount{i}, nil
847 }
848
849 // Inst returns the underlying metric instrument.
850 func (m ServerFhStaleCount) Inst() metric.Int64Counter {
851 return m.Int64Counter
852 }
853
854 // Name returns the semantic convention name of the instrument.
855 func (ServerFhStaleCount) Name() string {
856 return "nfs.server.fh.stale.count"
857 }
858
859 // Unit returns the semantic convention unit of the instrument
860 func (ServerFhStaleCount) Unit() string {
861 return "{fh}"
862 }
863
864 // Description returns the semantic convention description of the instrument
865 func (ServerFhStaleCount) Description() string {
866 return "Reports the count of kernel NFS server stale file handles."
867 }
868
869 // Add adds incr to the existing count for attrs.
870 //
871 // Linux: this metric is taken from the Linux kernel NFSD_STATS_FH_STALE counter
872 // in the nfsd_net struct
873 func (m ServerFhStaleCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
874 if len(attrs) == 0 {
875 m.Int64Counter.Add(ctx, incr)
876 return
877 }
878
879 o := addOptPool.Get().(*[]metric.AddOption)
880 defer func() {
881 *o = (*o)[:0]
882 addOptPool.Put(o)
883 }()
884
885 *o = append(*o, metric.WithAttributes(attrs...))
886 m.Int64Counter.Add(ctx, incr, *o...)
887 }
888
889 // AddSet adds incr to the existing count for set.
890 //
891 // Linux: this metric is taken from the Linux kernel NFSD_STATS_FH_STALE counter
892 // in the nfsd_net struct
893 func (m ServerFhStaleCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
894 if set.Len() == 0 {
895 m.Int64Counter.Add(ctx, incr)
896 return
897 }
898
899 o := addOptPool.Get().(*[]metric.AddOption)
900 defer func() {
901 *o = (*o)[:0]
902 addOptPool.Put(o)
903 }()
904
905 *o = append(*o, metric.WithAttributeSet(set))
906 m.Int64Counter.Add(ctx, incr, *o...)
907 }
908
909 // ServerIO is an instrument used to record metric values conforming to the
910 // "nfs.server.io" semantic conventions. It represents the reports the count of
911 // kernel NFS server bytes returned to receive and transmit (read and write)
912 // requests.
913 type ServerIO struct {
914 metric.Int64Counter
915 }
916
917 var newServerIOOpts = []metric.Int64CounterOption{
918 metric.WithDescription("Reports the count of kernel NFS server bytes returned to receive and transmit (read and write) requests."),
919 metric.WithUnit("By"),
920 }
921
922 // NewServerIO returns a new ServerIO instrument.
923 func NewServerIO(
924 m metric.Meter,
925 opt ...metric.Int64CounterOption,
926 ) (ServerIO, error) {
927 // Check if the meter is nil.
928 if m == nil {
929 return ServerIO{noop.Int64Counter{}}, nil
930 }
931
932 if len(opt) == 0 {
933 opt = newServerIOOpts
934 } else {
935 opt = append(opt, newServerIOOpts...)
936 }
937
938 i, err := m.Int64Counter(
939 "nfs.server.io",
940 opt...,
941 )
942 if err != nil {
943 return ServerIO{noop.Int64Counter{}}, err
944 }
945 return ServerIO{i}, nil
946 }
947
948 // Inst returns the underlying metric instrument.
949 func (m ServerIO) Inst() metric.Int64Counter {
950 return m.Int64Counter
951 }
952
953 // Name returns the semantic convention name of the instrument.
954 func (ServerIO) Name() string {
955 return "nfs.server.io"
956 }
957
958 // Unit returns the semantic convention unit of the instrument
959 func (ServerIO) Unit() string {
960 return "By"
961 }
962
963 // Description returns the semantic convention description of the instrument
964 func (ServerIO) Description() string {
965 return "Reports the count of kernel NFS server bytes returned to receive and transmit (read and write) requests."
966 }
967
968 // Add adds incr to the existing count for attrs.
969 //
970 // All additional attrs passed are included in the recorded value.
971 //
972 // Linux: this metric is taken from the Linux kernel NFSD_STATS_IO_READ and
973 // NFSD_STATS_IO_WRITE counters in the nfsd_net struct
974 func (m ServerIO) Add(
975 ctx context.Context,
976 incr int64,
977 attrs ...attribute.KeyValue,
978 ) {
979 if len(attrs) == 0 {
980 m.Int64Counter.Add(ctx, incr)
981 return
982 }
983
984 o := addOptPool.Get().(*[]metric.AddOption)
985 defer func() {
986 *o = (*o)[:0]
987 addOptPool.Put(o)
988 }()
989
990 *o = append(
991 *o,
992 metric.WithAttributes(
993 attrs...,
994 ),
995 )
996
997 m.Int64Counter.Add(ctx, incr, *o...)
998 }
999
1000 // AddSet adds incr to the existing count for set.
1001 //
1002 // Linux: this metric is taken from the Linux kernel NFSD_STATS_IO_READ and
1003 // NFSD_STATS_IO_WRITE counters in the nfsd_net struct
1004 func (m ServerIO) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1005 if set.Len() == 0 {
1006 m.Int64Counter.Add(ctx, incr)
1007 return
1008 }
1009
1010 o := addOptPool.Get().(*[]metric.AddOption)
1011 defer func() {
1012 *o = (*o)[:0]
1013 addOptPool.Put(o)
1014 }()
1015
1016 *o = append(*o, metric.WithAttributeSet(set))
1017 m.Int64Counter.Add(ctx, incr, *o...)
1018 }
1019
1020 // AttrNetworkIODirection returns an optional attribute for the
1021 // "network.io.direction" semantic convention. It represents the network IO
1022 // operation direction.
1023 func (ServerIO) AttrNetworkIODirection(val NetworkIODirectionAttr) attribute.KeyValue {
1024 return attribute.String("network.io.direction", string(val))
1025 }
1026
1027 // ServerNetCount is an instrument used to record metric values conforming to the
1028 // "nfs.server.net.count" semantic conventions. It represents the reports the
1029 // count of kernel NFS server TCP segments and UDP datagrams handled.
1030 type ServerNetCount struct {
1031 metric.Int64Counter
1032 }
1033
1034 var newServerNetCountOpts = []metric.Int64CounterOption{
1035 metric.WithDescription("Reports the count of kernel NFS server TCP segments and UDP datagrams handled."),
1036 metric.WithUnit("{record}"),
1037 }
1038
1039 // NewServerNetCount returns a new ServerNetCount instrument.
1040 func NewServerNetCount(
1041 m metric.Meter,
1042 opt ...metric.Int64CounterOption,
1043 ) (ServerNetCount, error) {
1044 // Check if the meter is nil.
1045 if m == nil {
1046 return ServerNetCount{noop.Int64Counter{}}, nil
1047 }
1048
1049 if len(opt) == 0 {
1050 opt = newServerNetCountOpts
1051 } else {
1052 opt = append(opt, newServerNetCountOpts...)
1053 }
1054
1055 i, err := m.Int64Counter(
1056 "nfs.server.net.count",
1057 opt...,
1058 )
1059 if err != nil {
1060 return ServerNetCount{noop.Int64Counter{}}, err
1061 }
1062 return ServerNetCount{i}, nil
1063 }
1064
1065 // Inst returns the underlying metric instrument.
1066 func (m ServerNetCount) Inst() metric.Int64Counter {
1067 return m.Int64Counter
1068 }
1069
1070 // Name returns the semantic convention name of the instrument.
1071 func (ServerNetCount) Name() string {
1072 return "nfs.server.net.count"
1073 }
1074
1075 // Unit returns the semantic convention unit of the instrument
1076 func (ServerNetCount) Unit() string {
1077 return "{record}"
1078 }
1079
1080 // Description returns the semantic convention description of the instrument
1081 func (ServerNetCount) Description() string {
1082 return "Reports the count of kernel NFS server TCP segments and UDP datagrams handled."
1083 }
1084
1085 // Add adds incr to the existing count for attrs.
1086 //
1087 // All additional attrs passed are included in the recorded value.
1088 //
1089 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpcnt and
1090 // svc_stat.netudpcnt
1091 func (m ServerNetCount) Add(
1092 ctx context.Context,
1093 incr int64,
1094 attrs ...attribute.KeyValue,
1095 ) {
1096 if len(attrs) == 0 {
1097 m.Int64Counter.Add(ctx, incr)
1098 return
1099 }
1100
1101 o := addOptPool.Get().(*[]metric.AddOption)
1102 defer func() {
1103 *o = (*o)[:0]
1104 addOptPool.Put(o)
1105 }()
1106
1107 *o = append(
1108 *o,
1109 metric.WithAttributes(
1110 attrs...,
1111 ),
1112 )
1113
1114 m.Int64Counter.Add(ctx, incr, *o...)
1115 }
1116
1117 // AddSet adds incr to the existing count for set.
1118 //
1119 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpcnt and
1120 // svc_stat.netudpcnt
1121 func (m ServerNetCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1122 if set.Len() == 0 {
1123 m.Int64Counter.Add(ctx, incr)
1124 return
1125 }
1126
1127 o := addOptPool.Get().(*[]metric.AddOption)
1128 defer func() {
1129 *o = (*o)[:0]
1130 addOptPool.Put(o)
1131 }()
1132
1133 *o = append(*o, metric.WithAttributeSet(set))
1134 m.Int64Counter.Add(ctx, incr, *o...)
1135 }
1136
1137 // AttrNetworkTransport returns an optional attribute for the "network.transport"
1138 // semantic convention. It represents the [OSI transport layer] or
1139 // [inter-process communication method].
1140 //
1141 // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer
1142 // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication
1143 func (ServerNetCount) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue {
1144 return attribute.String("network.transport", string(val))
1145 }
1146
1147 // ServerNetTCPConnectionAccepted is an instrument used to record metric values
1148 // conforming to the "nfs.server.net.tcp.connection.accepted" semantic
1149 // conventions. It represents the reports the count of kernel NFS server TCP
1150 // connections accepted.
1151 type ServerNetTCPConnectionAccepted struct {
1152 metric.Int64Counter
1153 }
1154
1155 var newServerNetTCPConnectionAcceptedOpts = []metric.Int64CounterOption{
1156 metric.WithDescription("Reports the count of kernel NFS server TCP connections accepted."),
1157 metric.WithUnit("{connection}"),
1158 }
1159
1160 // NewServerNetTCPConnectionAccepted returns a new ServerNetTCPConnectionAccepted
1161 // instrument.
1162 func NewServerNetTCPConnectionAccepted(
1163 m metric.Meter,
1164 opt ...metric.Int64CounterOption,
1165 ) (ServerNetTCPConnectionAccepted, error) {
1166 // Check if the meter is nil.
1167 if m == nil {
1168 return ServerNetTCPConnectionAccepted{noop.Int64Counter{}}, nil
1169 }
1170
1171 if len(opt) == 0 {
1172 opt = newServerNetTCPConnectionAcceptedOpts
1173 } else {
1174 opt = append(opt, newServerNetTCPConnectionAcceptedOpts...)
1175 }
1176
1177 i, err := m.Int64Counter(
1178 "nfs.server.net.tcp.connection.accepted",
1179 opt...,
1180 )
1181 if err != nil {
1182 return ServerNetTCPConnectionAccepted{noop.Int64Counter{}}, err
1183 }
1184 return ServerNetTCPConnectionAccepted{i}, nil
1185 }
1186
1187 // Inst returns the underlying metric instrument.
1188 func (m ServerNetTCPConnectionAccepted) Inst() metric.Int64Counter {
1189 return m.Int64Counter
1190 }
1191
1192 // Name returns the semantic convention name of the instrument.
1193 func (ServerNetTCPConnectionAccepted) Name() string {
1194 return "nfs.server.net.tcp.connection.accepted"
1195 }
1196
1197 // Unit returns the semantic convention unit of the instrument
1198 func (ServerNetTCPConnectionAccepted) Unit() string {
1199 return "{connection}"
1200 }
1201
1202 // Description returns the semantic convention description of the instrument
1203 func (ServerNetTCPConnectionAccepted) Description() string {
1204 return "Reports the count of kernel NFS server TCP connections accepted."
1205 }
1206
1207 // Add adds incr to the existing count for attrs.
1208 //
1209 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn
1210 func (m ServerNetTCPConnectionAccepted) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1211 if len(attrs) == 0 {
1212 m.Int64Counter.Add(ctx, incr)
1213 return
1214 }
1215
1216 o := addOptPool.Get().(*[]metric.AddOption)
1217 defer func() {
1218 *o = (*o)[:0]
1219 addOptPool.Put(o)
1220 }()
1221
1222 *o = append(*o, metric.WithAttributes(attrs...))
1223 m.Int64Counter.Add(ctx, incr, *o...)
1224 }
1225
1226 // AddSet adds incr to the existing count for set.
1227 //
1228 // Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn
1229 func (m ServerNetTCPConnectionAccepted) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1230 if set.Len() == 0 {
1231 m.Int64Counter.Add(ctx, incr)
1232 return
1233 }
1234
1235 o := addOptPool.Get().(*[]metric.AddOption)
1236 defer func() {
1237 *o = (*o)[:0]
1238 addOptPool.Put(o)
1239 }()
1240
1241 *o = append(*o, metric.WithAttributeSet(set))
1242 m.Int64Counter.Add(ctx, incr, *o...)
1243 }
1244
1245 // ServerOperationCount is an instrument used to record metric values conforming
1246 // to the "nfs.server.operation.count" semantic conventions. It represents the
1247 // reports the count of kernel NFSv4+ server operations.
1248 type ServerOperationCount struct {
1249 metric.Int64Counter
1250 }
1251
1252 var newServerOperationCountOpts = []metric.Int64CounterOption{
1253 metric.WithDescription("Reports the count of kernel NFSv4+ server operations."),
1254 metric.WithUnit("{operation}"),
1255 }
1256
1257 // NewServerOperationCount returns a new ServerOperationCount instrument.
1258 func NewServerOperationCount(
1259 m metric.Meter,
1260 opt ...metric.Int64CounterOption,
1261 ) (ServerOperationCount, error) {
1262 // Check if the meter is nil.
1263 if m == nil {
1264 return ServerOperationCount{noop.Int64Counter{}}, nil
1265 }
1266
1267 if len(opt) == 0 {
1268 opt = newServerOperationCountOpts
1269 } else {
1270 opt = append(opt, newServerOperationCountOpts...)
1271 }
1272
1273 i, err := m.Int64Counter(
1274 "nfs.server.operation.count",
1275 opt...,
1276 )
1277 if err != nil {
1278 return ServerOperationCount{noop.Int64Counter{}}, err
1279 }
1280 return ServerOperationCount{i}, nil
1281 }
1282
1283 // Inst returns the underlying metric instrument.
1284 func (m ServerOperationCount) Inst() metric.Int64Counter {
1285 return m.Int64Counter
1286 }
1287
1288 // Name returns the semantic convention name of the instrument.
1289 func (ServerOperationCount) Name() string {
1290 return "nfs.server.operation.count"
1291 }
1292
1293 // Unit returns the semantic convention unit of the instrument
1294 func (ServerOperationCount) Unit() string {
1295 return "{operation}"
1296 }
1297
1298 // Description returns the semantic convention description of the instrument
1299 func (ServerOperationCount) Description() string {
1300 return "Reports the count of kernel NFSv4+ server operations."
1301 }
1302
1303 // Add adds incr to the existing count for attrs.
1304 //
1305 // All additional attrs passed are included in the recorded value.
1306 func (m ServerOperationCount) Add(
1307 ctx context.Context,
1308 incr int64,
1309 attrs ...attribute.KeyValue,
1310 ) {
1311 if len(attrs) == 0 {
1312 m.Int64Counter.Add(ctx, incr)
1313 return
1314 }
1315
1316 o := addOptPool.Get().(*[]metric.AddOption)
1317 defer func() {
1318 *o = (*o)[:0]
1319 addOptPool.Put(o)
1320 }()
1321
1322 *o = append(
1323 *o,
1324 metric.WithAttributes(
1325 attrs...,
1326 ),
1327 )
1328
1329 m.Int64Counter.Add(ctx, incr, *o...)
1330 }
1331
1332 // AddSet adds incr to the existing count for set.
1333 func (m ServerOperationCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1334 if set.Len() == 0 {
1335 m.Int64Counter.Add(ctx, incr)
1336 return
1337 }
1338
1339 o := addOptPool.Get().(*[]metric.AddOption)
1340 defer func() {
1341 *o = (*o)[:0]
1342 addOptPool.Put(o)
1343 }()
1344
1345 *o = append(*o, metric.WithAttributeSet(set))
1346 m.Int64Counter.Add(ctx, incr, *o...)
1347 }
1348
1349 // AttrOperationName returns an optional attribute for the "nfs.operation.name"
1350 // semantic convention. It represents the NFSv4+ operation name.
1351 func (ServerOperationCount) AttrOperationName(val string) attribute.KeyValue {
1352 return attribute.String("nfs.operation.name", val)
1353 }
1354
1355 // AttrOncRPCVersion returns an optional attribute for the "onc_rpc.version"
1356 // semantic convention. It represents the ONC/Sun RPC program version.
1357 func (ServerOperationCount) AttrOncRPCVersion(val int) attribute.KeyValue {
1358 return attribute.Int("onc_rpc.version", val)
1359 }
1360
1361 // ServerProcedureCount is an instrument used to record metric values conforming
1362 // to the "nfs.server.procedure.count" semantic conventions. It represents the
1363 // reports the count of kernel NFS server procedures.
1364 type ServerProcedureCount struct {
1365 metric.Int64Counter
1366 }
1367
1368 var newServerProcedureCountOpts = []metric.Int64CounterOption{
1369 metric.WithDescription("Reports the count of kernel NFS server procedures."),
1370 metric.WithUnit("{procedure}"),
1371 }
1372
1373 // NewServerProcedureCount returns a new ServerProcedureCount instrument.
1374 func NewServerProcedureCount(
1375 m metric.Meter,
1376 opt ...metric.Int64CounterOption,
1377 ) (ServerProcedureCount, error) {
1378 // Check if the meter is nil.
1379 if m == nil {
1380 return ServerProcedureCount{noop.Int64Counter{}}, nil
1381 }
1382
1383 if len(opt) == 0 {
1384 opt = newServerProcedureCountOpts
1385 } else {
1386 opt = append(opt, newServerProcedureCountOpts...)
1387 }
1388
1389 i, err := m.Int64Counter(
1390 "nfs.server.procedure.count",
1391 opt...,
1392 )
1393 if err != nil {
1394 return ServerProcedureCount{noop.Int64Counter{}}, err
1395 }
1396 return ServerProcedureCount{i}, nil
1397 }
1398
1399 // Inst returns the underlying metric instrument.
1400 func (m ServerProcedureCount) Inst() metric.Int64Counter {
1401 return m.Int64Counter
1402 }
1403
1404 // Name returns the semantic convention name of the instrument.
1405 func (ServerProcedureCount) Name() string {
1406 return "nfs.server.procedure.count"
1407 }
1408
1409 // Unit returns the semantic convention unit of the instrument
1410 func (ServerProcedureCount) Unit() string {
1411 return "{procedure}"
1412 }
1413
1414 // Description returns the semantic convention description of the instrument
1415 func (ServerProcedureCount) Description() string {
1416 return "Reports the count of kernel NFS server procedures."
1417 }
1418
1419 // Add adds incr to the existing count for attrs.
1420 //
1421 // All additional attrs passed are included in the recorded value.
1422 func (m ServerProcedureCount) Add(
1423 ctx context.Context,
1424 incr int64,
1425 attrs ...attribute.KeyValue,
1426 ) {
1427 if len(attrs) == 0 {
1428 m.Int64Counter.Add(ctx, incr)
1429 return
1430 }
1431
1432 o := addOptPool.Get().(*[]metric.AddOption)
1433 defer func() {
1434 *o = (*o)[:0]
1435 addOptPool.Put(o)
1436 }()
1437
1438 *o = append(
1439 *o,
1440 metric.WithAttributes(
1441 attrs...,
1442 ),
1443 )
1444
1445 m.Int64Counter.Add(ctx, incr, *o...)
1446 }
1447
1448 // AddSet adds incr to the existing count for set.
1449 func (m ServerProcedureCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1450 if set.Len() == 0 {
1451 m.Int64Counter.Add(ctx, incr)
1452 return
1453 }
1454
1455 o := addOptPool.Get().(*[]metric.AddOption)
1456 defer func() {
1457 *o = (*o)[:0]
1458 addOptPool.Put(o)
1459 }()
1460
1461 *o = append(*o, metric.WithAttributeSet(set))
1462 m.Int64Counter.Add(ctx, incr, *o...)
1463 }
1464
1465 // AttrOncRPCProcedureName returns an optional attribute for the
1466 // "onc_rpc.procedure.name" semantic convention. It represents the ONC/Sun RPC
1467 // procedure name.
1468 func (ServerProcedureCount) AttrOncRPCProcedureName(val string) attribute.KeyValue {
1469 return attribute.String("onc_rpc.procedure.name", val)
1470 }
1471
1472 // AttrOncRPCVersion returns an optional attribute for the "onc_rpc.version"
1473 // semantic convention. It represents the ONC/Sun RPC program version.
1474 func (ServerProcedureCount) AttrOncRPCVersion(val int) attribute.KeyValue {
1475 return attribute.Int("onc_rpc.version", val)
1476 }
1477
1478 // ServerRepcacheRequests is an instrument used to record metric values
1479 // conforming to the "nfs.server.repcache.requests" semantic conventions. It
1480 // represents the reports the kernel NFS server reply cache request count by
1481 // cache hit status.
1482 type ServerRepcacheRequests struct {
1483 metric.Int64Counter
1484 }
1485
1486 var newServerRepcacheRequestsOpts = []metric.Int64CounterOption{
1487 metric.WithDescription("Reports the kernel NFS server reply cache request count by cache hit status."),
1488 metric.WithUnit("{request}"),
1489 }
1490
1491 // NewServerRepcacheRequests returns a new ServerRepcacheRequests instrument.
1492 func NewServerRepcacheRequests(
1493 m metric.Meter,
1494 opt ...metric.Int64CounterOption,
1495 ) (ServerRepcacheRequests, error) {
1496 // Check if the meter is nil.
1497 if m == nil {
1498 return ServerRepcacheRequests{noop.Int64Counter{}}, nil
1499 }
1500
1501 if len(opt) == 0 {
1502 opt = newServerRepcacheRequestsOpts
1503 } else {
1504 opt = append(opt, newServerRepcacheRequestsOpts...)
1505 }
1506
1507 i, err := m.Int64Counter(
1508 "nfs.server.repcache.requests",
1509 opt...,
1510 )
1511 if err != nil {
1512 return ServerRepcacheRequests{noop.Int64Counter{}}, err
1513 }
1514 return ServerRepcacheRequests{i}, nil
1515 }
1516
1517 // Inst returns the underlying metric instrument.
1518 func (m ServerRepcacheRequests) Inst() metric.Int64Counter {
1519 return m.Int64Counter
1520 }
1521
1522 // Name returns the semantic convention name of the instrument.
1523 func (ServerRepcacheRequests) Name() string {
1524 return "nfs.server.repcache.requests"
1525 }
1526
1527 // Unit returns the semantic convention unit of the instrument
1528 func (ServerRepcacheRequests) Unit() string {
1529 return "{request}"
1530 }
1531
1532 // Description returns the semantic convention description of the instrument
1533 func (ServerRepcacheRequests) Description() string {
1534 return "Reports the kernel NFS server reply cache request count by cache hit status."
1535 }
1536
1537 // Add adds incr to the existing count for attrs.
1538 //
1539 // All additional attrs passed are included in the recorded value.
1540 func (m ServerRepcacheRequests) Add(
1541 ctx context.Context,
1542 incr int64,
1543 attrs ...attribute.KeyValue,
1544 ) {
1545 if len(attrs) == 0 {
1546 m.Int64Counter.Add(ctx, incr)
1547 return
1548 }
1549
1550 o := addOptPool.Get().(*[]metric.AddOption)
1551 defer func() {
1552 *o = (*o)[:0]
1553 addOptPool.Put(o)
1554 }()
1555
1556 *o = append(
1557 *o,
1558 metric.WithAttributes(
1559 attrs...,
1560 ),
1561 )
1562
1563 m.Int64Counter.Add(ctx, incr, *o...)
1564 }
1565
1566 // AddSet adds incr to the existing count for set.
1567 func (m ServerRepcacheRequests) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1568 if set.Len() == 0 {
1569 m.Int64Counter.Add(ctx, incr)
1570 return
1571 }
1572
1573 o := addOptPool.Get().(*[]metric.AddOption)
1574 defer func() {
1575 *o = (*o)[:0]
1576 addOptPool.Put(o)
1577 }()
1578
1579 *o = append(*o, metric.WithAttributeSet(set))
1580 m.Int64Counter.Add(ctx, incr, *o...)
1581 }
1582
1583 // AttrServerRepcacheStatus returns an optional attribute for the
1584 // "nfs.server.repcache.status" semantic convention. It represents the linux: one
1585 // of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or "nocache"
1586 // (NFSD_STATS_RC_NOCACHE -- uncacheable).
1587 func (ServerRepcacheRequests) AttrServerRepcacheStatus(val string) attribute.KeyValue {
1588 return attribute.String("nfs.server.repcache.status", val)
1589 }
1590
1591 // ServerRPCCount is an instrument used to record metric values conforming to the
1592 // "nfs.server.rpc.count" semantic conventions. It represents the reports the
1593 // count of kernel NFS server RPCs handled.
1594 type ServerRPCCount struct {
1595 metric.Int64Counter
1596 }
1597
1598 var newServerRPCCountOpts = []metric.Int64CounterOption{
1599 metric.WithDescription("Reports the count of kernel NFS server RPCs handled."),
1600 metric.WithUnit("{request}"),
1601 }
1602
1603 // NewServerRPCCount returns a new ServerRPCCount instrument.
1604 func NewServerRPCCount(
1605 m metric.Meter,
1606 opt ...metric.Int64CounterOption,
1607 ) (ServerRPCCount, error) {
1608 // Check if the meter is nil.
1609 if m == nil {
1610 return ServerRPCCount{noop.Int64Counter{}}, nil
1611 }
1612
1613 if len(opt) == 0 {
1614 opt = newServerRPCCountOpts
1615 } else {
1616 opt = append(opt, newServerRPCCountOpts...)
1617 }
1618
1619 i, err := m.Int64Counter(
1620 "nfs.server.rpc.count",
1621 opt...,
1622 )
1623 if err != nil {
1624 return ServerRPCCount{noop.Int64Counter{}}, err
1625 }
1626 return ServerRPCCount{i}, nil
1627 }
1628
1629 // Inst returns the underlying metric instrument.
1630 func (m ServerRPCCount) Inst() metric.Int64Counter {
1631 return m.Int64Counter
1632 }
1633
1634 // Name returns the semantic convention name of the instrument.
1635 func (ServerRPCCount) Name() string {
1636 return "nfs.server.rpc.count"
1637 }
1638
1639 // Unit returns the semantic convention unit of the instrument
1640 func (ServerRPCCount) Unit() string {
1641 return "{request}"
1642 }
1643
1644 // Description returns the semantic convention description of the instrument
1645 func (ServerRPCCount) Description() string {
1646 return "Reports the count of kernel NFS server RPCs handled."
1647 }
1648
1649 // Add adds incr to the existing count for attrs.
1650 //
1651 // All additional attrs passed are included in the recorded value.
1652 //
1653 // Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt, the count
1654 // of good RPCs. This metric can have
1655 // an error.type of "format", "auth", or "client" for svc_stat.badfmt,
1656 // svc_stat.badauth, and svc_stat.badclnt.
1657 func (m ServerRPCCount) Add(
1658 ctx context.Context,
1659 incr int64,
1660 attrs ...attribute.KeyValue,
1661 ) {
1662 if len(attrs) == 0 {
1663 m.Int64Counter.Add(ctx, incr)
1664 return
1665 }
1666
1667 o := addOptPool.Get().(*[]metric.AddOption)
1668 defer func() {
1669 *o = (*o)[:0]
1670 addOptPool.Put(o)
1671 }()
1672
1673 *o = append(
1674 *o,
1675 metric.WithAttributes(
1676 attrs...,
1677 ),
1678 )
1679
1680 m.Int64Counter.Add(ctx, incr, *o...)
1681 }
1682
1683 // AddSet adds incr to the existing count for set.
1684 //
1685 // Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt, the count
1686 // of good RPCs. This metric can have
1687 // an error.type of "format", "auth", or "client" for svc_stat.badfmt,
1688 // svc_stat.badauth, and svc_stat.badclnt.
1689 func (m ServerRPCCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1690 if set.Len() == 0 {
1691 m.Int64Counter.Add(ctx, incr)
1692 return
1693 }
1694
1695 o := addOptPool.Get().(*[]metric.AddOption)
1696 defer func() {
1697 *o = (*o)[:0]
1698 addOptPool.Put(o)
1699 }()
1700
1701 *o = append(*o, metric.WithAttributeSet(set))
1702 m.Int64Counter.Add(ctx, incr, *o...)
1703 }
1704
1705 // AttrErrorType returns an optional attribute for the "error.type" semantic
1706 // convention. It represents the describes a class of error the operation ended
1707 // with.
1708 func (ServerRPCCount) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
1709 return attribute.String("error.type", string(val))
1710 }
1711
1712 // ServerThreadCount is an instrument used to record metric values conforming to
1713 // the "nfs.server.thread.count" semantic conventions. It represents the reports
1714 // the count of kernel NFS server available threads.
1715 type ServerThreadCount struct {
1716 metric.Int64UpDownCounter
1717 }
1718
1719 var newServerThreadCountOpts = []metric.Int64UpDownCounterOption{
1720 metric.WithDescription("Reports the count of kernel NFS server available threads."),
1721 metric.WithUnit("{thread}"),
1722 }
1723
1724 // NewServerThreadCount returns a new ServerThreadCount instrument.
1725 func NewServerThreadCount(
1726 m metric.Meter,
1727 opt ...metric.Int64UpDownCounterOption,
1728 ) (ServerThreadCount, error) {
1729 // Check if the meter is nil.
1730 if m == nil {
1731 return ServerThreadCount{noop.Int64UpDownCounter{}}, nil
1732 }
1733
1734 if len(opt) == 0 {
1735 opt = newServerThreadCountOpts
1736 } else {
1737 opt = append(opt, newServerThreadCountOpts...)
1738 }
1739
1740 i, err := m.Int64UpDownCounter(
1741 "nfs.server.thread.count",
1742 opt...,
1743 )
1744 if err != nil {
1745 return ServerThreadCount{noop.Int64UpDownCounter{}}, err
1746 }
1747 return ServerThreadCount{i}, nil
1748 }
1749
1750 // Inst returns the underlying metric instrument.
1751 func (m ServerThreadCount) Inst() metric.Int64UpDownCounter {
1752 return m.Int64UpDownCounter
1753 }
1754
1755 // Name returns the semantic convention name of the instrument.
1756 func (ServerThreadCount) Name() string {
1757 return "nfs.server.thread.count"
1758 }
1759
1760 // Unit returns the semantic convention unit of the instrument
1761 func (ServerThreadCount) Unit() string {
1762 return "{thread}"
1763 }
1764
1765 // Description returns the semantic convention description of the instrument
1766 func (ServerThreadCount) Description() string {
1767 return "Reports the count of kernel NFS server available threads."
1768 }
1769
1770 // Add adds incr to the existing count for attrs.
1771 //
1772 // Linux: this metric is taken from the Linux kernel nfsd_th_cnt variable
1773 func (m ServerThreadCount) Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) {
1774 if len(attrs) == 0 {
1775 m.Int64UpDownCounter.Add(ctx, incr)
1776 return
1777 }
1778
1779 o := addOptPool.Get().(*[]metric.AddOption)
1780 defer func() {
1781 *o = (*o)[:0]
1782 addOptPool.Put(o)
1783 }()
1784
1785 *o = append(*o, metric.WithAttributes(attrs...))
1786 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1787 }
1788
1789 // AddSet adds incr to the existing count for set.
1790 //
1791 // Linux: this metric is taken from the Linux kernel nfsd_th_cnt variable
1792 func (m ServerThreadCount) AddSet(ctx context.Context, incr int64, set attribute.Set) {
1793 if set.Len() == 0 {
1794 m.Int64UpDownCounter.Add(ctx, incr)
1795 return
1796 }
1797
1798 o := addOptPool.Get().(*[]metric.AddOption)
1799 defer func() {
1800 *o = (*o)[:0]
1801 addOptPool.Put(o)
1802 }()
1803
1804 *o = append(*o, metric.WithAttributeSet(set))
1805 m.Int64UpDownCounter.Add(ctx, incr, *o...)
1806 }