feat: generate JSON schemas for internal extensions#8089
feat: generate JSON schemas for internal extensions#8089SoumyaRaikwar wants to merge 2 commits intojaegertracing:mainfrom
Conversation
…mas for 6 core internal extensions using schemagen: expvar, jaegermcp, jaegerquery, jaegerstorage, remotesampling, remotestorage Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8089 +/- ##
==========================================
+ Coverage 95.66% 95.69% +0.02%
==========================================
Files 317 317
Lines 16668 16668
==========================================
+ Hits 15946 15950 +4
+ Misses 570 567 -3
+ Partials 152 151 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
does this align with open-telemetry/opentelemetry-collector#14548 ? |
| config: | ||
| type: object | ||
| allOf: | ||
| - $ref: go.opentelemetry.io/collector/config/confighttp.server_config |
There was a problem hiding this comment.
could you please create an ADR that outlines the overall plan? For example, how would this external ref be used?
There was a problem hiding this comment.
Done! added in the latest commit.
Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
4eba44f to
55901aa
Compare
|
i have added the ADR And proposing that as per Alignment with OTel #14548 (mdatagen): We are using schemagen instead of mdatagen because schemagen automatically reflects our complex Go structs, whereas mdatagen currently requires manually redefining schemas in metadata.yaml. We will evaluate migrating to mdatagen in the future if it natively supports Go reflection., |
|
@SoumyaRaikwar it is not clear to me from the ADR what is the goal and the end state. As the main issue states, the goal is to be able to generate documentation that accurately reflects the config schema expected by the Jaeger binary. Go struct -> YAML may be an implementation detail but it does not achieve this stated goal. And while it is easy to imagine a second step of using the YAML schema to generate the documentation, it does not explain how foreign references to OTEL types would help with that, nor how to make the schemas functionally rich (so that they can be used for config authoring and validation) and not just limited to type/description. The typical schema-first solution would be to use schemas as the source of truth and use them to generate Go structs and validation code, as well as documentation. |
Which problem is this PR solving?
part of #6186
Description of the changes
This PR implements automated JSON schema generation for Jaeger v2's internal extensions using the
schemagentool.time.Durationto JSON Schema duration format).generate-schemastarget to the root Makefile to automate the process.expvarjaegermcpjaegerqueryjaegerstorageremotesamplingremotestorageThe generated schemas provide machine-readable definitions for the configuration surface of these extensions, facilitating better validation and documentation.
How was this change tested?
make generate-schemaslocally.make build-jaegerandmake lintto ensure no regressions.Checklist
make lint testAI Usage in this PR