Skip to content

OTLP JSON: injest traces with int fields #134

@vrutkovs

Description

@vrutkovs

Describe the bug

Some JSON payloads fail with:

requestURI: /insert/opentelemetry/v1/traces; cannot read OpenTelemetry protocol data: cannot unmarshal request from 2750 protobuf bytes: cannot unmarshal JSON request: json: invalid use of ,string struct tag, trying to unmarshal unquoted value into *int64

This is happening with the payload containing int types

To Reproduce

$ cat foo.json                  
{
    "resourceSpans": [
        {
            "resource": {
                "attributes": [
                    {
                        "key": "service.name",
                        "value": {
                            "stringValue": "test-service",
                            "intValue": 10
                        }
                    }
                ]
            },
            "scopeSpans": [
                {
                    "scope": {
                        "name": "test"
                    },
                    "spans": [
                        {
                            "traceId": "5b8efff798038103d269b633813fc60c",
                            "spanId": "eee19b7ec3c1b174",
                            "name": "test-span",
                            "kind": 1,
                            "startTimeUnixNano": "1775779200000000000",
                            "endTimeUnixNano": "1775779201000000000",
                            "status": {}
                        }
                    ]
                }
            ]
        }
    ]
}
$ curl \      
    -H "Content-Type: application/json" \
    -X POST https://vt.vrutkovs.eu/insert/opentelemetry/v1/traces \
    -d @foo.json

cannot read OpenTelemetry protocol data: cannot unmarshal request from 1043 protobuf bytes: cannot unmarshal JSON request: json: invalid use of ,string struct tag, trying to unmarshal unquoted value into *int64

Version

0.8.0

Logs

2026-04-10T10:54:48.083Z warn VictoriaTraces/app/vtinsert/opentelemetry/otlphttp.go:139 remoteAddr: "192.168.1.185:52000, X-Forwarded-For: 192.168.1.254"; requestURI: /insert/opentelemetry/v1/traces; cannot read OpenTelemetry protocol data: cannot unmarshal request from 1043 protobuf bytes: cannot unmarshal JSON request: json: invalid use of ,string struct tag, trying to unmarshal unquoted value into *int64

Screenshots

No response

Used command-line flags

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingvtinsert

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions