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

Add livedebugging support for discovery components #2309

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ravishankar15
Copy link
Contributor

PR Description

Which issue(s) this PR fixes

Fixes #1034

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added

@@ -112,6 +112,36 @@ Supported components:
* `prometheus.relabel`
{{< /admonition >}}
* `discovery.relabel`
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably abbreviate this to discovery.* unless there's discovery components not added by this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Abbreviating would follow the pattern for other component groups.

// New creates a discovery component given arguments and a concrete Discovery implementation function.
func New(o component.Options, args component.Arguments, creator Creator) (*Component, error) {
debugDataPublisher, err := o.GetServiceData(livedebugging.ServiceName)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is an error in connecting with livedebugging I would not expect that to cause the component to fail to instantiate.

Just looked, and this is clearly the established pattern so I'll bring that up in a separate channel, this is fine for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I agree that it is a bit weird that a missing debugging functionality would prevent the components from starting. But because this is not something that can happen (all services are always created at start), we decided to always expect the service to be there. We could revisit it by adding nil pointers check instead of falling + some way to log once that the live debugging functionality is not available

@@ -257,3 +273,5 @@ func (c *Component) runDiscovery(ctx context.Context, d DiscovererWithMetrics) {
}
}
}

func (c *Component) LiveDebugging(_ int) {}
Copy link
Contributor

@dehaansa dehaansa Dec 30, 2024

Choose a reason for hiding this comment

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

My understanding is that this function is triggered on a change of livedebug consumers. Should the function Publish the cached targets data if the number of consumers > 0 as discovery may not update rapidly otherwise? CC @wildum

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so because the concept of live debugging is to show what's happening now. If I have live debugging open and I see targets I expect that the targets were just sent. The user can see the last sent targets in the exports area of the component page in the UI.
We can revisit this concept if that's something users really want to see on the live graph/live debugging feed but we could simply just use the export values

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Jan 2, 2025
* `discovery.nomad`
* `discovery.openstack`
* `discovery.ovhcloud`
* `discovery.process`
Copy link
Contributor

Choose a reason for hiding this comment

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

discovery process is not using the common discovery component. Can you add livedebugging to it too please?

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.

Add live debugging support to discovery components
4 participants