-
Notifications
You must be signed in to change notification settings - Fork 5k
metricbeat: factory: Introduce metricSetWithPath #47426
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
Conversation
Introduce metricSetWithPath interface in factory to allow metricsets to receive beat-specific paths. Update openai/usage module to use SetPath() instead of paths.Resolve() for state manager initialization. Fixes elastic#46987
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
🤖 GitHub commentsJust comment with:
|
| if p == nil { | ||
| p = paths.Paths | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't think we should do this. Callers should be responsible for giving a valid *paths.Path. Also we really want to get rid of the paths.Paths global variable everywhere in the Beats codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can change that. It's a bit of a red flag that paths is a pointer always, especially in this case where we only create the store once. Should I just change it from *paths.Path to paths.Path or is it intentionally a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can change that. It's a bit of a red flag that paths is a pointer always, especially in this case where we only create the store once. Should I just change it from
*paths.Pathtopaths.Pathor is it intentionally a pointer?
I agree the pointer is "bad", but I haven't really looked at replacing it with a struct. I know some of the functions are built before InitPaths is run, which is what resolves default values and what is in the config. So in at least some places we would still need a pointer.
leehinman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM.
For the Makefile changes, we might want that in a separate PR
Sorry, playing with some new tooling, didn't realize I staged those. |
This reverts commit 234401e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. There is one small linter issue.
|
@lalit-satapathy could we please have someone to take a look here? |
|
Hi @orestisfl! We do not support this OpenAI module; in fact, we never actually utilized it. Our initial plan was to use this module for integration, but immediately after we merged it, OpenAI announced their official Usage API. Consequently, we developed the solution in CEL instead. The CEL approach allows us to iterate faster and makes updates easier to deploy. This module relies on an undocumented API from OpenAI. While that was originally the only way to collect data, it is now obsolete. Since we have the official API, we neither use nor support this module. Furthermore, because OpenAI no longer maintains the undocumented endpoint, users should avoid this module entirely. Therefore, we are no longer accepting changes to this module. I will add a deprecated comment, I will see how to do it and will do the needful. We will only make an exception for changes that are critical blockers for other components. We will not accept any non-blocking changes as this module is no longer maintained. In case you want to merge as this could be a blocker — like removing some function or use of some package or something of that nature that could be a blocker, please let us know. I will approve those PRs. |
|
@orestisfl what are our next steps with this PR? Do we still need it? |
|
Closing given that the module is deprecated. |
Proposed commit message
Introduce metricSetWithPath interface in factory to allow metricsets to receive beat-specific paths. Update openai/usage module to use SetPath() instead of paths.Resolve() for state manager initialization.
Fixes #46987
Diagram
The following diagram illustrates how the
beat.Pathsobject is passed from theMetricbeatbeater down to a metricset component.graph TD %% metricbeat/beater subgraph "metricbeat/beater" Run(["Metricbeat.Run()"]) Paths["beat.Paths"] end %% metricbeat/mb/module subgraph "metricbeat/mb/module" NewFactory(["NewFactory()"]) Create(["factory.Create()"]) end %% openai/usage subgraph "openai/usage" New(["New()"]) MetricSet["MetricSet (instance)"] SetPath(["MetricSet.SetPath()"]) Fetch(["MetricSet.Fetch()"]) State[stateManager] end %% Relationships Run -- "Holds instance of" --> Paths Run -- "Calls" --> NewFactory Paths -- "passed as argument" --> NewFactory NewFactory -- "Returns factory instance" --> Create Run -- "Calls" --> Create Create -- "Eventually invokes metricset factory" --> New New -- "Returns" --> MetricSet MetricSet --- SetPath MetricSet --- Fetch Create -- "Calls" --> SetPath SetPath -- "Accesses paths and initializes" --> State Fetch -- "Reads state from" --> State Run -- "Calls" --> FetchChecklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesstresstest.shscript to run them under stress conditions and race detector to verify their stability.I have added an entry in./changelog/fragmentsusing the changelog tool.Disruptive User Impact
Should not disrupt previous behavior.
How to test this PR locally
Related issues