Open spencergilbert opened 2 years ago
Nothing conclusive, but in case it helps, I wrote a small program using pdata (the module the Collector uses)
package main
import (
"encoding/json"
"fmt"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog/plogotlp"
)
func main() {
arrayVal := pcommon.NewValueSlice()
slice := pcommon.NewSliceFromRaw([]any{"string", 42, true})
slice.CopyTo(arrayVal.SliceVal())
request := plogotlp.NewRequest()
arrayVal.CopyTo(
request.Logs().ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty().Body())
bytes, err := json.MarshalIndent(request, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(bytes))
}
It prints
{
"resourceLogs": [
{
"resource": {},
"scopeLogs": [
{
"scope": {},
"logRecords": [
{
"body": {
"arrayValue": {
"values": [
{
"stringValue": "string"
},
{
"intValue": "42"
},
{
"boolValue": true
}
]
}
},
"traceId": "",
"spanId": ""
}
]
}
]
}
]
}
Reading the spec I am not sure if both camel case and snake case should be supported (spec just says 'whatever proto3 does'). There are other differences (resource, traceID, spanID), not sure if those are relevant either
When running the otel-col and vector locally with the following configs...
opentelemetry-collector:
vector:
Curling this input to the collector results in dropped values from the
body
, this behavior is seen both in Vector and thelogging
exporter from the otel-collector.Input:
Output: