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 metricset.period to Metricbeat events #13242

Merged
merged 14 commits into from Aug 23, 2019
Merged

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 14, 2019

Add metricset.period to Metricbeat events so this information
can be used for more accurate visualizations in Kibana UIs.

This field is not added to push fetchers, as they don't do
periodic fetching.

Continues with #6929

Fixes #12616

Co-authored-by: ruflin spam@ruflin.com

Having the period as part of each event makes it possible for Kibana or ML to predict when the next event is potentially missing or delayed based on the period of the previous events. It can always be that the period changed but as soon as the next event comes in, this can be used as the new expected period.

Only the schedule events will contain the `metricset.period` field.
@jsoriano jsoriano added enhancement in progress Pull request is currently in progress. Metricbeat Metricbeat [zube]: In Progress Team:Integrations Label for the Integrations team labels Aug 14, 2019
@jsoriano jsoriano self-assigned this Aug 14, 2019
@jsoriano jsoriano force-pushed the add-period branch 2 times, most recently from ac8ef56 to f403bd1 Compare August 14, 2019 15:28
@jsoriano jsoriano marked this pull request as ready for review August 14, 2019 17:45
@jsoriano jsoriano added review [zube]: In Review and removed [zube]: In Progress in progress Pull request is currently in progress. labels Aug 14, 2019
@ruflin ruflin self-requested a review August 19, 2019 13:10
Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

After a short conversation to ask some questions with @jsoriano LGTM

@jsoriano
Copy link
Member Author

jenkins, test this again please

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Code LGM, left some minor comments.

Part which is not clear to me: Why does it modify so many generated files outside metricset.period?

"p99": 0,
"p999": 0,
"stddev": 0
"my_counter": {
Copy link
Member

Choose a reason for hiding this comment

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

Why does it modify this one?

Copy link
Member Author

@jsoriano jsoriano Aug 21, 2019

Choose a reason for hiding this comment

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

Order of events depends on a hash of the whole event. For source files that generate multiple events is very likely that the order changes if anything in the content changes, so diffs are bigger.

@@ -141,6 +150,9 @@ func AddMetricSetInfo(module, metricset string, event *Event) {
if event.Took > 0 {
e.Put("event.duration", event.Took/time.Nanosecond)
}
if event.Period > 0 {
e.Put("metricset.period", event.Period/time.Microsecond)
Copy link
Member

Choose a reason for hiding this comment

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

I understand why you want here with microseconds instead of nano seconds as it might be overkill. At the same time I wonder if we should standardise the unit we use?

Otherwise, do we expected / recommend anyhting lower then 1s?

Copy link
Member Author

Choose a reason for hiding this comment

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

I understand why you want here with microseconds instead of nano seconds as it might be overkill. At the same time I wonder if we should standardise the unit we use?

I don't have a strong opinion about this, it comes from the original PR 🙂
By standardizing do you mean to use nanoseconds as in event.duration? I would be ok with that, but I don't think they need to be in the same unit as they have different needings.

Otherwise, do we expected / recommend anyhting lower then 1s?

I don't think it will be recommendable to have a period lower than the second, but there are services that can very well respond in milliseconds, so it should be possible.

Another option can be to store it in seconds, but as a float, this way we would need less space in events and in store (32 bits for a float, 64 for a long), and we could still support the case of periods under the second.

Copy link
Member

Choose a reason for hiding this comment

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

I definitively prefer the long over the float as the float gets inaccurate in ES for large values (not that we will really hit those hopefully). I'm still holding my breath for getting duration support in ES one day ;-)

I'm good with Micro or either Milli and we solve it in case it ever becomes an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I think I am going to change this to Milliseconds, it should be more than enough for this. And then also integer should be enough to store the values.

@jsoriano
Copy link
Member Author

jenkins, test this again please

@jsoriano jsoriano added the test-plan Add this PR to be manual test plan label Aug 21, 2019
@sayden
Copy link
Contributor

sayden commented Aug 23, 2019

I also feel that the change to milliseconds is the way to go. Reviewed again. Everything looks ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Metricbeat Metricbeat needs testing notes review Team:Integrations Label for the Integrations team test-plan Add this PR to be manual test plan v7.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send period in metricbeat data
5 participants