-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 queue name to state reporting #7537
Conversation
The queue name is reported as part of the state event. An event looks as following: ``` { "beat": { "name": "ruflin" }, "host": { "architecture": "x86_64", "name": "ruflin", "os": { "build": "17E202", "family": "darwin", "platform": "darwin", "version": "10.13.4" } }, "module": { "count": 3, "names": [ "system" ] }, "output": { "name": "elasticsearch" }, "queue": { "name": "mem" }, "service": { "id": "0e1b1913-73db-4512-b17a-8209fa45eaa4", "name": "metricbeat", "version": "7.0.0-alpha1" } } ```
@@ -157,6 +157,10 @@ func createQueueBuilder(config common.ConfigNamespace) (func(queue.Eventer) (que | |||
queueConfig = common.NewConfig() | |||
} | |||
|
|||
stateRegistry := monitoring.GetNamespace("state").GetRegistry() | |||
queueRegistry := stateRegistry.NewRegistry("queue") | |||
monitoring.NewString(queueRegistry, "name").Set(queueType) |
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.
The pipeline should not use any globals at all, so one can safely instantiate multiple pipelines via Load. The Load function even gets the metrics registry passed as parameter (optional, can be nil).
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.
The registry passed is not the same into which this data has to go.
If there can be multiple queues in the future we would need a variable inside this package to keep track of it like we do for modules. Would that be ok for you?
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 understand it's a different regsitry. In this case we should pass a 'telemetry' registry or some kind of callback to the loader. But no globals. It's one of the few packages with no globals in mind from the very beginning.
Me might have other places where we need to pass a telemetry and a metrics registry to a feature/module/plugin. Maybe we want to pass a struct or interface of type:
type monitoring interface {
Telemetry() *monitoring.Registry
Metrics() *monitoring.Registry
Logs() logp.Logger
}
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.
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.
Thanks for opening #8091 It seems this make this PR obsolete, right?
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.
Yes.
Closing in favor of #8091 |
The queue name is reported as part of the state event. An event looks as following: