opentelemetry-rust
opentelemetry-rust copied to clipboard
OTLP Exporter with http/json is not working
See : https://github.com/open-telemetry/opentelemetry-rust/pull/1752#issuecomment-2109116504
@ramgdev Would you be able to look at this?
Tried reproducing this with the code form main. I am getting an error
OpenTelemetry metrics error occurred. Metrics error: metrics provider already shut down
@TommyCpp does the example at opentelemetry-otlp/examples/basic-otlp-http require any other setup besides an otlp receiver & exporter?
If I enable http-json in opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml, it then shows an additional error. I'll focus on this error first.
OpenTelemetry metrics error occurred. Metrics error: metrics provider already shut down
OpenTelemetry trace error occurred. HTTP status client error (400 Bad Request) for url (http://localhost:4318/v1/traces)
Payload:
{
"resourceSpans": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-example"
}
}
],
"droppedAttributesCount": 0
},
"scopeSpans": [
{
"scope": {
"name": "basic",
"version": "",
"attributes": [
{
"key": "scope-key",
"value": {
"stringValue": "scope-value"
}
}
],
"droppedAttributesCount": 0
},
"spans": [
{
"traceId": "4de8342687b6356073ec26a181b0126c",
"spanId": "6cdde1503ab13747",
"traceState": "",
"parentSpanId": "7d7d136175a259eb",
"flags": 1,
"name": "Sub operation...",
"kind": 1,
"startTimeUnixNano": "1716776846360076000",
"endTimeUnixNano": "1716776846360082000",
"attributes": [
{
"key": "another.key",
"value": {
"stringValue": "yes"
}
}
],
"droppedAttributesCount": 0,
"events": [
{
"timeUnixNano": "1716776846360080000",
"name": "Sub span event",
"attributes": [],
"droppedAttributesCount": 0
}
],
"droppedEventsCount": 0,
"links": [],
"droppedLinksCount": 0,
"status": {
"message": "",
"code": 0
}
}
],
"schemaUrl": ""
}
],
"schemaUrl": ""
},
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-example"
}
}
],
"droppedAttributesCount": 0
},
"scopeSpans": [
{
"scope": {
"name": "basic",
"version": "",
"attributes": [
{
"key": "scope-key",
"value": {
"stringValue": "scope-value"
}
}
],
"droppedAttributesCount": 0
},
"spans": [
{
"traceId": "4de8342687b6356073ec26a181b0126c",
"spanId": "7d7d136175a259eb",
"traceState": "",
"parentSpanId": "",
"flags": 1,
"name": "Main operation",
"kind": 1,
"startTimeUnixNano": "1716776846359907000",
"endTimeUnixNano": "1716776846360086000",
"attributes": [
{
"key": "another.key",
"value": {
"stringValue": "yes"
}
}
],
"droppedAttributesCount": 0,
"events": [
{
"timeUnixNano": "1716776846359911000",
"name": "Nice operation!",
"attributes": [
{
"key": "bogons",
"value": "100"
}
],
"droppedAttributesCount": 0
}
],
"droppedEventsCount": 0,
"links": [],
"droppedLinksCount": 0,
"status": {
"message": "",
"code": 0
}
}
],
"schemaUrl": ""
}
],
"schemaUrl": ""
}
]
}
Response indicates an encoding error.
{"code":3,"message":"ReadObjectCB: expect { or n, but found \", error found in #10 byte of ...|\"value\": \"100\"\n |..., bigger context ...| \"key\": \"bogons\",\n \"value\": \"100\"\n }\n ],\n |..."}