Skip to content

batchprocessor doesn't always set SchemaUrl #12279

@asweet-confluent

Description

@asweet-confluent

Describe the bug

In certain edge cases, the batch processor doesn't set the SchemaUrl field in traces. I believe this also reproduces with metrics and logs.

Steps to reproduce

grpcurl -plaintext -d '{
  "resourceSpans": [
    {
      "resource": {},
      "scopeSpans": [
        {
          "scope": {},
          "spans": [
            { "traceId": "", "spanId": "", "parentSpanId": "", "status": {} }
          ]
        },
        {
          "scope": {},
          "spans": [
            { "traceId": "", "spanId": "", "parentSpanId": "", "status": {} }
          ]
        }
      ],
      "schemaUrl": "https://test-resource-schema-url.com/"
    }
  ]
}
'  -proto opentelemetry/proto/collector/trace/v1/trace_service.proto localhost:4317 'opentelemetry.proto.collector.trace.v1.TraceService/Export'

What did you expect to see?

2025-02-04T12:04:28.414-0800    info    TracesExporter  {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2025-02-04T12:04:28.414-0800    info    ResourceSpans #0
Resource SchemaURL: https://test-resource-schema-url.com/
ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope  
Span #0
    Trace ID       : 
    Parent ID      : 
    ID             : 
    Name           : 
    Kind           : Unspecified
    Start time     : 1970-01-01 00:00:00 +0000 UTC
    End time       : 1970-01-01 00:00:00 +0000 UTC
    Status code    : Unset
    Status message : 
        {"kind": "exporter", "data_type": "traces", "name": "debug"}
2025-02-04T12:04:28.414-0800    info    TracesExporter  {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2025-02-04T12:04:28.414-0800    info    ResourceSpans #0
Resource SchemaURL: https://test-resource-schema-url.com/
ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope  
Span #0
    Trace ID       : 
    Parent ID      : 
    ID             : 
    Name           : 
    Kind           : Unspecified
    Start time     : 1970-01-01 00:00:00 +0000 UTC
    End time       : 1970-01-01 00:00:00 +0000 UTC
    Status code    : Unset
    Status message : 
        {"kind": "exporter", "data_type": "traces", "name": "debug"}

What did you see instead?

2025-02-04T12:04:28.414-0800    info    TracesExporter  {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2025-02-04T12:04:28.414-0800    info    ResourceSpans #0
Resource SchemaURL: 
ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope  
Span #0
    Trace ID       : 
    Parent ID      : 
    ID             : 
    Name           : 
    Kind           : Unspecified
    Start time     : 1970-01-01 00:00:00 +0000 UTC
    End time       : 1970-01-01 00:00:00 +0000 UTC
    Status code    : Unset
    Status message : 
        {"kind": "exporter", "data_type": "traces", "name": "debug"}
2025-02-04T12:04:28.414-0800    info    TracesExporter  {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2025-02-04T12:04:28.414-0800    info    ResourceSpans #0
Resource SchemaURL: https://test-resource-schema-url.com/
ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope  
Span #0
    Trace ID       : 
    Parent ID      : 
    ID             : 
    Name           : 
    Kind           : Unspecified
    Start time     : 1970-01-01 00:00:00 +0000 UTC
    End time       : 1970-01-01 00:00:00 +0000 UTC
    Status code    : Unset
    Status message : 
        {"kind": "exporter", "data_type": "traces", "name": "debug"}

What version did you use?

v0.109.0

What config did you use?

receivers:
  otlp:
    protocols:
      grpc:

processors:
  # Split each data point into a single message.
  batch/split:
    send_batch_max_size: 1
    timeout: 0
    send_batch_size: 0

exporters:
  debug:
    verbosity: detailed

service:
  telemetry:
    logs:
      level: info
      development: true
      encoding: console
  pipelines:
    metrics/split:
      receivers:
      - otlp
      processors:
      - batch/split
      exporters:
      - debug
    traces/split:
      receivers:
      - otlp
      processors:
      - batch/split
      exporters:
      - debug
    logs/split:
      receivers:
      - otlp
      processors:
      - batch/split
      exporters:
      - debug

Environment

Ubuntu 24.04.1 LTS
go version go1.23.1 linux/amd64

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions