-
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
Introduce event.duration and event.dataset for backward compatiblity #9393
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,13 @@ | |
example: elasticsearch | ||
description: > | ||
Name of the service metricbeat fetches the data from. | ||
|
||
- name: event.duration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why this is not named with the unit, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This field comes from ECS: https://github.com/elastic/ecs#event A more general note: I have second thoughts for how we deal with units in our current convention and hope in the future Elasticsearch can partially deal with it: elastic/elasticsearch#31244 |
||
type: long | ||
description: > | ||
Duration of the event in nano seconds. | ||
|
||
- name: event.dataset | ||
cwurm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: keyword | ||
description: > | ||
Event dataset name. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
package mb | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/elastic/beats/libbeat/beat" | ||
|
@@ -116,14 +117,21 @@ func AddMetricSetInfo(module, metricset string, event *Event) { | |
if event.Host != "" { | ||
info["host"] = event.Host | ||
} | ||
if event.Took > 0 { | ||
info["rtt"] = event.Took / time.Microsecond | ||
} | ||
|
||
if event.Namespace != "" { | ||
info["namespace"] = event.Namespace | ||
} | ||
info = common.MapStr{ | ||
"metricset": info, | ||
"event": common.MapStr{ | ||
"dataset": fmt.Sprintf("%s.%s", module, metricset), | ||
}, | ||
} | ||
|
||
if event.Took > 0 { | ||
// rtt is deprecated and will be removed in 7.0. Replaced by event.duration. | ||
info.Put("metricset.rtt", event.Took/time.Microsecond) | ||
info.Put("event.duration", event.Took/time.Nanosecond) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: here you have an innocuous race condition. The time.Nanosecond could happen later enough that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure i can follow. event.Took is a value and it's not calculated here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, didn't look up what |
||
} | ||
|
||
if event.RootFields == 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.
There's no update to the definition for
metricset.rtt
to mark it as deprecated. I think it would make sense to add it in this PR. WDYT?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.
Good point, added it to the fields definition.