Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java OtlpHttpMetricExporter does not produce JSON formatted output #5598

Closed
prashanthr-sn opened this issue Jul 6, 2023 · 2 comments
Closed
Labels
Bug Something isn't working

Comments

@prashanthr-sn
Copy link

Describe the bug
Per the docs, setting environment variable OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or setting Java system property to "http/json" is supposed to produce JSON formatted output. However, neither of the settings produce JSON.

https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_metrics_protocol

https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md#otlp-exporter-span-metric-and-log-exporters

Steps to reproduce
Any instrumented program using OtlpHttpMetricExporter.builder()....build() and run with the environment variable or system property set as described. Upon running the output is still binary/protobuf and not JSON. The Content-Type remains application/x-protobuf

What did you expect to see?
JSON formatted output. The Content-Type from the client should be "application/json" (https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding)

What did you see instead?
Output was binary/protobuf format and not JSON. The Content-Type remains application/x-protobuf

What version and what artifacts are you using?
Artifacts: (e.g., opentelemetry-api, opentelemetry-sdk, which exporters, etc)
Version: (e.g., v0.4.0, 1eb551b, etc)
How did you reference these artifacts? (excerpt from your build.gradle, pom.xml, etc)

Environment
Compiler: Azul JDK 8
OS: Mac OS
Runtime (if different from JDK above): (e.g., "Oracle JRE 8u251")
OS (if different from OS compiled on): (e.g., "Windows Server 2019")

Additional context
Looking at


there is an exportAsJson(). But, the method is not public. Is it supposed to have been public?

The test class


also does not have any tests for "http/json", but only for "http/protobuf".
So.. is JSON output supported?

@prashanthr-sn prashanthr-sn added the Bug Something isn't working label Jul 6, 2023
@mateuszrzeszutek
Copy link
Member

Hey @prashanthr-sn ,

SDK support for the http/json format is optional:

SDKs SHOULD support both grpc and http/protobuf transports and MUST support at least one of them. If they support only one, it SHOULD be http/protobuf. They also MAY support http/json.

The Java SDK does not have the JSON exporter implemented. Here's some more history about that: #3651 #3486
I'm quite convinced we're not planning to implement it in the future -- ping @jack-berg to confirm.

@jack-berg
Copy link
Member

I'm quite convinced we're not planning to implement it in the future

I can confirm that it's not supported and we do not plan on implementing it. Closing this issue accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants