forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generated_metrics.go
6129 lines (5406 loc) · 254 KB
/
generated_metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by mdatagen. DO NOT EDIT.
package metadata
import (
"time"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/filter"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/receiver"
)
// AttributeCacheName specifies the a value cache_name attribute.
type AttributeCacheName int
const (
_ AttributeCacheName = iota
AttributeCacheNameFielddata
AttributeCacheNameQuery
)
// String returns the string representation of the AttributeCacheName.
func (av AttributeCacheName) String() string {
switch av {
case AttributeCacheNameFielddata:
return "fielddata"
case AttributeCacheNameQuery:
return "query"
}
return ""
}
// MapAttributeCacheName is a helper map of string to AttributeCacheName attribute value.
var MapAttributeCacheName = map[string]AttributeCacheName{
"fielddata": AttributeCacheNameFielddata,
"query": AttributeCacheNameQuery,
}
// AttributeClusterPublishedDifferenceState specifies the a value cluster_published_difference_state attribute.
type AttributeClusterPublishedDifferenceState int
const (
_ AttributeClusterPublishedDifferenceState = iota
AttributeClusterPublishedDifferenceStateIncompatible
AttributeClusterPublishedDifferenceStateCompatible
)
// String returns the string representation of the AttributeClusterPublishedDifferenceState.
func (av AttributeClusterPublishedDifferenceState) String() string {
switch av {
case AttributeClusterPublishedDifferenceStateIncompatible:
return "incompatible"
case AttributeClusterPublishedDifferenceStateCompatible:
return "compatible"
}
return ""
}
// MapAttributeClusterPublishedDifferenceState is a helper map of string to AttributeClusterPublishedDifferenceState attribute value.
var MapAttributeClusterPublishedDifferenceState = map[string]AttributeClusterPublishedDifferenceState{
"incompatible": AttributeClusterPublishedDifferenceStateIncompatible,
"compatible": AttributeClusterPublishedDifferenceStateCompatible,
}
// AttributeClusterStateQueueState specifies the a value cluster_state_queue_state attribute.
type AttributeClusterStateQueueState int
const (
_ AttributeClusterStateQueueState = iota
AttributeClusterStateQueueStatePending
AttributeClusterStateQueueStateCommitted
)
// String returns the string representation of the AttributeClusterStateQueueState.
func (av AttributeClusterStateQueueState) String() string {
switch av {
case AttributeClusterStateQueueStatePending:
return "pending"
case AttributeClusterStateQueueStateCommitted:
return "committed"
}
return ""
}
// MapAttributeClusterStateQueueState is a helper map of string to AttributeClusterStateQueueState attribute value.
var MapAttributeClusterStateQueueState = map[string]AttributeClusterStateQueueState{
"pending": AttributeClusterStateQueueStatePending,
"committed": AttributeClusterStateQueueStateCommitted,
}
// AttributeClusterStateUpdateType specifies the a value cluster_state_update_type attribute.
type AttributeClusterStateUpdateType int
const (
_ AttributeClusterStateUpdateType = iota
AttributeClusterStateUpdateTypeComputation
AttributeClusterStateUpdateTypeContextConstruction
AttributeClusterStateUpdateTypeCommit
AttributeClusterStateUpdateTypeCompletion
AttributeClusterStateUpdateTypeMasterApply
AttributeClusterStateUpdateTypeNotification
)
// String returns the string representation of the AttributeClusterStateUpdateType.
func (av AttributeClusterStateUpdateType) String() string {
switch av {
case AttributeClusterStateUpdateTypeComputation:
return "computation"
case AttributeClusterStateUpdateTypeContextConstruction:
return "context_construction"
case AttributeClusterStateUpdateTypeCommit:
return "commit"
case AttributeClusterStateUpdateTypeCompletion:
return "completion"
case AttributeClusterStateUpdateTypeMasterApply:
return "master_apply"
case AttributeClusterStateUpdateTypeNotification:
return "notification"
}
return ""
}
// MapAttributeClusterStateUpdateType is a helper map of string to AttributeClusterStateUpdateType attribute value.
var MapAttributeClusterStateUpdateType = map[string]AttributeClusterStateUpdateType{
"computation": AttributeClusterStateUpdateTypeComputation,
"context_construction": AttributeClusterStateUpdateTypeContextConstruction,
"commit": AttributeClusterStateUpdateTypeCommit,
"completion": AttributeClusterStateUpdateTypeCompletion,
"master_apply": AttributeClusterStateUpdateTypeMasterApply,
"notification": AttributeClusterStateUpdateTypeNotification,
}
// AttributeDirection specifies the a value direction attribute.
type AttributeDirection int
const (
_ AttributeDirection = iota
AttributeDirectionReceived
AttributeDirectionSent
)
// String returns the string representation of the AttributeDirection.
func (av AttributeDirection) String() string {
switch av {
case AttributeDirectionReceived:
return "received"
case AttributeDirectionSent:
return "sent"
}
return ""
}
// MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
var MapAttributeDirection = map[string]AttributeDirection{
"received": AttributeDirectionReceived,
"sent": AttributeDirectionSent,
}
// AttributeDocumentState specifies the a value document_state attribute.
type AttributeDocumentState int
const (
_ AttributeDocumentState = iota
AttributeDocumentStateActive
AttributeDocumentStateDeleted
)
// String returns the string representation of the AttributeDocumentState.
func (av AttributeDocumentState) String() string {
switch av {
case AttributeDocumentStateActive:
return "active"
case AttributeDocumentStateDeleted:
return "deleted"
}
return ""
}
// MapAttributeDocumentState is a helper map of string to AttributeDocumentState attribute value.
var MapAttributeDocumentState = map[string]AttributeDocumentState{
"active": AttributeDocumentStateActive,
"deleted": AttributeDocumentStateDeleted,
}
// AttributeGetResult specifies the a value get_result attribute.
type AttributeGetResult int
const (
_ AttributeGetResult = iota
AttributeGetResultHit
AttributeGetResultMiss
)
// String returns the string representation of the AttributeGetResult.
func (av AttributeGetResult) String() string {
switch av {
case AttributeGetResultHit:
return "hit"
case AttributeGetResultMiss:
return "miss"
}
return ""
}
// MapAttributeGetResult is a helper map of string to AttributeGetResult attribute value.
var MapAttributeGetResult = map[string]AttributeGetResult{
"hit": AttributeGetResultHit,
"miss": AttributeGetResultMiss,
}
// AttributeHealthStatus specifies the a value health_status attribute.
type AttributeHealthStatus int
const (
_ AttributeHealthStatus = iota
AttributeHealthStatusGreen
AttributeHealthStatusYellow
AttributeHealthStatusRed
)
// String returns the string representation of the AttributeHealthStatus.
func (av AttributeHealthStatus) String() string {
switch av {
case AttributeHealthStatusGreen:
return "green"
case AttributeHealthStatusYellow:
return "yellow"
case AttributeHealthStatusRed:
return "red"
}
return ""
}
// MapAttributeHealthStatus is a helper map of string to AttributeHealthStatus attribute value.
var MapAttributeHealthStatus = map[string]AttributeHealthStatus{
"green": AttributeHealthStatusGreen,
"yellow": AttributeHealthStatusYellow,
"red": AttributeHealthStatusRed,
}
// AttributeIndexAggregationType specifies the a value index_aggregation_type attribute.
type AttributeIndexAggregationType int
const (
_ AttributeIndexAggregationType = iota
AttributeIndexAggregationTypePrimaryShards
AttributeIndexAggregationTypeTotal
)
// String returns the string representation of the AttributeIndexAggregationType.
func (av AttributeIndexAggregationType) String() string {
switch av {
case AttributeIndexAggregationTypePrimaryShards:
return "primary_shards"
case AttributeIndexAggregationTypeTotal:
return "total"
}
return ""
}
// MapAttributeIndexAggregationType is a helper map of string to AttributeIndexAggregationType attribute value.
var MapAttributeIndexAggregationType = map[string]AttributeIndexAggregationType{
"primary_shards": AttributeIndexAggregationTypePrimaryShards,
"total": AttributeIndexAggregationTypeTotal,
}
// AttributeIndexingPressureStage specifies the a value indexing_pressure_stage attribute.
type AttributeIndexingPressureStage int
const (
_ AttributeIndexingPressureStage = iota
AttributeIndexingPressureStageCoordinating
AttributeIndexingPressureStagePrimary
AttributeIndexingPressureStageReplica
)
// String returns the string representation of the AttributeIndexingPressureStage.
func (av AttributeIndexingPressureStage) String() string {
switch av {
case AttributeIndexingPressureStageCoordinating:
return "coordinating"
case AttributeIndexingPressureStagePrimary:
return "primary"
case AttributeIndexingPressureStageReplica:
return "replica"
}
return ""
}
// MapAttributeIndexingPressureStage is a helper map of string to AttributeIndexingPressureStage attribute value.
var MapAttributeIndexingPressureStage = map[string]AttributeIndexingPressureStage{
"coordinating": AttributeIndexingPressureStageCoordinating,
"primary": AttributeIndexingPressureStagePrimary,
"replica": AttributeIndexingPressureStageReplica,
}
// AttributeMemoryState specifies the a value memory_state attribute.
type AttributeMemoryState int
const (
_ AttributeMemoryState = iota
AttributeMemoryStateFree
AttributeMemoryStateUsed
)
// String returns the string representation of the AttributeMemoryState.
func (av AttributeMemoryState) String() string {
switch av {
case AttributeMemoryStateFree:
return "free"
case AttributeMemoryStateUsed:
return "used"
}
return ""
}
// MapAttributeMemoryState is a helper map of string to AttributeMemoryState attribute value.
var MapAttributeMemoryState = map[string]AttributeMemoryState{
"free": AttributeMemoryStateFree,
"used": AttributeMemoryStateUsed,
}
// AttributeOperation specifies the a value operation attribute.
type AttributeOperation int
const (
_ AttributeOperation = iota
AttributeOperationIndex
AttributeOperationDelete
AttributeOperationGet
AttributeOperationQuery
AttributeOperationFetch
AttributeOperationScroll
AttributeOperationSuggest
AttributeOperationMerge
AttributeOperationRefresh
AttributeOperationFlush
AttributeOperationWarmer
)
// String returns the string representation of the AttributeOperation.
func (av AttributeOperation) String() string {
switch av {
case AttributeOperationIndex:
return "index"
case AttributeOperationDelete:
return "delete"
case AttributeOperationGet:
return "get"
case AttributeOperationQuery:
return "query"
case AttributeOperationFetch:
return "fetch"
case AttributeOperationScroll:
return "scroll"
case AttributeOperationSuggest:
return "suggest"
case AttributeOperationMerge:
return "merge"
case AttributeOperationRefresh:
return "refresh"
case AttributeOperationFlush:
return "flush"
case AttributeOperationWarmer:
return "warmer"
}
return ""
}
// MapAttributeOperation is a helper map of string to AttributeOperation attribute value.
var MapAttributeOperation = map[string]AttributeOperation{
"index": AttributeOperationIndex,
"delete": AttributeOperationDelete,
"get": AttributeOperationGet,
"query": AttributeOperationQuery,
"fetch": AttributeOperationFetch,
"scroll": AttributeOperationScroll,
"suggest": AttributeOperationSuggest,
"merge": AttributeOperationMerge,
"refresh": AttributeOperationRefresh,
"flush": AttributeOperationFlush,
"warmer": AttributeOperationWarmer,
}
// AttributeQueryCacheCountType specifies the a value query_cache_count_type attribute.
type AttributeQueryCacheCountType int
const (
_ AttributeQueryCacheCountType = iota
AttributeQueryCacheCountTypeHit
AttributeQueryCacheCountTypeMiss
)
// String returns the string representation of the AttributeQueryCacheCountType.
func (av AttributeQueryCacheCountType) String() string {
switch av {
case AttributeQueryCacheCountTypeHit:
return "hit"
case AttributeQueryCacheCountTypeMiss:
return "miss"
}
return ""
}
// MapAttributeQueryCacheCountType is a helper map of string to AttributeQueryCacheCountType attribute value.
var MapAttributeQueryCacheCountType = map[string]AttributeQueryCacheCountType{
"hit": AttributeQueryCacheCountTypeHit,
"miss": AttributeQueryCacheCountTypeMiss,
}
// AttributeSegmentsMemoryObjectType specifies the a value segments_memory_object_type attribute.
type AttributeSegmentsMemoryObjectType int
const (
_ AttributeSegmentsMemoryObjectType = iota
AttributeSegmentsMemoryObjectTypeTerm
AttributeSegmentsMemoryObjectTypeDocValue
AttributeSegmentsMemoryObjectTypeIndexWriter
AttributeSegmentsMemoryObjectTypeFixedBitSet
)
// String returns the string representation of the AttributeSegmentsMemoryObjectType.
func (av AttributeSegmentsMemoryObjectType) String() string {
switch av {
case AttributeSegmentsMemoryObjectTypeTerm:
return "term"
case AttributeSegmentsMemoryObjectTypeDocValue:
return "doc_value"
case AttributeSegmentsMemoryObjectTypeIndexWriter:
return "index_writer"
case AttributeSegmentsMemoryObjectTypeFixedBitSet:
return "fixed_bit_set"
}
return ""
}
// MapAttributeSegmentsMemoryObjectType is a helper map of string to AttributeSegmentsMemoryObjectType attribute value.
var MapAttributeSegmentsMemoryObjectType = map[string]AttributeSegmentsMemoryObjectType{
"term": AttributeSegmentsMemoryObjectTypeTerm,
"doc_value": AttributeSegmentsMemoryObjectTypeDocValue,
"index_writer": AttributeSegmentsMemoryObjectTypeIndexWriter,
"fixed_bit_set": AttributeSegmentsMemoryObjectTypeFixedBitSet,
}
// AttributeShardState specifies the a value shard_state attribute.
type AttributeShardState int
const (
_ AttributeShardState = iota
AttributeShardStateActive
AttributeShardStateActivePrimary
AttributeShardStateRelocating
AttributeShardStateInitializing
AttributeShardStateUnassigned
AttributeShardStateUnassignedDelayed
)
// String returns the string representation of the AttributeShardState.
func (av AttributeShardState) String() string {
switch av {
case AttributeShardStateActive:
return "active"
case AttributeShardStateActivePrimary:
return "active_primary"
case AttributeShardStateRelocating:
return "relocating"
case AttributeShardStateInitializing:
return "initializing"
case AttributeShardStateUnassigned:
return "unassigned"
case AttributeShardStateUnassignedDelayed:
return "unassigned_delayed"
}
return ""
}
// MapAttributeShardState is a helper map of string to AttributeShardState attribute value.
var MapAttributeShardState = map[string]AttributeShardState{
"active": AttributeShardStateActive,
"active_primary": AttributeShardStateActivePrimary,
"relocating": AttributeShardStateRelocating,
"initializing": AttributeShardStateInitializing,
"unassigned": AttributeShardStateUnassigned,
"unassigned_delayed": AttributeShardStateUnassignedDelayed,
}
// AttributeTaskState specifies the a value task_state attribute.
type AttributeTaskState int
const (
_ AttributeTaskState = iota
AttributeTaskStateRejected
AttributeTaskStateCompleted
)
// String returns the string representation of the AttributeTaskState.
func (av AttributeTaskState) String() string {
switch av {
case AttributeTaskStateRejected:
return "rejected"
case AttributeTaskStateCompleted:
return "completed"
}
return ""
}
// MapAttributeTaskState is a helper map of string to AttributeTaskState attribute value.
var MapAttributeTaskState = map[string]AttributeTaskState{
"rejected": AttributeTaskStateRejected,
"completed": AttributeTaskStateCompleted,
}
// AttributeThreadState specifies the a value thread_state attribute.
type AttributeThreadState int
const (
_ AttributeThreadState = iota
AttributeThreadStateActive
AttributeThreadStateIdle
)
// String returns the string representation of the AttributeThreadState.
func (av AttributeThreadState) String() string {
switch av {
case AttributeThreadStateActive:
return "active"
case AttributeThreadStateIdle:
return "idle"
}
return ""
}
// MapAttributeThreadState is a helper map of string to AttributeThreadState attribute value.
var MapAttributeThreadState = map[string]AttributeThreadState{
"active": AttributeThreadStateActive,
"idle": AttributeThreadStateIdle,
}
type metricElasticsearchBreakerMemoryEstimated struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.breaker.memory.estimated metric with initial data.
func (m *metricElasticsearchBreakerMemoryEstimated) init() {
m.data.SetName("elasticsearch.breaker.memory.estimated")
m.data.SetDescription("Estimated memory used for the operation.")
m.data.SetUnit("By")
m.data.SetEmptyGauge()
m.data.Gauge().DataPoints().EnsureCapacity(m.capacity)
}
func (m *metricElasticsearchBreakerMemoryEstimated) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) {
if !m.config.Enabled {
return
}
dp := m.data.Gauge().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
dp.Attributes().PutStr("name", circuitBreakerNameAttributeValue)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchBreakerMemoryEstimated) updateCapacity() {
if m.data.Gauge().DataPoints().Len() > m.capacity {
m.capacity = m.data.Gauge().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchBreakerMemoryEstimated) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchBreakerMemoryEstimated(cfg MetricConfig) metricElasticsearchBreakerMemoryEstimated {
m := metricElasticsearchBreakerMemoryEstimated{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchBreakerMemoryLimit struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.breaker.memory.limit metric with initial data.
func (m *metricElasticsearchBreakerMemoryLimit) init() {
m.data.SetName("elasticsearch.breaker.memory.limit")
m.data.SetDescription("Memory limit for the circuit breaker.")
m.data.SetUnit("By")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
}
func (m *metricElasticsearchBreakerMemoryLimit) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
dp.Attributes().PutStr("name", circuitBreakerNameAttributeValue)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchBreakerMemoryLimit) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchBreakerMemoryLimit) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchBreakerMemoryLimit(cfg MetricConfig) metricElasticsearchBreakerMemoryLimit {
m := metricElasticsearchBreakerMemoryLimit{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchBreakerTripped struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.breaker.tripped metric with initial data.
func (m *metricElasticsearchBreakerTripped) init() {
m.data.SetName("elasticsearch.breaker.tripped")
m.data.SetDescription("Total number of times the circuit breaker has been triggered and prevented an out of memory error.")
m.data.SetUnit("1")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(true)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
}
func (m *metricElasticsearchBreakerTripped) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
dp.Attributes().PutStr("name", circuitBreakerNameAttributeValue)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchBreakerTripped) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchBreakerTripped) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchBreakerTripped(cfg MetricConfig) metricElasticsearchBreakerTripped {
m := metricElasticsearchBreakerTripped{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterDataNodes struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.data_nodes metric with initial data.
func (m *metricElasticsearchClusterDataNodes) init() {
m.data.SetName("elasticsearch.cluster.data_nodes")
m.data.SetDescription("The number of data nodes in the cluster.")
m.data.SetUnit("{nodes}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
}
func (m *metricElasticsearchClusterDataNodes) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterDataNodes) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterDataNodes) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterDataNodes(cfg MetricConfig) metricElasticsearchClusterDataNodes {
m := metricElasticsearchClusterDataNodes{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterHealth struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.health metric with initial data.
func (m *metricElasticsearchClusterHealth) init() {
m.data.SetName("elasticsearch.cluster.health")
m.data.SetDescription("The health status of the cluster.")
m.data.SetUnit("{status}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
}
func (m *metricElasticsearchClusterHealth) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, healthStatusAttributeValue string) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
dp.Attributes().PutStr("status", healthStatusAttributeValue)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterHealth) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterHealth) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterHealth(cfg MetricConfig) metricElasticsearchClusterHealth {
m := metricElasticsearchClusterHealth{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterInFlightFetch struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.in_flight_fetch metric with initial data.
func (m *metricElasticsearchClusterInFlightFetch) init() {
m.data.SetName("elasticsearch.cluster.in_flight_fetch")
m.data.SetDescription("The number of unfinished fetches.")
m.data.SetUnit("{fetches}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
}
func (m *metricElasticsearchClusterInFlightFetch) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterInFlightFetch) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterInFlightFetch) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterInFlightFetch(cfg MetricConfig) metricElasticsearchClusterInFlightFetch {
m := metricElasticsearchClusterInFlightFetch{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterIndicesCacheEvictions struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.indices.cache.evictions metric with initial data.
func (m *metricElasticsearchClusterIndicesCacheEvictions) init() {
m.data.SetName("elasticsearch.cluster.indices.cache.evictions")
m.data.SetDescription("The number of evictions from the cache for indices in cluster.")
m.data.SetUnit("{evictions}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(true)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
}
func (m *metricElasticsearchClusterIndicesCacheEvictions) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, cacheNameAttributeValue string) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
dp.Attributes().PutStr("cache_name", cacheNameAttributeValue)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterIndicesCacheEvictions) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterIndicesCacheEvictions) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterIndicesCacheEvictions(cfg MetricConfig) metricElasticsearchClusterIndicesCacheEvictions {
m := metricElasticsearchClusterIndicesCacheEvictions{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterNodes struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.nodes metric with initial data.
func (m *metricElasticsearchClusterNodes) init() {
m.data.SetName("elasticsearch.cluster.nodes")
m.data.SetDescription("The total number of nodes in the cluster.")
m.data.SetUnit("{nodes}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
}
func (m *metricElasticsearchClusterNodes) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterNodes) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterNodes) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterNodes(cfg MetricConfig) metricElasticsearchClusterNodes {
m := metricElasticsearchClusterNodes{config: cfg}
if cfg.Enabled {
m.data = pmetric.NewMetric()
m.init()
}
return m
}
type metricElasticsearchClusterPendingTasks struct {
data pmetric.Metric // data buffer for generated metric.
config MetricConfig // metric config provided by user.
capacity int // max observed number of data points added to the metric.
}
// init fills elasticsearch.cluster.pending_tasks metric with initial data.
func (m *metricElasticsearchClusterPendingTasks) init() {
m.data.SetName("elasticsearch.cluster.pending_tasks")
m.data.SetDescription("The number of cluster-level changes that have not yet been executed.")
m.data.SetUnit("{tasks}")
m.data.SetEmptySum()
m.data.Sum().SetIsMonotonic(false)
m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
}
func (m *metricElasticsearchClusterPendingTasks) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
if !m.config.Enabled {
return
}
dp := m.data.Sum().DataPoints().AppendEmpty()
dp.SetStartTimestamp(start)
dp.SetTimestamp(ts)
dp.SetIntValue(val)
}
// updateCapacity saves max length of data point slices that will be used for the slice capacity.
func (m *metricElasticsearchClusterPendingTasks) updateCapacity() {
if m.data.Sum().DataPoints().Len() > m.capacity {
m.capacity = m.data.Sum().DataPoints().Len()
}
}
// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
func (m *metricElasticsearchClusterPendingTasks) emit(metrics pmetric.MetricSlice) {
if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
m.updateCapacity()
m.data.MoveTo(metrics.AppendEmpty())
m.init()
}
}
func newMetricElasticsearchClusterPendingTasks(cfg MetricConfig) metricElasticsearchClusterPendingTasks {
m := metricElasticsearchClusterPendingTasks{config: cfg}