-
Notifications
You must be signed in to change notification settings - Fork 858
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
Add a OTLP JSON span exporter to logs. #2295
Conversation
For reference, in official, the base64 encoding is hard coded inside this private method, so no go |
how "heavyweight" does it end up being? My only concern with replacing the existing logging exporter is how much users would be taking on to get it. |
@jkwatson I think ~4MB for byte-buddy + jackson. That's after I do some pruning since it's currently getting ~3MB of guava too due to a dependency on protobuf-java-util for a very small amount of logic, as it stands it's about 7MB. Let me go ahead and make a new module for it at least for now. |
are we going to break out |
Ah forgot to mention one more caveat - we'll need an
Ah yeah this was the plan
Makes sense to me |
Hmm - well I guess the README is saying it's ok for me to move the code into this extension? https://github.com/open-telemetry/opentelemetry-java/tree/master/sdk-extensions/otproto |
@anuraaga haven’t read the code, but why did you mention JSON encoding in the other PR? Can you add JSON format? We should prioritize proto |
@bogdandrutu This does use JSON serialization of the proto. Meaning it relies on e.g., |
I read the PR and I think the tittle is confusing, this is not an exporter for OTLP logs, but an exporter that writes to the logs. Do we need this? |
@bogdandrutu There was interest in a fully spec'd, stable format for spans when writing to logs in #2293. It seems nice, but could be overkill. @jkwatson @trask any thoughts? I've heard Splunk wanting to use logs for exporting spans in AWS Lambda, maybe @bogdandrutu @iNikem you know if this could help with that? |
We've seen interest in using the logging exporter beyond getting started / toy apps (e.g. open-telemetry/opentelemetry-java-instrumentation#1600). So it would be great if the output of the logging exporter can have some sort of stability guarantee, similar to the other stability guarantees we have been discussing. OTLP/JSON[*] seems ideal, only because we get it for "free" and wouldn't have to invent something new. [*]without the weird traceid/spanid format |
exporters/otlpjson/build.gradle
Outdated
ext.moduleName = "io.opentelemetry.exporter.otlpjson" | ||
|
||
dependencies { | ||
compileOnly project(':sdk:trace') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkwatson So I tried a different approach to splitting all exporters for trace vs metrics here since it seemed like it could be a bit too much. If going with this, I'd revert the change to split out the otlp
exporters in favor of compileOnly
dependencies.
One of the reasons it felt like much is we would need to split otproto up as well - they all end up having a common, trace, metrics split. Lots of artifacts.
But it means that previously, a user could only depend on exporter-otlp
to have the SDK as well, but with such a scheme, they'd have to additionally add the SDK as a dependency. I wonder if this is too annoying or reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, since the trace SDK is supposed to be stable, I think it would ok to declare this as an api
dependency and get that for free, like people would probably expect. Keeping the metrics dependency as provided
might be ok, though, since someone has to explicitly opt-in to depending on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think so long term? e.g., what if someone replaces the trace SDK with a custom one, would we want the exporter artifacts to still bring in the trace SDK? I guess it could be ok, as custom SDKs still seem rare enough to me. Just want to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a completely custom SDK, it might have a completely different exporter interface, yeah? This does make me think we should have a separate artifact with the "SDK Extension Points" in it, including exporter, span processor, sampler interfaces, so at least custom SDKs can use the same extension points.
exporters/otlpjson/README.md
Outdated
@@ -0,0 +1,9 @@ | |||
# OpenTelemetry - OTLP JSON Exporters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is purely a logging exporter, this module should be named logging-otlp
I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - there's some tension with the logging signal. But went with that name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh...yeah, I had forgotten about that bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh no, I hadn't thought about that either, that's going to be very confusing, should we rename our existing logging exporter to "file" exporter, or "console" exporter, or ...
+ " }]\n" | ||
+ " }]\n" | ||
+ "}", | ||
logged.get(0).getMessage(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read this right...the log message will be split across multiple lines? Don't we want to make sure that every log message is only a single line, so it can work with normal logging systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing! This is a JSON assert so whitespace is ignored. I added additional checks that the message has no newlines and realized I needed to set that.
+ " }\n" | ||
+ " }]\n" | ||
+ " }]\n" | ||
+ "}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question about multi-line log message
exporters/otlpjson/build.gradle
Outdated
ext.moduleName = "io.opentelemetry.exporter.otlpjson" | ||
|
||
dependencies { | ||
compileOnly project(':sdk:trace') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would "provided" be a semantically more correct dependency declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think provided is "expected to be there", e.g., tomcat, and optional is "add if you want". compileOnly
roughly corresponds with optional.
exporters/otlpjson/build.gradle
Outdated
ext.moduleName = "io.opentelemetry.exporter.otlpjson" | ||
|
||
dependencies { | ||
compileOnly project(':sdk:trace') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, since the trace SDK is supposed to be stable, I think it would ok to declare this as an api
dependency and get that for free, like people would probably expect. Keeping the metrics dependency as provided
might be ok, though, since someone has to explicitly opt-in to depending on it.
Codecov Report
@@ Coverage Diff @@
## master #2295 +/- ##
=============================================
+ Coverage 0 88.53% +88.53%
- Complexity 0 2576 +2576
=============================================
Files 0 293 +293
Lines 0 8678 +8678
Branches 0 929 +929
=============================================
+ Hits 0 7683 +7683
- Misses 0 660 +660
- Partials 0 335 +335
Continue to review full report at Codecov.
|
} | ||
|
||
description = 'OpenTelemetry Protocol JSON Logging Exporters' | ||
ext.moduleName = "io.opentelemetry.exporter.logging.otlp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my only possible quibble is that maybe this should be "io.opentelemetry.exporter.logging-otlp"
but I'm not quite sure which is going to be more discoverable by end-users. Maybe the description could be more .. descriptive about exactly what's going on here. Maybe description = 'OpenTelemetry logging exporters with OTLP JSON formatting. Currently supports span exports.'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can't wait to try it out!
This uses a protobuf-json library I wrote a while ago, and we use it in Armeria for production. It's based on Jackson vs gson, which I think has a higher chance of being on an app's classpath which is nice. The use of Jackson also made it quite easy to switch the binary marshalling to hex from base64. But it's designed for speed (for use in production) so uses bytebuddy for runtime code generation as opposed to runtime reflection like the official json-format does. That does unfortunately make it more heavyweight than it could be, but at least it's fast 😅.
Wondering where to put this, probably not in
-otlp
, new-otlp-logging
, or replace the current-logging
? Leaning towards-otlp-logging
.