Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@lidavidm - I hope that should fix the build for API-only build.
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 can confirm this fixes the API-only build, thanks!
It would be nice if we could still build the rest of the library that doesn't require json without this dependency, though (e.g. the SDK), though I can understand if that would get complicated.
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.
@lidavidm - it happens that in the majority of cases (
80% scenarios
I'd say), we do actually requirenlohmann/json.hpp
, e.g. for ETW on Windows, for zPages (internal monitor of SDK statistics), for Zipkin exporter, as well as for OTLP-HTTP exporter. Plus for all tests, and generally for examples too.Since we got you covered well - the case when the build is done only for API and nothing else, json is now optional for that scenario.. I think it's gonna be too much of a hassle to make json optional for the rest. As you noticed, it gets complicated - given that most components require it. And we give two alternatives - either consume json library from user-provided deps. Or use the one we cloned from recursive submodules, both options now work cross-plat.
We can probably consider further improvements in a follow-up PR? But as low priority. Since all immediate scenarios have been addressed.
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 agree on having further cleanup in a follow-up PR. I think the most common usage scenario would be instrumentation libraries devs using otel-cpp api, and application developers using otel-gRPC exporter. And both these scenarios don't depend on JSON and so shouldn't fail. Though I do see the hassle involved here to work it cross-platform.
Thanks for fixing the API only build :)
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.
@lalitb - My worry is that OTLP-HTTP exporter may also be common. This one does require JSON. Same as Zipkin. Also I think the zPages project is kinda common across all languages. The idea is we use zPages for debugging OpenTelemetry in-proc.. that build flavor of final SDK dll / shared object bit, with zPages in it, would require json.hpp
While I agree we may not need it for OTLP-gRPC only build without zPages, in most other configurations we end up needing json.hpp anyways.
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 totally understand. I think the biggest thing is just that the release tarballs don't include the submodules, but that's a Github issue.