Open andrzej-stencel opened 1 month ago
Pinging code owners:
connector/otlpjson: @djaglowski @ChrsMark
See Adding Labels via Comments if you do not have permissions to add labels yourself.
Doesn't this fall into the same category with what the https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35738 describes?
A ptrace given as an input to metrics' unmarshaller is an "invalid" otlp similar to what a very random JSON would be 🤔 .
Component(s)
connector/otlpjson
What happened?
Description
The OTLP/JSON connector reports errors on invalid JSON, but silently ignores valid JSON that is not valid OTLP. I would expect it to also error out on valid JSON that is not valid OTLP. As another enhancement, an
error_mode
option could be added for users to configure the behavior.Steps to Reproduce
Prepare a newline-delimited JSON file like the below non-otlp.json file:
Run the collector with the below configuration, reading the file with Filelog receiver and passing it to OTLP/JSON connector and to Debug exporter.
Expected Result
The OTLP/JSON connector rejects the input lines, outputting an error message saying that the input is not valid OTLP.
Actual Result
The connector does not report any errors. It emits an empty batch for each invalid OTLP line (see related issue https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35738).
Collector version
v0.111.0
Environment information
Environment
OS: Ubuntu 24.04
OpenTelemetry Collector configuration
Log output
Additional context
The
Unmarshal(Logs|Metrics|Traces)
methods do not return an error for valid JSON that is not a valid OTLP payload. They just return an empty object of logs/metrics/traces data. See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.111.0/connector/otlpjsonconnector/traces.go#L55 for example.