-
Notifications
You must be signed in to change notification settings - Fork 327
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 http/protobuf opentelemetry reporter #1102
Conversation
Hey @hughsimpson, this is a really amazing piece of work! I'm really happy to see this now because we are recently looking at checking all the boxes for becoming "otel-compatible". Timing couldn't be better 😄 Now, one little thing that bugs me here is that there is certain amount of logic dedicated to translating from Kamon's model to OTLP, and that logic will now be repeated in both reporters. Have you experimented with the idea of using this same base for both OTLP/grpc and OTLP/http? In my head it sounds like the translation to protobuf-generated classes should be the same in both cases and then only transport will be a different concern, but I didn't dig in the code yet to figure it out. Also, I would like to bring @pnerg around in case he has the time to check things out. He contributed the otel reporter we have at the moment. |
On the surface the grpc and http reporters are very similar.
The counterpart in this code is
It would of course be possible abstract the actual protocol layer into own modules (like they are now) and keep a common library (kamon-otel-common-lib) for the But that would require refactoring the in essence something like this
|
Thanks for taking a look at this! I wasn't expecting such a prompt response, or I'd have checked back here sooner! I did have a think about how this could be combined with grpc reporting -- I think it would just be a matter of also including the It did occur to me that there's a marginal inefficiency in translating to the otel internal format before serialisation, rather than translating directly as the existing grpc one does, but thought it was probably worth it to reduce the cost of maintaining compatibility if there are any future changes to the standard... Perhaps this was the wrong approach and I should have looked into using okhttp directly as an alternative transfer agent in the existing module 🤔 I don't know how much time I'll have to take another look at this next week but I'll try to have a stab at that approach and see if it was easier than I made it out the first time around PS have pushed a fix for building under scala 2.11. I forgot to test that locally 🤦 |
You happen to do this precisely when I'm deep into bringing support for OpenTelemetry, both in Kamon Telemetry and Kamon APM. So, interestes aligned 😂 I think it would be ideal to have both reporters in the same artifact so that we can implement the configurations that all OTLP exporter must accept. I didn't dig in the full details, but your comment about maybe using OkHttp directly sounds like something that could be added to the existent reporter 🤔 That would be a nice thing to explore. BTW, remember you can always come over to our Discord and bounce ideas before getting deep into them. I'm hanging out there every day. |
OK so I have an alternative take on this in #1106 -- I'm not sure I prefer it, since there's an awful lot of re-implementation of the stuff we can get for free from the otel sdk (this proves a lot nicer if you try implementing metrics reporting, for example) ... For a fairer comparison, I've pushed to this branch with the entire opentelemetry-reporter module migrated to the sdk |
I see I dropped some META-INF stuff from this pr by mistake. I'm guessing it's important and should be re-added? Tbqh I don't know what it does |
Hey @hughsimpson, the |
7ea5515
to
b6d035c
Compare
OK. I've re-included those dropped files, reverted some naming changes I'd left in by miskate, and added any metricsTags to the reported attributes. Think this might be ready to go in / get some more detailed review |
I noticed some differences between how this reports errors in traces and how other sdks do it. Have made a related pr to increase compatibility for that (#1112) |
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.
Hey @hughsimpson, there are a few minor changes to make and after that it kind of looks good to me.
Do you have any experience to share from using a private build of this reporter?
reporters/kamon-opentelemetry/src/main/scala/kamon/otel/OpenTelemetryTraceReporter.scala
Outdated
Show resolved
Hide resolved
reporters/kamon-opentelemetry/src/main/resources/reference.conf
Outdated
Show resolved
Hide resolved
reporters/kamon-opentelemetry/src/main/resources/reference.conf
Outdated
Show resolved
Hide resolved
Something that just came to mind.. this PR is creating a single resource that uses Kamon as the instrumentation library, but in OTel they generate the data using each individual instrumentation "module" as the instrumentation library, so there are instrumentation library spans from a bunch of different places on each batch sent to the OTel collector. We don't have that concept, but we do have the |
Thanks for the thoughts! Will start tackling tomorrow. In terms of experiences to report:
I had initially been expecting to be getting into opentelemetry metrics by now, but that branch is rather on-hold for the time being. It seemed pretty trivial to do via the sdk, but also potentially a distraction, and not immediately vital for me. The only thing that struck me as potentially thorny there was unit conversions - but since it's a case of kamon having a richer notion of units than opentelemetry, it's probably not really an issue. Certainly I couldn't spot anything problematic in my initial spikes, but it was a very small set of test cases. |
- Always include environment tags in otel resource - Add service.instance.id and host.name variables to resource - Remove the -/. replacement (not required)
- s/fullEndpoint/full-endpoint/ - Remove the protocol/host/port fields (they're unecessary given they're subsumed by endpoint/full-endpoint config fields) - rename otelProtocol to protocol
…mentation library name
@ivantopo Sorry about the delay - had a bit of a break. Have addressed your comments (nice catch about the instrumentation library... you know, I've never even really noticed that field 😅). Think it's ready for another review! |
@ivantopo bump? |
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.
Hey @hughsimpson, I went through with a finer comb and only found two minor issues. When you push those changes I'll blindly merge the PR 😄
reporters/kamon-opentelemetry/src/main/scala/kamon/otel/SpanConverter.scala
Outdated
Show resolved
Hide resolved
reporters/kamon-opentelemetry/src/main/scala/kamon/otel/SpanConverter.scala
Outdated
Show resolved
Hide resolved
@ivantopo pushed fixes for those two issues. Also spotted that the |
Existing opentelemetry reporter only supports grpc. This
adds a new reporter to support the http/protobuf protocol. I'm keeping it in a separate module to the grpc opentelemetry reporter because it has a completely different set of dependencies, and by virtue of directly using the opentelemetry java sdk, quite a different structure.replaces the existing approach to more heavily leverage the opentelemetry sdk. It should provide a more elegant approach to introducing log and metric bindings in the future