Skip to content

Commit

Permalink
Mixin: Allow specifying an instance name filter
Browse files Browse the repository at this point in the history
This commit allow specifying the instance name filter, in order to
filter the datasources shown on the dashboards.

For example, when generating the dashboards one can do the following
(i.e in config.libsonnet)

```
  dashboard+:: {
    prefix: 'Thanos / ',
    ...
    instance_name_filter: '/EU.*/'
```

Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com>
  • Loading branch information
jacobbaungard committed Apr 12, 2023
1 parent 6cd8edd commit a955827
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6185](https://github.com/thanos-io/thanos/pull/6185) Tracing: tracing in OTLP support configuring service_name.
- [#6192](https://github.com/thanos-io/thanos/pull/6192) Store: add flag `bucket-web-label` to select the label to use as timeline title in web UI
- [#6167](https://github.com/thanos-io/thanos/pull/6195) Receive: add flag `tsdb.too-far-in-future.time-window` to prevent clock skewed samples to pollute TSDB head and block all valid incoming samples.
- [#6273](https://github.com/thanos-io/thanos/pull/6273) Mixin: Allow specifying an instance name filter in dashboards

### Fixed

Expand Down
9 changes: 8 additions & 1 deletion mixin/dashboards/defaults.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local utils = import '../lib/utils.libsonnet';
prefix: 'Thanos / ',
tags: error 'must provide dashboard tags',
timezone: 'UTC',
instance_name_filter: '',
},

// Automatically add a uid to each dashboard based on the base64 encoding
Expand Down Expand Up @@ -37,7 +38,13 @@ local utils = import '../lib/utils.libsonnet';
],

templating+: {
list+: [
// Add optional filter to the datasource template variable
list: [
if variable.name == 'datasource'
then variable { regex: thanos.dashboard.instance_name_filter }
else variable
for variable in super.list
] + [
template.interval(
'interval',
'5m,10m,30m,1h,6h,12h,auto',
Expand Down

0 comments on commit a955827

Please sign in to comment.