Skip to content

Commit

Permalink
Merge pull request #286 from kakkoyun/add_example_recording_rules
Browse files Browse the repository at this point in the history
Add first Telemeter recording rules
  • Loading branch information
openshift-merge-robot committed Dec 19, 2019
2 parents 24d6d00 + b415e9a commit 04e8962
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/data-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ For the OpenShift 4 Developer Preview we will be sending back these exact attrib
'{__name__="noobaa_total_usage"}',
// console_url is the url of the console running on the cluster.
'{__name__="console_url"}',
// cluster:network_attachment_definition_instances:max" gives max no of instance
// cluster:network_attachment_definition_instances:max" gives max no of instance
//in the cluster that are annotated with k8s.v1.cni.cncf.io/networks, labelled by networks.
'{__name__="cluster:network_attachment_definition_instances:max"}',
// cluster:network_attachment_definition_enabled_instance_up informs (1 or 0) if the cluster has
// cluster:network_attachment_definition_enabled_instance_up informs (1 or 0) if the cluster has
//at least max of one instance with k8s.v1.cni.cncf.io/networks annotation, labelled by networks (any or sriov).
'{__name__="cluster:network_attachment_definition_enabled_instance_up:max"}',
// insightsclient_request_send tracks the number of metrics sends.
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/telemeter/metrics.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@
'{__name__="noobaa_total_usage"}',
// console_url is the url of the console running on the cluster.
'{__name__="console_url"}',
// cluster:network_attachment_definition_instances:max" gives max no of instance
// cluster:network_attachment_definition_instances:max" gives max no of instance
//in the cluster that are annotated with k8s.v1.cni.cncf.io/networks, labelled by networks.
'{__name__="cluster:network_attachment_definition_instances:max"}',
// cluster:network_attachment_definition_enabled_instance_up informs (1 or 0) if the cluster has
// cluster:network_attachment_definition_enabled_instance_up informs (1 or 0) if the cluster has
//at least max of one instance with k8s.v1.cni.cncf.io/networks annotation, labelled by networks (any or sriov).
'{__name__="cluster:network_attachment_definition_enabled_instance_up:max"}',
// insightsclient_request_send tracks the number of metrics sends.
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/telemeter/prometheus/kubernetes.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
serviceAccount.mixin.metadata.withNamespace($._config.namespace) +
serviceAccount.mixin.metadata.withAnnotations({
// TODO: Remove observatorium-thanos-querier once we have a separate clusterRole
'serviceaccounts.openshift.io/oauth-redirectreference.observatorium-thanos-querier':'{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"observatorium-thanos-querier"}}',
'serviceaccounts.openshift.io/oauth-redirectreference.observatorium-thanos-querier-cache':'{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"observatorium-thanos-querier-cache"}}',
'serviceaccounts.openshift.io/oauth-redirectreference.observatorium-thanos-querier': '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"observatorium-thanos-querier"}}',
'serviceaccounts.openshift.io/oauth-redirectreference.observatorium-thanos-querier-cache': '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"observatorium-thanos-querier-cache"}}',
'serviceaccounts.openshift.io/oauth-redirectreference.prometheus-k8s': '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"prometheus-telemeter"}}',
'serviceaccounts.openshift.io/oauth-redirectreference.observatorium-jaeger': '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"observatorium-jaeger"}}',
}),
Expand Down
31 changes: 31 additions & 0 deletions jsonnet/telemeter/rules.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
prometheus+:: {
recordingrules+: {
groups+: [
{
name: 'telemeter.rules',
rules: [
{
record: 'name_reason:cluster_operator_degraded:count',
expr: |||
count by (name,reason) (cluster_operator_conditions{condition="Degraded"} == 1)
|||,
},
{
record: 'name_reason:cluster_operator_unavailable:count',
expr: |||
count by (name,reason) (cluster_operator_conditions{condition="Available"} == 0)
|||,
},
{
record: 'id_code:apiserver_request_error_rate_sum:max',
expr: |||
sort_desc(max by (_id,code) (code:apiserver_request_count:rate:sum{code=~"(4|5)\\d\\d"}) > 0.5)
|||,
},
],
},
],
},
},
}

0 comments on commit 04e8962

Please sign in to comment.