Skip to content

[golang] encoding OTAP Logs adds empty trace_id & span_id columns to record batch #621

Open
@albertlockett

Description

@albertlockett
import(
	"go.opentelemetry.io/collector/pdata/plog"
	"github.com/open-telemetry/otel-arrow/pkg/otel/arrow_record"
)

// ...

logs := plog.NewLogs()
resourceLogs := logs.ResourceLogs().AppendEmpty()
scopeLogs := resourceLogs.ScopeLogs().AppendEmpty()
_ = scopeLogs.LogRecords().AppendEmpty()

producer := arrow_record.NewProducer()
bar, err := producer.BatchArrowRecordsFromLogs(logs)

This produces a single record batch with the following content:

| resource | scope   | time_unix_nano       | observed_time_unix_nano | trace_id                         | span_id          |
+----------+---------+----------------------+-------------------------+----------------------------------+------------------+
| {id: 0}  | {id: 0} | 1970-01-01T00:00:00Z | 1970-01-01T00:00:00Z    | 00000000000000000000000000000000 | 0000000000000000 |
+----------+---------+----------------------+-------------------------+----------------------------------+------------------+

I'm thinking it was probably not intentional that we add the trace_id & span_id columns to the record batch, especially considering in the schema metadata we mark them as optional columns:

{Name: constants.TraceId, Type: &arrow.FixedSizeBinaryType{ByteWidth: 16}, Metadata: schema.Metadata(schema.Optional, schema.Dictionary8)},
{Name: constants.SpanId, Type: &arrow.FixedSizeBinaryType{ByteWidth: 8}, Metadata: schema.Metadata(schema.Optional, schema.Dictionary8)},

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggoPull requests that update go code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions