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

mixin: adhere to RFC 1123 compatible component naming #4883

Merged
merged 4 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#4918](https://github.com/thanos-io/thanos/pull/4918) Tracing: Fixing force tracing with Jaeger.
- [#4879](https://github.com/thanos-io/thanos/pull/4879) Bucket verify: Fixed bug causing wrong number of blocks to be checked.
- [#4908](https://github.com/thanos-io/thanos/pull/4908) UI: Show 'minus' icon and add tooltip when store min / max time is not available.
- [#4883](https://github.com/thanos-io/thanos/pull/4883) Mixin: adhere to RFC 1123 compatible component naming.

## [v0.24.0](https://github.com/thanos-io/thanos/tree/release-0.24) - 2021.12.22

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ In the code and documentation prefer non-offensive terminology, for example:

Thanos is a distributed system comprised of several services and CLI tools as listed [here](cmd/thanos).

When we refer to them in a technical capacity we use the verbal form: `store`, `compact`, `rule`, `query`, `query_frontend`. This includes:
When we refer to them in a technical capacity we use the verbal form: `store`, `compact`, `rule`, `query`, `query-frontend`. This includes:

* Code
* Metrics
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ examples: jsonnet-vendor jsonnet-format ${THANOS_MIXIN}/README.md examples/alert
examples/tmp:
-rm -rf examples/tmp/
-mkdir -p examples/tmp/
$(JSONNET) -J ${JSONNET_VENDOR_DIR} -m examples/tmp/ ${THANOS_MIXIN}/separated_alerts.jsonnet | xargs -I{} sh -c 'cat {} | $(GOJSONTOYAML) > {}.yaml; rm -f {}' -- {}
$(JSONNET) -J ${JSONNET_VENDOR_DIR} -m examples/tmp/ ${THANOS_MIXIN}/separated-alerts.jsonnet | xargs -I{} sh -c 'cat {} | $(GOJSONTOYAML) > {}.yaml; rm -f {}' -- {}

.PHONY: examples/dashboards # to keep examples/dashboards/dashboards.md.
examples/dashboards: $(JSONNET) ${THANOS_MIXIN}/mixin.libsonnet ${THANOS_MIXIN}/config.libsonnet ${THANOS_MIXIN}/dashboards/*
Expand Down Expand Up @@ -414,6 +414,9 @@ jsonnet-format: $(JSONNETFMT)
jsonnet-lint: $(JSONNET_LINT) jsonnet-vendor
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
xargs -n 1 -- $(JSONNET_LINT) -J ${JSONNET_VENDOR_DIR}
find ./mixin -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | sed -E \
-e 's/.*\///' \
-e '/^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\.(lib|j)sonnet$$/!{s/(.*)/Non-RFC1123 filename: \1/;q1};{d}'

.PHONY: example-rules-lint
example-rules-lint: $(PROMTOOL) examples/alerts/alerts.yaml examples/alerts/rules.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,6 @@
},
"timezone": "UTC",
"title": "Thanos / BucketReplicate",
"uid": "49f644ecf8e31dd1a5084ae2a5f10e80",
"uid": "65ffb86cd2688b9e4db4d1ea231a5a9a",
"version": 0
}
4 changes: 2 additions & 2 deletions examples/dashboards/dashboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ There exists Grafana dashboards for each component (not all of them complete) ta
- [Thanos Overview](overview.json)
- [Thanos Compact](compact.json)
- [Thanos Querier](query.json)
- [Thanos Query Frontend](query_frontend.json)
- [Thanos Query Frontend](query-frontend.json)
- [Thanos Store](store.json)
- [Thanos Receiver](receive.json)
- [Thanos Sidecar](sidecar.json)
- [Thanos Ruler](rule.json)
- [Thanos Replicate](bucket_replicate.json)
- [Thanos Replicate](bucket-replicate.json)

You can import them via `Import -> Paste JSON` in Grafana. These dashboards require Grafana 5 or above, importing them in older versions are known not to work.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,6 @@
},
"timezone": "UTC",
"title": "Thanos / Query Frontend",
"uid": "303c4e660a475c4c8cf6aee97da3a24a",
"uid": "7c68ed2ef2355474f058dd27f0471f7a",
"version": 0
}
2 changes: 1 addition & 1 deletion mixin/alerts/absent.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local capitalize(str) = std.asciiUpper(std.substr(str, 0, 1)) + std.asciiLower(std.substr(str, 1, std.length(str)));
local titlize(str) = std.join('', std.map(capitalize, std.split(str, '_')));

local components = ['query', 'receive', 'rule', 'compact', 'store', 'bucket_replicate', 'sidecar'];
local components = ['query', 'receive', 'rule', 'compact', 'store', 'bucket-replicate', 'sidecar'];
{
local thanos = self,

Expand Down
4 changes: 2 additions & 2 deletions mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
(import 'sidecar.libsonnet') +
(import 'store.libsonnet') +
(import 'rule.libsonnet') +
(import 'bucket_replicate.libsonnet') +
(import 'bucket-replicate.libsonnet') +
(import 'absent.libsonnet') +
(import 'add_runbook_links.libsonnet')
(import 'add-runbook-links.libsonnet')
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local g = import '../lib/thanos-grafana-builder/builder.libsonnet';
},
},
grafanaDashboards+:: {
[if thanos.bucketReplicate != null then 'bucket_replicate.json']:
[if thanos.bucketReplicate != null then 'bucket-replicate.json']:
g.dashboard(thanos.bucketReplicate.title)
.addRow(
g.row('Bucket Replicate Runs')
Expand Down
4 changes: 2 additions & 2 deletions mixin/dashboards/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(import 'query.libsonnet') +
(import 'query_frontend.libsonnet') +
(import 'query-frontend.libsonnet') +
(import 'store.libsonnet') +
(import 'sidecar.libsonnet') +
(import 'receive.libsonnet') +
(import 'rule.libsonnet') +
(import 'compact.libsonnet') +
(import 'bucket_replicate.libsonnet') +
(import 'bucket-replicate.libsonnet') +
(import 'overview.libsonnet') +
(import 'defaults.libsonnet')
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local utils = import '../lib/utils.libsonnet';
},
},
grafanaDashboards+:: {
[if thanos.queryFrontend != null then 'query_frontend.json']:
[if thanos.queryFrontend != null then 'query-frontend.json']:
local queryFrontendHandlerSelector = utils.joinLabels([thanos.queryFrontend.dashboard.selector, 'handler="query-frontend"']);
local queryFrontendOpSelector = utils.joinLabels([thanos.queryFrontend.dashboard.selector, 'op="query_range"']);
g.dashboard(thanos.queryFrontend.title)
Expand Down
2 changes: 1 addition & 1 deletion mixin/lib/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

toCamelCase(parts): std.join('', [parts[0], self.firstCharUppercase(parts)]),

componentParts(name): std.split(name, '_'),
componentParts(name): std.split(name, '-'),

sanitizeComponentName(name): if std.length(self.componentParts(name)) > 1 then self.toCamelCase(self.componentParts(name)) else name,
}
2 changes: 1 addition & 1 deletion mixin/rules/rules.libsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(import 'query.libsonnet') +
(import 'receive.libsonnet') +
(import 'store.libsonnet') +
(import 'bucket_replicate.libsonnet')
(import 'bucket-replicate.libsonnet')
File renamed without changes.