Good Evening, I need to export the data in json fo...
# support
m
Good Evening, I need to export the data in json format from the collector...it has to be exported to http end point. Here is my configuration: otlp/http: endpoint: http://example.com/deeptrace But it is expecting the port number: Exporting failed. Will retry the request after interval. {"kind": "exporter", "name": "otlp/http", "error": "rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: address example.com/deeptrace: missing port in address\"", "interval": "3.358221818s"} Please let me know how to export the data in Json format.
s
The endpoint needs to be somethnig like this https://example.com:4318 for HTTP
m
Able to export the data to the below custom path..but data is reaching the target as follows. How to handle this ? Is the data coming like this becoz of custom path ? example.com/deeptrace Key -> None, Value -> b'{"ngo_log_type":"30","received_time":"2022-07-19T150336+0530","message":"\\n\xef\xbf\xbd\\u000F\\n\xef\xbf\xbd\\u0002\\n\\"\\n\\u0016telemetry.sdk.language\\u0012\\b\\n\\u0006python\\n%\\n\\u0012telemetry.sdk.name\\u0012\\u000F\\n\\ropentelemetry\\n!\\n\\u0015telemetry.sdk.version\\u0012\\b\\n\\u00061.10.0\\n\\u001E\\n\\fservice.name\\u0012\\u000E\\n\\fNGINXtestAPI\\n\\u001C\\n\\u0010application.name\\u0012\\b\\n\\u0006pocOTL\\n\\u0019\\n\\u0010environment.name\\u0012\\u0005\\n\\u0003Dev\\n\\u0017\\n\\btoken.id\\u0012\\u000B\\n\\ttoken2100\\n\\"\\n\\u0016telemetry.auto.version\\u0012\\b\\n\\u00060.29b0\\u0012\xef\xbf\xbd\\r\\n,\\n\\"opentelemetry.instrumentation.asgi\\u0012\\u00060.29b0\\u0012\xef\xbf\xbd\\u0001\\n\\u0010\xef\xbf\xbd_\xef\xbf\xbd\\u000B\xef\xbf\xbd6\xef\xbf\xbd\\u0018Q\xcf\x97/l\'\xef\xbf\xbd\xef\xbf\xbd\\u0012\\b\xef\xbf\xbdY\xef\xbf\xbd\xef\xbf\xbd\\u0014\xef\xbf\xbd|\xef\xbf\xbd\\"\\bV\xef\xbf\xbdQ\\u0016\xef\xbf\xbd8\\u001F\xef\xbf\xbd*\\u001A/items/{item_id} http Data before export: Resource SchemaURL: Resource labels: telemetry.sdk.language: STRING(python) telemetry.sdk.name: STRING(opentelemetry) telemetry.sdk.version: STRING(1.10.0) service.name: STRING(NGINXtestAPI) application.name: STRING(pocOTL) environment.name: STRING(Dev) token.id: STRING(token2100) telemetry.auto.version: STRING(0.29b0) InstrumentationLibrarySpans #0 InstrumentationLibraryMetrics SchemaURL: InstrumentationLibrary opentelemetry.instrumentation.asgi 0.29b0 Span #0 Trace ID : 0a9f0ac030b0f2ec630798f7514224f7 Parent ID : 148b60d17ad47fb0 ID : 2ef16279086619f1 Name : /items/{item_id} http send Kind : SPAN_KIND_INTERNAL Start time : 2022-07-19 063834.42840192 +0000 UTC End time : 2022-07-19 063834.429474048 +0000 UTC Status code : STATUS_CODE_UNSET Status message : Attributes: http.status_code: INT(200) type: STRING(http.response.start)
s
It's binary encoded protobuf. You are not using the json encoding.
m
How to export it as text format protobuf ?
s
You would use protobuf lib to deser the received data https://pkg.go.dev/google.golang.org/protobuf@v1.28.0/encoding/prototext. And this might be helpful too https://github.com/open-telemetry/opentelemetry-proto-go
m
THanks Srikanth! Instead of converting it like this, can I export it as text format protobuf from the collector ?
s
I am not sure what do you mean by that. The telemetry data is either binary or json encoded protobuf. You receiver has to deser it work with it.
m
ok. Let me check json export
I tried with the below configuration for json export but it is not able to connect. Pls help otlp/http: endpoint: http://x.x.x.x:8081 compression: none tls: insecure: true zapgrpc/zapgrpc.go:174 [transport] transport: loopyWriter.run returning. connection error: desc = "transport is closing" {"grpc_log": true}