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

Enhance summary output to show success percentages as well as failures #1348

Closed
jkodroff opened this issue Aug 31, 2023 · 3 comments
Closed
Assignees
Labels
area/tfgen Issues in pkg/tgen, excluding docs generation - use area/docsgen for those good-first-issue Start here if you'd like to start contributing to Pulumi kind/enhancement Improvements or new features resolution/fixed This issue was fixed

Comments

@jkodroff
Copy link
Member

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Today, the summary output from running tfgen looks like this:

General metrics:
	1241 total resources containing 13068 total inputs.
	511 total functions.
	0 entities are missing docs entirely because they could not be found in the upstream provider.

Description metrics:
	0 entity descriptions contained an <elided> reference and were dropped, including examples.
	0 entity descriptions contained an <elided> reference and were dropped, but examples were preserved.

Example conversion metrics:
	95 HCL examples failed to convert in all languages
	59 HCL examples were converted in at least one language but failed to convert to TypeScript
	59 HCL examples were converted in at least one language but failed to convert to Python
	59 HCL examples were converted in at least one language but failed to convert to Go
	59 HCL examples were converted in at least one language but failed to convert to C#
	73 entity document sections contained unexpected HCL code snippets. Examples will be converted, but may not display correctly in the registry, e.g. lacking tabs.

Argument metrics:
	9594 argument descriptions were parsed from the upstream docs
	196 top-level input property descriptions came from an upstream attribute (as opposed to an argument). Nested arguments are not included in this count.
	0 arguments contained an <elided> reference and had their descriptions dropped.
	0 nested arguments contained an <elided> reference and had their descriptions dropped.
	542 of 13068 resource inputs (4.15%) are missing descriptions in the schema

Attribute metrics:
	0 attributes contained an <elided> reference and had their descriptions dropped.

It would be better if each line showed "X/Y (Z%)". By giving the total number and the success rate, we'll have a clearer picture of how any changes in either the bridge or the provider code affect conversion, drop rates, etc.

This might also be a good opportunity to unify the summary output code with the JSON file that gives very detailed conversion info. FYI, our build processes either used to or still do upload that JSON file to an S3 bucket for the purpose of keeping metrics on historical conversion rates. It's not clear whether Pulumi is still actively using those metrics. There's duplication of functionality between the summary code I enhanced and the JSON output code.

The ideal solution could be some sort of event-centric logging that would allow us to capture each relevant event, stream those events to wherever we want (stdout, file), and also aggregate/transform them however we want in Go code (e.g. being able to do logging of the events, but also easily aggregate the totals, which we could slice and dice by module, resource, etc.). This solution could be overkill, but it would give us maximum flexibility for observability, which was a huge challenge in tfgen when I worked on it. My hunch is that this investment would pay off in the (possibly very) long run.

Affected area/feature

@jkodroff jkodroff added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Aug 31, 2023
@t0yv0
Copy link
Member

t0yv0 commented Aug 31, 2023

Sounds good. There's already code present to emit better summary activated by COVERAGE_OUTPUT_DIR=somewhere perhaps we could make that show.

FYI, our build processes either used to or still do upload that JSON file to an S3 bucket for the purpose of keeping metrics on historical conversion rates.

Yes I found this:

    - name: Upload coverage data to S3
      run: >-
        summaryName="${PROVIDER}_summary_$(date +"%Y-%m-%d_%H-%M-%S").json"

        s3FullURI="s3://${{ secrets.S3_COVERAGE_BUCKET_NAME }}/summaries/${summaryName}"

        aws s3 cp "${{ env.COVERAGE_OUTPUT_DIR }}/summary.json" "${s3FullURI}" --acl bucket-owner-full-control

Digging up instructions.

@t0yv0 t0yv0 added good-first-issue Start here if you'd like to start contributing to Pulumi area/tfgen Issues in pkg/tgen, excluding docs generation - use area/docsgen for those and removed needs-triage Needs attention from the triage team labels Aug 31, 2023
@jkodroff
Copy link
Member Author

@t0yv0 If you know of an embeddable event-driven logging library in Go that can do the stuff I described, I'm curious to see what's out there. When I worked on tfgen, I did a survey of all the popular logging tools but I didn't find anything that did what I wanted. I basically wanted something like https://vector.dev/, which can do transforms on structured logs, but Vector runs as an external service whereas we would want something that can be embedded. If Vector has an automation API equivalent, that could be worth a look.

@t0yv0
Copy link
Member

t0yv0 commented Aug 31, 2023

There is https://go.dev/blog/slog now but I don't know that this issue needs it, whatever's in place is fine we can just print better summaries.

VenelinMartinov added a commit that referenced this issue Oct 24, 2023
Should address #1348.  
Replaces the current summaries:  
```
General metrics:
	1241 total resources containing 13068 total inputs.
	511 total functions.
	0 entities are missing docs entirely because they could not be found in the upstream provider.

Description metrics:
	0 entity descriptions contained an <elided> reference and were dropped, including examples.
	0 entity descriptions contained an <elided> reference and were dropped, but examples were preserved.

Example conversion metrics:
	95 HCL examples failed to convert in all languages
	59 HCL examples were converted in at least one language but failed to convert to TypeScript
	59 HCL examples were converted in at least one language but failed to convert to Python
	59 HCL examples were converted in at least one language but failed to convert to Go
	59 HCL examples were converted in at least one language but failed to convert to C#
	73 entity document sections contained unexpected HCL code snippets. Examples will be converted, but may not display correctly in the registry, e.g. lacking tabs.

Argument metrics:
	9594 argument descriptions were parsed from the upstream docs
	196 top-level input property descriptions came from an upstream attribute (as opposed to an argument). Nested arguments are not included in this count.
	0 arguments contained an <elided> reference and had their descriptions dropped.
	0 nested arguments contained an <elided> reference and had their descriptions dropped.
	542 of 13068 resource inputs (4.15%) are missing descriptions in the schema

Attribute metrics:
	0 attributes contained an <elided> reference and had their descriptions dropped.
```

with the summaries from `examples_coverage_tracker`:

```
Additional example conversion stats are available by setting COVERAGE_OUTPUT_DIR.
Provider:     azuread
Success rate: 97.75% (522/534)

Converted 97.75% of csharp examples (87/89)
Converted 97.75% of go examples (87/89)
Converted 98.88% of java examples (88/89)
Converted 97.75% of python examples (87/89)
Converted 97.75% of typescript examples (87/89)
Converted 96.63% of yaml examples (86/89)
```

I've also added a message about the detailed summaries since it might be
useful for people to find out about the additional stats available:
`Additional example conversion stats are available by setting
COVERAGE_OUTPUT_DIR.`.

Happy to remove it, let me know if I should.
@mikhailshilkov mikhailshilkov added the resolution/fixed This issue was fixed label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tfgen Issues in pkg/tgen, excluding docs generation - use area/docsgen for those good-first-issue Start here if you'd like to start contributing to Pulumi kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants