Skip to content

Commit

Permalink
Merge branch 'master' into ana/add-alert-for-gcpce-cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
yduartep committed Nov 7, 2024
2 parents 5e77d88 + b4993cb commit 3b91d7d
Show file tree
Hide file tree
Showing 20 changed files with 845 additions and 109 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/lint-mixins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: Mixin

permissions:
contents: read

on:
# To conserve resources we only run tests against main in PRs
pull_request:
branches:
- master

jobs:
check-for-changed-mixins:
name: Check for changes
runs-on: ubuntu-latest
outputs:
changed-mixins: ${{ steps.changed-mixins.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.18

- name: Install CI dependencies
run: make install-ci-deps

- name: Get changed mixins
id: changed-mixins
uses: tj-actions/changed-files@v44
with:
dir_names: true
dir_names_exclude_current_dir: true
dir_names_max_depth: 1
files: |
**-mixin/
**-observ-lib/
matrix: true

- name: List all changed mixins
run: echo '${{ steps.changed-mixins.outputs.all_changed_files }}'

lint-mixin:
name: Run Mixtool
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
pull-requests: write
repository-projects: write
timeout-minutes: 15
needs: [check-for-changed-mixins]
strategy:
matrix:
mixin: ${{ fromJSON(needs.check-for-changed-mixins.outputs.changed-mixins) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.18

- name: Install CI dependencies
run: make install-ci-deps

- name: Install Mixin dependencies
working-directory: ./${{ matrix.mixin }}
run: jb install

- name: Lint Mixin
working-directory: ./${{ matrix.mixin }}
run: mixtool lint mixin.libsonnet
70 changes: 70 additions & 0 deletions cilium-enterprise-mixin/alerts/ciliumAlerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,76 @@
},
],
},
{
name: 'Cilium Clustermesh',
rules: [
{
alert: 'CiliumAgentRemoteClusterNotReady',
expr: 'count(cilium_clustermesh_remote_cluster_readiness_status < 1) by (%s) > 0' % std.join(', ', (['source_cluster', 'target_cluster'] + $._config.alertAggregationLabels)),
labels: {
severity: 'critical',
},
annotations: {
summary: "Agent can't mesh with remote cluster.",
description: "Agent can't mesh with {{$labels.target_cluster}}",
},
'for': '5m',
},
{
alert: 'CiliumAgentRemoteClusterFailing',
expr: 'sum(rate(cilium_clustermesh_remote_cluster_failures[5m])) by (%s) > 0' % std.join(', ', (['source_cluster', 'target_cluster'] + $._config.alertAggregationLabels)),
labels: {
severity: 'critical',
},
annotations: {
summary: 'Agent fails to mesh with remote cluster.',
description: 'Agent fails to mesh with {{$labels.target_cluster}}',
},
'for': '5m',
},
],
},
{
name: 'Cilium Kvstoremesh',
rules: [
{
alert: 'CiliumKvstoremeshRemoteClusterNotReady',
expr: 'count(cilium_kvstoremesh_remote_cluster_readiness_status < 1) by (%s) > 0' % std.join(', ', (['source_cluster', 'target_cluster'] + $._config.alertAggregationLabels)),
labels: {
severity: 'critical',
},
annotations: {
summary: "Kvstoremesh can't mesh with remote cluster.",
description: "Kvstoremesh can't mesh with {{$labels.target_cluster}}",
},
'for': '5m',
},
{
alert: 'CiliumKvstoremeshRemoteClusterFailing',
expr: 'sum(rate(cilium_kvstoremesh_remote_cluster_failures[5m])) by (%s) > 0' % std.join(', ', (['source_cluster', 'target_cluster'] + $._config.alertAggregationLabels)),
labels: {
severity: 'critical',
},
annotations: {
summary: 'Kvstoremesh fails to mesh with remote cluster.',
description: 'Kvstoremesh fails to mesh with {{$labels.target_cluster}}',
},
'for': '5m',
},
{
alert: 'CiliumKvstoremeshErrors',
expr: 'sum(rate(cilium_kvstoremesh_kvstore_sync_errors_total[5m])) by (%s) > 0' % std.join(', ', (['source_cluster'] + $._config.alertAggregationLabels)),
labels: {
severity: 'critical',
},
annotations: {
summary: 'Kvstoremesh fails to mesh with remote cluster.',
description: 'Kvstoremesh fails to mesh with {{$labels.target_cluster}}',
},
'for': '5m',
},
],
},
],
},
}
6 changes: 6 additions & 0 deletions cilium-enterprise-mixin/jsonnetfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1,
"dependencies": [],
"legacyImports": false
}

