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

Implement an initial version of the support bundle in Alloy #2009

Merged
merged 31 commits into from
Nov 11, 2024

Conversation

dehaansa
Copy link
Contributor

PR Description

Port the Support Bundle from the Agent repository & update it for Alloy.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated

@dehaansa dehaansa requested review from clayton-cornell and a team as code owners October 31, 2024 04:22
@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Nov 1, 2024
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
@clayton-cornell clayton-cornell requested a review from a team November 4, 2024 18:31
@clayton-cornell
Copy link
Contributor

Over to @grafana/grafana-alloy-maintainers for a code review

Copy link
Contributor

@wildum wildum left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for adding this, the code and docs are very clear and easy to follow :) Did you get the chance to test it on windows and with fleet management?

docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Show resolved Hide resolved
internal/service/http/http.go Outdated Show resolved Hide resolved
internal/service/http/http.go Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
@dehaansa
Copy link
Contributor Author

dehaansa commented Nov 5, 2024

Awesome! Thanks for adding this, the code and docs are very clear and easy to follow :) Did you get the chance to test it on windows and with fleet management?

I did not have a chance to test in windows/FM. Will connect with you tomorrow to discuss options, I don't have a windows environment set up (or know how to access a shared one yet)

@dehaansa dehaansa requested a review from wildum November 6, 2024 18:53
@wildum
Copy link
Contributor

wildum commented Nov 6, 2024

Tested on Windows, it works well :) fyi if there are no logs during the recording time the log file won't be generated (which is ok imo)

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

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

That's looking really good, can't wait to have this in user's hands!

