@@ -21,6 +21,7 @@ import (
21
21
"go.opentelemetry.io/collector/pdata/ptrace"
22
22
semconv "go.opentelemetry.io/collector/semconv/v1.22.0"
23
23
24
+ "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter/internal/elasticsearch"
24
25
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter/internal/exphistogram"
25
26
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter/internal/objmodel"
26
27
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/traceutil"
@@ -101,7 +102,7 @@ type dataPoint interface {
101
102
Value () (pcommon.Value , error )
102
103
DynamicTemplate (pmetric.Metric ) string
103
104
DocCount () uint64
104
- HasMappingHint (mappingHint ) bool
105
+ HasMappingHint (elasticsearch. MappingHint ) bool
105
106
Metric () pmetric.Metric
106
107
}
107
108
@@ -263,12 +264,12 @@ func (m *encodeModel) encodeMetrics(resource pcommon.Resource, resourceSchemaURL
263
264
264
265
type summaryDataPoint struct {
265
266
pmetric.SummaryDataPoint
266
- mappingHintGetter
267
+ elasticsearch. MappingHintGetter
267
268
metric pmetric.Metric
268
269
}
269
270
270
271
func newSummaryDataPoint (metric pmetric.Metric , dp pmetric.SummaryDataPoint ) summaryDataPoint {
271
- return summaryDataPoint {SummaryDataPoint : dp , mappingHintGetter : newMappingHintGetter (dp .Attributes ()), metric : metric }
272
+ return summaryDataPoint {SummaryDataPoint : dp , MappingHintGetter : elasticsearch . NewMappingHintGetter (dp .Attributes ()), metric : metric }
272
273
}
273
274
274
275
func (dp summaryDataPoint ) Value () (pcommon.Value , error ) {
@@ -295,16 +296,16 @@ func (dp summaryDataPoint) Metric() pmetric.Metric {
295
296
296
297
type exponentialHistogramDataPoint struct {
297
298
pmetric.ExponentialHistogramDataPoint
298
- mappingHintGetter
299
+ elasticsearch. MappingHintGetter
299
300
metric pmetric.Metric
300
301
}
301
302
302
303
func newExponentialHistogramDataPoint (metric pmetric.Metric , dp pmetric.ExponentialHistogramDataPoint ) exponentialHistogramDataPoint {
303
- return exponentialHistogramDataPoint {ExponentialHistogramDataPoint : dp , mappingHintGetter : newMappingHintGetter (dp .Attributes ()), metric : metric }
304
+ return exponentialHistogramDataPoint {ExponentialHistogramDataPoint : dp , MappingHintGetter : elasticsearch . NewMappingHintGetter (dp .Attributes ()), metric : metric }
304
305
}
305
306
306
307
func (dp exponentialHistogramDataPoint ) Value () (pcommon.Value , error ) {
307
- if dp .HasMappingHint (hintAggregateMetricDouble ) {
308
+ if dp .HasMappingHint (elasticsearch . HintAggregateMetricDouble ) {
308
309
vm := pcommon .NewValueMap ()
309
310
m := vm .Map ()
310
311
m .PutDouble ("sum" , dp .Sum ())
@@ -331,7 +332,7 @@ func (dp exponentialHistogramDataPoint) Value() (pcommon.Value, error) {
331
332
}
332
333
333
334
func (dp exponentialHistogramDataPoint ) DynamicTemplate (_ pmetric.Metric ) string {
334
- if dp .HasMappingHint (hintAggregateMetricDouble ) {
335
+ if dp .HasMappingHint (elasticsearch . HintAggregateMetricDouble ) {
335
336
return "summary"
336
337
}
337
338
return "histogram"
@@ -347,16 +348,16 @@ func (dp exponentialHistogramDataPoint) Metric() pmetric.Metric {
347
348
348
349
type histogramDataPoint struct {
349
350
pmetric.HistogramDataPoint
350
- mappingHintGetter
351
+ elasticsearch. MappingHintGetter
351
352
metric pmetric.Metric
352
353
}
353
354
354
355
func newHistogramDataPoint (metric pmetric.Metric , dp pmetric.HistogramDataPoint ) histogramDataPoint {
355
- return histogramDataPoint {HistogramDataPoint : dp , mappingHintGetter : newMappingHintGetter (dp .Attributes ()), metric : metric }
356
+ return histogramDataPoint {HistogramDataPoint : dp , MappingHintGetter : elasticsearch . NewMappingHintGetter (dp .Attributes ()), metric : metric }
356
357
}
357
358
358
359
func (dp histogramDataPoint ) Value () (pcommon.Value , error ) {
359
- if dp .HasMappingHint (hintAggregateMetricDouble ) {
360
+ if dp .HasMappingHint (elasticsearch . HintAggregateMetricDouble ) {
360
361
vm := pcommon .NewValueMap ()
361
362
m := vm .Map ()
362
363
m .PutDouble ("sum" , dp .Sum ())
@@ -367,7 +368,7 @@ func (dp histogramDataPoint) Value() (pcommon.Value, error) {
367
368
}
368
369
369
370
func (dp histogramDataPoint ) DynamicTemplate (_ pmetric.Metric ) string {
370
- if dp .HasMappingHint (hintAggregateMetricDouble ) {
371
+ if dp .HasMappingHint (elasticsearch . HintAggregateMetricDouble ) {
371
372
return "summary"
372
373
}
373
374
return "histogram"
@@ -431,12 +432,12 @@ func histogramToValue(dp pmetric.HistogramDataPoint) (pcommon.Value, error) {
431
432
432
433
type numberDataPoint struct {
433
434
pmetric.NumberDataPoint
434
- mappingHintGetter
435
+ elasticsearch. MappingHintGetter
435
436
metric pmetric.Metric
436
437
}
437
438
438
439
func newNumberDataPoint (metric pmetric.Metric , dp pmetric.NumberDataPoint ) numberDataPoint {
439
- return numberDataPoint {NumberDataPoint : dp , mappingHintGetter : newMappingHintGetter (dp .Attributes ()), metric : metric }
440
+ return numberDataPoint {NumberDataPoint : dp , MappingHintGetter : elasticsearch . NewMappingHintGetter (dp .Attributes ()), metric : metric }
440
441
}
441
442
442
443
func (dp numberDataPoint ) Value () (pcommon.Value , error ) {
@@ -724,7 +725,7 @@ func metricOTelHash(dp dataPoint, unit string) uint32 {
724
725
725
726
hasher .Write ([]byte (unit ))
726
727
727
- mapHashExcludeReservedAttrs (hasher , dp .Attributes (), mappingHintsAttrKey )
728
+ mapHashExcludeReservedAttrs (hasher , dp .Attributes (), elasticsearch . MappingHintsAttrKey )
728
729
729
730
return hasher .Sum32 ()
730
731
}
0 commit comments