3 changes: 2 additions & 1 deletion common-lib/common/panels/cpu/stat/count.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ base {

stylize(allLayers=true):
(if allLayers then super.stylize() else {})
+ generic.info.stylize(allLayers=false),
+ generic.info.stylize(allLayers=false)
+ g.panel.stat.standardOptions.withUnit('none'),

}
8 changes: 7 additions & 1 deletion common-lib/common/panels/disk/table/usage.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,13 @@ base {
fieldOverride.byName.new('Available')
+ fieldOverride.byName.withProperty('custom.width', '80'),
fieldOverride.byName.new('Used, %')
+ fieldOverride.byName.withProperty('custom.displayMode', 'basic')
+ fieldOverride.byName.withProperty(
'custom.cellOptions', {
type: 'gauge',
mode: 'basic',
valueDisplayMode: 'text',
}
)
+ fieldOverride.byName.withPropertiesFromOptions(
table.standardOptions.withMax(1)
+ table.standardOptions.withMin(0)
Expand Down
21 changes: 14 additions & 7 deletions common-lib/common/variables/variables.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,21 @@ local utils = import '../utils.libsonnet';
[root.datasources.prometheus]
+ variablesFromLabels(groupLabels, instanceLabels, filteringSelector, multiInstance=false),
queriesSelectorAdvancedSyntax:
'%s' % [
utils.labelsToPromQLSelectorAdvanced(groupLabels + instanceLabels),
],
std.join(
',',
std.filter(function(x) std.length(x) > 0, [
filteringSelector,
utils.labelsToPromQLSelectorAdvanced(groupLabels + instanceLabels),
])
),
queriesSelector:
'%s,%s' % [
filteringSelector,
utils.labelsToPromQLSelector(groupLabels + instanceLabels),
],
std.join(
',',
std.filter(function(x) std.length(x) > 0, [
filteringSelector,
utils.labelsToPromQLSelector(groupLabels + instanceLabels),
])
),

}
+ if enableLokiLogs then self.withLokiLogs() else {},
Expand Down
2 changes: 1 addition & 1 deletion logs-lib/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"source": {
"git": {
"remote": "https://github.com/grafana/grafonnet.git",
"subdir": "gen/grafonnet-v10.0.0"
"subdir": "gen/grafonnet-v11.0.0"
}
},
"version": "main"
Expand Down
26 changes: 14 additions & 12 deletions logs-lib/logs/dashboards.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ function(
+ g.dashboard.withUid(g.util.string.slugify(title))
+ g.dashboard.withVariables(variables.toArray)
+ g.dashboard.withPanels(
(
if showLogsVolume then
[panels.logsVolume
+ g.panel.timeSeries.gridPos.withH(6)
+ g.panel.timeSeries.gridPos.withW(24)]
else []
g.util.grid.wrapPanels(
(
if showLogsVolume then
[panels.logsVolume
+ g.panel.timeSeries.gridPos.withH(6)
+ g.panel.timeSeries.gridPos.withW(24)]
else []
)
+
[
panels.logs
+ g.panel.logs.gridPos.withH(18)
+ g.panel.logs.gridPos.withW(24),
]
)
+
[
panels.logs
+ g.panel.logs.gridPos.withH(18)
+ g.panel.logs.gridPos.withW(24),
]
),
}
2 changes: 1 addition & 1 deletion logs-lib/logs/g.libsonnet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import 'github.com/grafana/grafonnet/gen/grafonnet-v10.0.0/main.libsonnet'
import 'github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet'
6 changes: 6 additions & 0 deletions nginx-mixin/.lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ exclusions:
reason: "Units are undefined where panel description is clear, and the entity being graphed is not available in default set of available units."
template-datasource-rule:
reason: "mixtool upgrade made this rule stricter. TODO: Fix errors and remove the warning exclusion"
template-job-rule:
reason: "NGINX Overview dashboard does not use a job label"
target-job-rule:
reason: "NGINX Overview dashboard does not use a job label"
target-rate-interval-rule:
reason: "using $__rate_interval breaks the dashboard hence using [5m] instead"
10 changes: 4 additions & 6 deletions nginx-mixin/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Nginx Mixin

This mixin is a thin veneer over the dashboard designed and published by [Ward Bekker](https://grafana.com/orgs/wardbekker1) in the [Grafana dashboards library](https://grafana.com/grafana/dashboards/12559).
This mixin is a thin veneer over the dashboard designed and published by [Ward Bekker](https://grafana.com/orgs/wardbekker1) in the [Grafana dashboards library](https://grafana.com/grafana/dashboards/12559) and the metrics dashboard is collected from the [official NGINX exporter repository](https://github.com/nginxinc/nginx-prometheus-exporter/blob/main/grafana/dashboard.png).

Specifically this mixin adds a configurable `cluster` variable to the dashboard in order to support it's use in one or many kubernetes clusters.

The mixin uses revision 14 of the dashboard currently. Change `DASHBOARD_REV` in the Makefile to fetch a different revision of the dashboard.

The Nginx mixin contains the following dashboard:
The Nginx mixin contains the following dashboards:

- Nginx...
- **Nginx Overview**: This dashboard provides a comprehensive view of various NGINX metrics, allowing you to monitor performance and health across multiple dimensions.

# Nginx overview

...
- **Nginx Logs**: This dashboard showcases panels powered by Logs, providing insights into log data to help diagnose issues and track the operational status of your NGINX deployments.

## Install tools

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2190,8 +2190,8 @@
]
},
"timezone": "",
"title": "Nginx access logs",
"title": "NGINX Logs",
"uid": "T512JVH7z",
"version": 4,
"weekStart": ""
}
}
Loading

0 comments on commit 3b91d7d

Please sign in to comment.