-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add component JSON schema generation to mdatagen #14288
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
base: main
Are you sure you want to change the base?
Add component JSON schema generation to mdatagen #14288
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (70.47%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #14288 +/- ##
==========================================
- Coverage 92.23% 92.04% -0.20%
==========================================
Files 676 679 +3
Lines 41649 42007 +358
==========================================
+ Hits 38415 38665 +250
- Misses 2196 2269 +73
- Partials 1038 1073 +35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This is a good example to look at the generated schema
c7b9168 to
a88d7b8
Compare
CodSpeed Performance ReportMerging this PR will not alter performanceComparing
|
|
I really like that this approach attempts to capture the |
|
It seems that we are working on solving the same problem, but using slightly different methods. I have started working on a script that generates config schemas based on Go structs using AST parsing. This is part of a larger plan to introduce schemas to the OpenTelemetry collector. You can find more details in my PRs:
I think it makes sense to start a discussion on the preferred solution. |
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
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 like this approach better and I think this can be merged roughly as is
cmd/mdatagen/internal/samplereceiver/internal/metadata/schemas/config_schema.json
Outdated
Show resolved
Hide resolved
receiver/otlpreceiver/internal/metadata/schemas/config_schema.json
Outdated
Show resolved
Hide resolved
3fa491f to
a166f90
Compare
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
a166f90 to
f190d98
Compare
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
|
Given that we’ve gone through many iterations, and that a similar solution has recently been merged (the schemagen tool), I’d like to propose a call to discuss the end result we want to have, align on a single approach, and avoid stepping on each other’s toes. There are a few remaining points we need to clarify:
@pavolloffay @mx-psi @evan-bradley @jkoronaAtCisco how does it sound? |
Description
This is an alternative PR #14261
metadata.yaml:Notable implementation details
format: durationDurationtime.Duration(Default): Marshals into an integer representing nanoseconds (e.g.,300000000000)."type": "string", "format": "duration"you need a custom wrapper around time.Duration that implements the json.Marshaler interface to convert the time into ISO 8601 format.Solution
{ "type": "string", "pattern": "^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(ns|us|µs|ms|s|m|h))+$", "example": "1h30m10s", "description": "A duration string (e.g., '10s', '1.5h'). Valid units: ns, us, ms, s, m, h." }mapstructure:",squashOpen questions
datadogexporter,pkg/datadog/config.go)Link to tracking issue
Fixes #9769
Fixes open-telemetry/opentelemetry-collector-contrib#42214
Implements: #13784
Testing
olpreceiverin this repo has enabled schema generationDocumentation