Skip to content

Commit

Permalink
Add labels to rules UI (thanos-io#8009)
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros authored Dec 19, 2024
1 parent b881f6c commit 4a84785
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .bingo/gotesplit.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github.com/Songmu/gotesplit v0.2.1 h1:qJFvR75nJpeKyMQFwyDtFrcc6zDWhrHAkks7DvM8oLo=
github.com/Songmu/gotesplit v0.2.1/go.mod h1:sVBfmLT26b1H5VhUpq8cRhCVK75GAmW9c8r2NiK0gzk=
github.com/jstemmer/go-junit-report v1.0.0 h1:8X1gzZpR+nVQLAht+L/foqOeX2l9DTZoaIPbEQHxsds=
github.com/jstemmer/go-junit-report v1.0.0/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 h1:w8s32wxx3sY+OjLlv9qltkLU5yvJzxjjgiHWLjdIcw4=
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
6 changes: 6 additions & 0 deletions pkg/ui/react-app/src/pages/rules/RulesContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export const RulesContent: FC<RouteComponentProps & RulesContentProps> = ({ resp
<td>
<GraphExpressionLink title="record" text={r.name} expr={r.name} />
<GraphExpressionLink title="expr" text={r.query} expr={r.query} />
<strong>labels:</strong>
{Object.entries(r.labels).map(([key, value]) => (
<div className="ml-4" key={key}>
{key}: {value}
</div>
))}
</td>
)}
<td>
Expand Down
6 changes: 3 additions & 3 deletions pkg/ui/static/react/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "./static/css/main.17d667f4.css",
"main.js": "./static/js/main.77f2d0fe.js",
"main.js": "./static/js/main.1649da60.js",
"static/media/codicon.ttf": "./static/media/codicon.b3726f0165bf67ac6849.ttf",
"index.html": "./index.html",
"static/media/index.cjs": "./static/media/index.cd351d7c31d0d3fccf96.cjs",
"main.17d667f4.css.map": "./static/css/main.17d667f4.css.map",
"main.77f2d0fe.js.map": "./static/js/main.77f2d0fe.js.map"
"main.1649da60.js.map": "./static/js/main.1649da60.js.map"
},
"entrypoints": [
"static/css/main.17d667f4.css",
"static/js/main.77f2d0fe.js"
"static/js/main.1649da60.js"
]
}
2 changes: 1 addition & 1 deletion pkg/ui/static/react/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><script>const GLOBAL_PATH_PREFIX="{{ pathPrefix }}"</script><script>const THANOS_COMPONENT="{{ .Component }}",THANOS_QUERY_URL="{{ .queryURL }}",THANOS_TENANT_HEADER="{{ .tenantHeader }}",THANOS_DEFAULT_TENANT="{{ .defaultTenant }}",THANOS_DISPLAY_TENANT_BOX="{{ .displayTenantBox }}"</script><link rel="manifest" href="./manifest.json"/><title>Thanos | Highly available Prometheus setup</title><script defer="defer" src="./static/js/main.77f2d0fe.js"></script><link href="./static/css/main.17d667f4.css" rel="stylesheet"></head><body class="bootstrap"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><script>const GLOBAL_PATH_PREFIX="{{ pathPrefix }}"</script><script>const THANOS_COMPONENT="{{ .Component }}",THANOS_QUERY_URL="{{ .queryURL }}",THANOS_TENANT_HEADER="{{ .tenantHeader }}",THANOS_DEFAULT_TENANT="{{ .defaultTenant }}",THANOS_DISPLAY_TENANT_BOX="{{ .displayTenantBox }}"</script><link rel="manifest" href="./manifest.json"/><title>Thanos | Highly available Prometheus setup</title><script defer="defer" src="./static/js/main.1649da60.js"></script><link href="./static/css/main.17d667f4.css" rel="stylesheet"></head><body class="bootstrap"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,20 @@ fi
# Setup alert / rules config file.
cat >data/rules.yml <<-EOF
groups:
- name: example
rules:
- record: job:go_threads:sum
expr: sum(go_threads) by (job)
- name: example
rules:
- record: job:go_threads:sum
expr: sum(go_threads) by (job)
labels:
test: label
- name: alert
rules:
- alert: HighGoThreads
expr: sum(go_threads) by (job) > 100
for: 1m
labels:
severity: page
EOF

STORES=""
Expand Down

0 comments on commit 4a84785

Please sign in to comment.