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

New interface to retrieve info about running components inside of nodes. #6229

Merged
merged 14 commits into from
Jan 25, 2024

Conversation

wildum
Copy link
Contributor

@wildum wildum commented Jan 24, 2024

Before ComponentNodes were the only nodes managing a component. The new modules will introduce two new nodes that will have running components inside them:

  • the CustomComponentNode will be running a custom component defined by a declare.
  • the ImportConfigNode will be running a component to retrieve a module from a given location (the component depends on the source, if the module is stored in a file then the node will run a local_file component).

The component provider API is used to retrieve information about running components. It's implemented by Flow to access the components within the graph. Using the ComponentInfo interface instead of the ComponentNode struct will allow Flow to retrieve information about components running inside any nodes.

Flow services using the API will properly retrieve info about all the components involved in the pipeline. That means, for example in our case, that the UI will be able to show the ImportConfigNode and the CustomComponentNode.

API change:
The Registration field has been replaced by simply the name of the block as a string for the following reasons:

  • Registration is used to retrieve information about built-in components. It's not a concept that CustomComponents have.
  • Registration provides a "Build" function that is used to build the component. The API is used to retrieve information about running components so this is not relevant information to expose.
  • Registration provides Arguments and Exports that are already available in the Info struct. This information is redundant because these two fields are initialized by the Registration when the node is created.
    The only field used (and the only relevant one according to the reasons above) is the name of the block. That's why this PR suggests replacing it with BlockName.

The MarshalJSON has the warning "The format of the representation is not stable and is subject to change." which I believe makes the above change ok.

@wildum wildum requested a review from rfratto January 24, 2024 11:42
@rfratto rfratto self-assigned this Jan 24, 2024
@wildum wildum requested a review from rfratto January 25, 2024 14:56
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

LGTM after this final set of comments :)

pkg/flow/flow_components.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/component_node.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/component_node.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/component_node.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/component_node.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/loader.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/loader.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/metrics.go Outdated Show resolved Hide resolved
pkg/flow/internal/controller/node_builtin_component.go Outdated Show resolved Hide resolved
wildum and others added 7 commits January 25, 2024 16:15
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
@wildum wildum requested a review from rfratto January 25, 2024 15:24
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

Let's go!

@rfratto rfratto merged commit eebd796 into main Jan 25, 2024
10 checks passed
@rfratto rfratto deleted the introduce-component-info-interface branch January 25, 2024 15:29
BarunKGP pushed a commit to BarunKGP/grafana-agent that referenced this pull request Feb 20, 2024
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants