Skip to content
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

feat: Auto-generate documentation for jaeger-v2 configuration structs via AST #6776

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

AnmolxSingh
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • Rough outline of the milestones: (Copied from Issue)

    • basic framework that navigates to the listed structs via AST (and prints something simple)
    • recursively evaluate nested structs (and print a hierarchy)
    • print complete info about config structs (e.g. as YAML or JSON output) including field names, types, descriptions (from
      comments)
    • enhance Jaeger docs to use the output from last step to render docs in HTML

How was this change tested?

Checklist

Signed-off-by: AnmolxSingh <[email protected]>
@AnmolxSingh AnmolxSingh requested a review from a team as a code owner February 26, 2025 17:21
@AnmolxSingh AnmolxSingh requested a review from jkowall February 26, 2025 17:21
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.02%. Comparing base (ce07285) to head (22f882c).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6776      +/-   ##
==========================================
- Coverage   96.03%   96.02%   -0.02%     
==========================================
  Files         363      364       +1     
  Lines       20677    20690      +13     
==========================================
+ Hits        19857    19867      +10     
- Misses        626      628       +2     
- Partials      194      195       +1     
Flag Coverage Δ
badger_v1 9.81% <ø> (+0.05%) ⬆️
badger_v2 1.89% <ø> (+0.06%) ⬆️
cassandra-4.x-v1-manual 14.86% <ø> (+0.05%) ⬆️
cassandra-4.x-v2-auto 1.88% <ø> (+0.06%) ⬆️
cassandra-4.x-v2-manual 1.88% <ø> (+0.06%) ⬆️
cassandra-5.x-v1-manual 14.86% <ø> (+0.05%) ⬆️
cassandra-5.x-v2-auto 1.88% <ø> (+0.06%) ⬆️
cassandra-5.x-v2-manual 1.88% <ø> (+0.06%) ⬆️
elasticsearch-6.x-v1 19.19% <ø> (+0.04%) ⬆️
elasticsearch-7.x-v1 19.27% <ø> (+0.04%) ⬆️
elasticsearch-8.x-v1 19.44% <ø> (+0.04%) ⬆️
elasticsearch-8.x-v2 1.89% <ø> (+0.06%) ⬆️
grpc_v1 10.86% <ø> (+0.05%) ⬆️
grpc_v2 7.86% <ø> (+0.06%) ⬆️
kafka-3.x-v1 10.11% <ø> (-0.02%) ⬇️
kafka-3.x-v2 1.89% <ø> (+0.06%) ⬆️
memory_v2 1.89% <ø> (+0.06%) ⬆️
opensearch-1.x-v1 19.32% <ø> (+0.04%) ⬆️
opensearch-2.x-v1 19.32% <ø> (+0.04%) ⬆️
opensearch-2.x-v2 1.89% <ø> (+0.06%) ⬆️
tailsampling-processor 0.48% <ø> (-0.01%) ⬇️
unittests 94.91% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AnmolxSingh AnmolxSingh force-pushed the ast branch 2 times, most recently from 107268e to e5c469a Compare February 26, 2025 18:08
Signed-off-by: AnmolxSingh <[email protected]>
@yurishkuro yurishkuro requested a review from Copilot February 26, 2025 19:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Anmol <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: Anmol <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
@AnmolxSingh AnmolxSingh changed the title Auto-generate documentation for jaeger-v2 configuration structs via AST feat: Auto-generate documentation for jaeger-v2 configuration structs via AST Mar 2, 2025
Signed-off-by: AnmolxSingh <[email protected]>
}

// function to extract default value from struct
func extractDefaultValues(fset *token.FileSet, fn *ast.FuncDecl) (string, map[string]interface{}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need unit tests to ensure that this logic does not miss fields (like embedded structs).

@yurishkuro yurishkuro added the changelog:new-feature Change that should be called out as new feature in CHANGELOG label Mar 9, 2025
Signed-off-by: AnmolxSingh <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
Signed-off-by: AnmolxSingh <[email protected]>
@AnmolxSingh AnmolxSingh requested a review from yurishkuro March 13, 2025 20:05
@yurishkuro
Copy link
Member

did you try to run the output through https://github.com/adobe/jsonschema2md ? Can you upload that the result looks like?

@AnmolxSingh
Copy link
Contributor Author

AnmolxSingh commented Mar 14, 2025

Hi @yurishkuro. The submitted code generated the following file:-
1.json file
jaeger-config-schema.json
2. jsonschema2md file
configdocs.md
(It did not generate file with .md extension I added it myself for the purpose of uploading it)

@AnmolxSingh
Copy link
Contributor Author

AnmolxSingh commented Mar 14, 2025

It just generated this file!

Screenshot 2025-03-15 004300

But I did not modify the file except adding .md extension to it.

@yurishkuro
Copy link
Member

Any idea why GRPC is not expanded?

Protocols (object): Protocols is the configuration for the supported protocols.
  GRPC (object, required): .
  HTTP: . Refer to [#/definitions/HTTPConfig](https://file+.vscode-resource.vscode-cdn.net/Users/ysh/Downloads/configdocs.md#definitions/HTTPConfig).

it's actually like that in your JSON

    "Protocols": {
      "description": "Protocols is the configuration for the supported protocols.",
      "properties": {
        "GRPC": {
          "description": "",
          "type": "object"
        },
        "HTTP": {
          "$ref": "#/definitions/HTTPConfig",
          "description": ""
        }
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:new-feature Change that should be called out as new feature in CHANGELOG documentation v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[experiment] Auto-generate documentation for jaeger-v2 configuration structs via AST
2 participants