docs/sources/reference/cli/run.md Show resolved Hide resolved
In addition, you can inspect the [supportbundle implementation](https://github.com/grafana/alloy/tree/internal/service/http/supportbundle.go)
to verify the code used to generate these bundles.

A support bundle contains the following data:
Copy link
Contributor

Choose a reason for hiding this comment

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

This will do to support questions what 🚒 does to 🔥
🎉

docs/sources/troubleshoot/support_bundle.md Show resolved Hide resolved
internal/alloycli/cmd_run.go Outdated Show resolved Hide resolved
internal/alloycli/cmd_run.go Outdated Show resolved Hide resolved
internal/runtime/logging/logger.go Show resolved Hide resolved
tracer trace.TracerProvider
gatherer prometheus.Gatherer
opts Options
log *logging.Logger
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can rename this somehow? globalLogger?
A comment that it's only used to set temporary writer etc would be nice to make it easier to figure out.

internal/service/http/http.go Outdated Show resolved Hide resolved
internal/service/http/http.go Outdated Show resolved Hide resolved
Comment on lines 292 to 295
s.log.SetTemporaryWriter(syncBuff)
defer func() {
s.log.RemoveTemporaryWriter()
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't multiple concurrent calls to this /-/support race on these?
Do we need a mutex for the whole call?

weight: 300
---

# Generate Support Bundle
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this be released as Public preview?

If yes, then we probably should add the Public preview bits at the top of the doc topic.

<span class="badge docs-labels__stage docs-labels__item">Public preview</span>

# Generate Support Bundle

{{< docs/shared lookup="stability/public_preview.md" source="alloy" version="<ALLOY_VERSION>" >}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we use the shared component for public_preview? The language doesn't seem quite right for this feature

image

Copy link
Contributor

@clayton-cornell clayton-cornell Nov 7, 2024

Choose a reason for hiding this comment

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

Oooh good point. Lets switch to the generic one instead. We could use this in its place:

{{< docs/public-preview product="Generate support bundle" >

https://grafana.com/docs/writers-toolkit/write/shortcodes/#docspublic-preview (if it's behind a feature flag, there's a block for that too)

This will create a Note block that says:

Generate support bundle is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.

Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

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

Some minor tweaks to the docs. Otherwise looks good.

docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved
docs/sources/troubleshoot/support_bundle.md Outdated Show resolved Hide resolved

# Generate a support bundle

{{< docs/shared lookup="stability/public_preview.md" source="alloy" version="<ALLOY_VERSION>" >}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{< docs/shared lookup="stability/public_preview.md" source="alloy" version="<ALLOY_VERSION>" >}}
{{< docs/public-preview product="Generate support bundle" >}}

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

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

LGTM, one last question, but happy to change docs in a follow-up.

CHANGELOG.md Show resolved Hide resolved
@thampiotr thampiotr enabled auto-merge (squash) November 11, 2024 12:27
@thampiotr thampiotr merged commit 3cf2bcd into grafana:main Nov 11, 2024
15 checks passed
thampiotr added a commit that referenced this pull request Nov 11, 2024
* Implement an initial version of the support bundle in Alloy

* Add documentation for support bundle

* Update changelog

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Initial PR feedback

* Rewrite http service to use logging library internal to alloy

* Revert accidental commit of e2e test changes

* Fix comment on exported function

* Clean up added host variable that is no longer used

* Refactor usage of logger in http service

* Update internal/service/http/http.go

Co-authored-by: Piotr <[email protected]>

* implement PR feedback

* Hide support bundle behind public preview stability level

* Update docs based on feedback

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* More PR feedback in docs

* Fix race condition in logger

* Add a note about backward-compatibility exception

---------

Co-authored-by: Clayton Cornell <[email protected]>
Co-authored-by: Piotr <[email protected]>
thampiotr added a commit that referenced this pull request Nov 11, 2024
* update changelog version

* Prototype targets.merge function (array.combine_maps) (#1826)

* Prototype map.inner_join function

* Rename to "targets.merge", remove unnecessary params

* Add failure tests

* Delete incorrect comment

* rename targets.merge to array.combine_maps, mark it as experimental, make is more permissive and add tests

* update changelog

* Update CHANGELOG.md

Co-authored-by: Piotr <[email protected]>

* Update docs/sources/reference/stdlib/array.md

Co-authored-by: Piotr <[email protected]>

* Update docs/sources/reference/stdlib/array.md

Co-authored-by: Piotr <[email protected]>

* Update docs/sources/reference/stdlib/array.md

Co-authored-by: Piotr <[email protected]>

* rename mapCombine to combineMaps

* document panic

* add equal test

* add more tests

* Update syntax/internal/stdlib/stdlib.go

Co-authored-by: Piotr <[email protected]>

* Update syntax/internal/stdlib/stdlib.go

Co-authored-by: Piotr <[email protected]>

* add examples in doc

* fix error propagation

* remove value nul on len function

* refactor code into a traversal function

* update doc to avoid modifying the experimental shared doc

---------

Co-authored-by: William Dumont <[email protected]>
Co-authored-by: Piotr <[email protected]>

* Implement an initial version of the support bundle in Alloy (#2009)

* Implement an initial version of the support bundle in Alloy

* Add documentation for support bundle

* Update changelog

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Initial PR feedback

* Rewrite http service to use logging library internal to alloy

* Revert accidental commit of e2e test changes

* Fix comment on exported function

* Clean up added host variable that is no longer used

* Refactor usage of logger in http service

* Update internal/service/http/http.go

Co-authored-by: Piotr <[email protected]>

* implement PR feedback

* Hide support bundle behind public preview stability level

* Update docs based on feedback

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/troubleshoot/support_bundle.md

Co-authored-by: Clayton Cornell <[email protected]>

* More PR feedback in docs

* Fix race condition in logger

* Add a note about backward-compatibility exception

---------

Co-authored-by: Clayton Cornell <[email protected]>
Co-authored-by: Piotr <[email protected]>

---------

Co-authored-by: Paulin Todev <[email protected]>
Co-authored-by: William Dumont <[email protected]>
Co-authored-by: Sam DeHaan <[email protected]>
Co-authored-by: Clayton Cornell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Docs Squad label across all Grafana Labs repos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants