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

Use Elasticsearch types in Cockroachdb module #17736

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libbeat/mapping/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ func (f Fields) getKeys(namespace string) []string {
} else {
keys = append(keys, field.Fields.getKeys(fieldName)...)
}
if field.ObjectType == "histogram" {
keys = append(keys, fieldName+".values")
keys = append(keys, fieldName+".counts")
}
}

return keys
Expand Down
4 changes: 4 additions & 0 deletions libbeat/tests/system/beat/beat.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,10 @@ def extract_fields(doc_list, name):
if field.get("type") in ["object", "geo_point"]:
dictfields.append(newName)

if field.get("type") == "object" and field.get("object_type") == "histogram":
fields.append(newName + ".counts")
fields.append(newName + ".values")

if field.get("type") == "alias":
aliases.append(newName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.sql_conns",
"field": "prometheus.sql_conns.value",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"type": "max"
}
Expand Down Expand Up @@ -274,7 +274,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.sql_select_count",
"field": "prometheus.sql_select_count.counter",
"id": "88d70bc0-9760-11e9-b3d5-07b0ab7d6354",
"type": "sum"
},
Expand Down Expand Up @@ -311,7 +311,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.sql_insert_count",
"field": "prometheus.sql_insert_count.counter",
"id": "02d89101-9761-11e9-b3d5-07b0ab7d6354",
"type": "sum"
},
Expand Down Expand Up @@ -345,7 +345,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.sql_update_count",
"field": "prometheus.sql_update_count.counter",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"type": "sum"
},
Expand Down Expand Up @@ -380,7 +380,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.sql_delete_count",
"field": "prometheus.sql_delete_count.counter",
"id": "03f6d241-9761-11e9-b3d5-07b0ab7d6354",
"type": "sum"
},
Expand Down Expand Up @@ -458,7 +458,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.replicas",
"field": "prometheus.replicas.value",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"type": "max"
}
Expand Down Expand Up @@ -528,7 +528,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.replicas_leaseholders",
"field": "prometheus.replicas_leaseholders.value",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"type": "max"
}
Expand Down Expand Up @@ -596,7 +596,7 @@
"line_width": "2",
"metrics": [
{
"field": "prometheus.metrics.ranges_underreplicated",
"field": "prometheus.ranges_underreplicated.value",
"id": "e4489e51-976b-11e9-b3d5-07b0ab7d6354",
"type": "max"
}
Expand All @@ -618,7 +618,7 @@
"line_width": "2",
"metrics": [
{
"field": "prometheus.metrics.ranges_overreplicated",
"field": "prometheus.ranges_overreplicated.value",
"id": "c938f9c1-976b-11e9-b3d5-07b0ab7d6354",
"type": "max"
}
Expand All @@ -640,7 +640,7 @@
"line_width": "2",
"metrics": [
{
"field": "prometheus.metrics.ranges_unavailable",
"field": "prometheus.ranges_unavailable.value",
"id": "0ed1bf81-976c-11e9-b3d5-07b0ab7d6354",
"type": "max"
}
Expand All @@ -662,7 +662,7 @@
"line_width": 1,
"metrics": [
{
"field": "prometheus.metrics.ranges",
"field": "prometheus.ranges.value",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"type": "max"
}
Expand Down Expand Up @@ -731,46 +731,11 @@
"metrics": [
{
"agg_with": "avg",
"field": "prometheus.metrics.raft_process_logcommit_latency_count",
"field": "prometheus.raft_process_logcommit_latency.histogram",
Copy link
Member Author

@jsoriano jsoriano Apr 15, 2020

Choose a reason for hiding this comment

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

Current dashboard is using sum and count to calculate the average of this value. I think it can make sense now to calculate percentiles, but I haven't managed to use histograms in TSVB yet. @exekias do you know if they are already supported?

Copy link
Member Author

@jsoriano jsoriano Apr 16, 2020

Choose a reason for hiding this comment

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

It works with other visualizations, I will go on with line graphs by now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, currently only Visualize supports this type

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 have replaced the graphs that were using sum and count to calculate averages and they are using 99th percentile now (as the CockroachDB admin UI does). It is quite ok now but the timings are in nanoseconds and I haven't found a way to format them.

"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"order": "desc",
"size": 1,
"type": "max"
},
{
"field": "61ca57f2-469d-11e7-af02-69e470af7417",
"id": "4346d3b0-976f-11e9-b3d5-07b0ab7d6354",
"type": "derivative",
"unit": ""
},
{
"field": "prometheus.metrics.raft_process_logcommit_latency_sum",
"id": "4a430120-976f-11e9-b3d5-07b0ab7d6354",
"type": "max",
"unit": ""
},
{
"field": "4a430120-976f-11e9-b3d5-07b0ab7d6354",
"id": "581519e0-9770-11e9-b3d5-07b0ab7d6354",
"type": "derivative",
"unit": ""
},
{
"id": "6574b730-9770-11e9-b3d5-07b0ab7d6354",
"script": "params.sum / params.count",
"type": "calculation",
"variables": [
{
"field": "581519e0-9770-11e9-b3d5-07b0ab7d6354",
"id": "6fbb54b0-9770-11e9-b3d5-07b0ab7d6354",
"name": "sum"
},
{
"field": "4346d3b0-976f-11e9-b3d5-07b0ab7d6354",
"id": "76cc90c0-9770-11e9-b3d5-07b0ab7d6354",
"name": "count"
}
]
}
],
"point_size": 1,
Expand Down Expand Up @@ -839,46 +804,11 @@
"metrics": [
{
"agg_with": "avg",
"field": "prometheus.metrics.raft_process_commandcommit_latency_count",
"field": "prometheus.raft_process_commandcommit_latency.histogram",
"id": "61ca57f2-469d-11e7-af02-69e470af7417",
"order": "desc",
"size": 1,
"type": "max"
},
{
"field": "61ca57f2-469d-11e7-af02-69e470af7417",
"id": "4346d3b0-976f-11e9-b3d5-07b0ab7d6354",
"type": "derivative",
"unit": ""
},
{
"field": "prometheus.metrics.raft_process_commandcommit_latency_sum",
"id": "4a430120-976f-11e9-b3d5-07b0ab7d6354",
"type": "max",
"unit": ""
},
{
"field": "4a430120-976f-11e9-b3d5-07b0ab7d6354",
"id": "581519e0-9770-11e9-b3d5-07b0ab7d6354",
"type": "derivative",
"unit": ""
},
{
"id": "6574b730-9770-11e9-b3d5-07b0ab7d6354",
"script": "params.sum / params.count",
"type": "calculation",
"variables": [
{
"field": "581519e0-9770-11e9-b3d5-07b0ab7d6354",
"id": "6fbb54b0-9770-11e9-b3d5-07b0ab7d6354",
"name": "sum"
},
{
"field": "4346d3b0-976f-11e9-b3d5-07b0ab7d6354",
"id": "76cc90c0-9770-11e9-b3d5-07b0ab7d6354",
"name": "count"
}
]
}
],
"point_size": 1,
Expand Down
13 changes: 0 additions & 13 deletions x-pack/metricbeat/module/cockroachdb/status/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
The CockroachDB `status` metricset collects metrics exposed by the
https://www.cockroachlabs.com/docs/v2.1/monitoring-and-alerting.html#prometheus-endpoint[Prometheus endpoint]
of CockroachDB.

WARNING: This metricset collects a large number of metrics, what can
significantly impact disk usage. Processors can be used to drop unused metrics
before they are stored. For example the following configuration will drop all
histogram buckets:
[source,yaml]
------------------------------------------------------------------------------
- module: cockroachdb
metricsets: ['status']
hosts: ['${data.host}:8080']
processors:
- drop_event.when.has_fields: ['prometheus.labels.le']
------------------------------------------------------------------------------
Loading