@@ -360,19 +360,18 @@ func (e *elasticsearchExporter) pushTraceData(
360
360
scopeSpans := il .ScopeSpans ()
361
361
for j := 0 ; j < scopeSpans .Len (); j ++ {
362
362
scopeSpan := scopeSpans .At (j )
363
- scope := scopeSpan .Scope ()
364
363
spans := scopeSpan .Spans ()
365
364
for k := 0 ; k < spans .Len (); k ++ {
366
365
span := spans .At (k )
367
- if err := e .pushTraceRecord (ctx , resource , il . SchemaUrl (), span , scope , scopeSpan . SchemaUrl () , session ); err != nil {
366
+ if err := e .pushTraceRecord (ctx , il , scopeSpan , span , session ); err != nil {
368
367
if cerr := ctx .Err (); cerr != nil {
369
368
return cerr
370
369
}
371
370
errs = append (errs , err )
372
371
}
373
372
for ii := 0 ; ii < span .Events ().Len (); ii ++ {
374
373
spanEvent := span .Events ().At (ii )
375
- if err := e .pushSpanEvent (ctx , resource , il .SchemaUrl (), span , spanEvent , scope , scopeSpan .SchemaUrl (), session ); err != nil {
374
+ if err := e .pushSpanEvent (ctx , resource , il .SchemaUrl (), span , spanEvent , scopeSpan . Scope () , scopeSpan .SchemaUrl (), session ); err != nil {
376
375
errs = append (errs , err )
377
376
}
378
377
}
@@ -391,16 +390,21 @@ func (e *elasticsearchExporter) pushTraceData(
391
390
392
391
func (e * elasticsearchExporter ) pushTraceRecord (
393
392
ctx context.Context ,
394
- resource pcommon. Resource ,
395
- resourceSchemaURL string ,
393
+ resourceSpans ptrace. ResourceSpans ,
394
+ scopeSpans ptrace. ScopeSpans ,
396
395
span ptrace.Span ,
397
- scope pcommon.InstrumentationScope ,
398
- scopeSchemaURL string ,
399
396
bulkIndexerSession bulkIndexerSession ,
400
397
) error {
401
398
fIndex := e .index
402
399
if e .dynamicIndex {
403
- fIndex = routeSpan (span .Attributes (), scope .Attributes (), resource .Attributes (), fIndex , e .otel , span .Name ())
400
+ fIndex = routeSpan (
401
+ span .Attributes (),
402
+ scopeSpans .Scope ().Attributes (),
403
+ resourceSpans .Resource ().Attributes (),
404
+ fIndex ,
405
+ e .otel ,
406
+ span .Name (),
407
+ )
404
408
}
405
409
406
410
if e .logstashFormat .Enabled {
@@ -411,7 +415,7 @@ func (e *elasticsearchExporter) pushTraceRecord(
411
415
fIndex = formattedIndex
412
416
}
413
417
414
- document , err := e .model .encodeSpan (resource , resourceSchemaURL , span , scope , scopeSchemaURL )
418
+ document , err := e .model .encodeSpan (resourceSpans , scopeSpans , span )
415
419
if err != nil {
416
420
return fmt .Errorf ("failed to encode trace record: %w" , err )
417
421
}
0 commit comments