Skip to content

Commit

Permalink
chore: update GitHub Actions workflow for Docker build, improve permi…
Browse files Browse the repository at this point in the history
…ssions, and upgrade action versions
  • Loading branch information
caioricciuti committed Jan 8, 2025
1 parent 85ebcec commit a02edc3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 46 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,39 @@ jobs:
build:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'docker-false') }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=sha,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ghcr.io/${{ github.repository }}:latest
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=A simple UI for using ClickHouse self-hosted
org.opencontainers.image.licenses=MIT
- name: Log out from GitHub Container Registry
run: docker logout ghcr.io
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
56 changes: 26 additions & 30 deletions src/features/metrics/config/metricsConfig.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ChartConfig } from "@/components/ui/chart";
import {
HomeIcon,
TableIcon,
CombineIcon,
TerminalSquareIcon,
Settings2,
HardDriveIcon,
Expand Down Expand Up @@ -30,26 +28,20 @@ export interface MetricItem {
tiles?: number;
}


export type ChartTheme = {
light: string;
dark: string;
}

};

export type ChartDataConfig = {
label?: ReactNode;
icon?: ComponentType<{}>;
} & ({ color?: string; theme?: never } | { color?: never; theme: ChartTheme });



export type CustomChartConfig = {
indexBy: string;
[key: string]: ChartDataConfig | string | undefined;
}


indexBy: string;
[key: string]: ChartDataConfig | string | undefined;
};

export const metrics: Metrics[] = [
{
Expand All @@ -59,12 +51,16 @@ export const metrics: Metrics[] = [
icon: HomeIcon,
items: [
{
title: "Server Uptime (days)",
title: "Server Uptime",
query: `
-- set max decimal places to 2
SELECT
ROUND(uptime() / 86400, 2) AS uptime_days -- 86400 seconds in a day
SELECT
CONCAT(
CAST(ROUND(uptime() / 86400) AS String), ' d, ',
CAST(ROUND((uptime() % 86400) / 3600) AS String), ' h, ',
CAST(ROUND((uptime() % 3600) / 60) AS String), ' m'
) AS uptime_formatted
`,
type: "card",
description:
Expand Down Expand Up @@ -122,7 +118,7 @@ export const metrics: Metrics[] = [
GROUP BY day
ORDER BY day
`,
chartConfig: {
chartConfig: {
indexBy: "day",
query_count: {
label: "Query Count",
Expand Down Expand Up @@ -331,11 +327,11 @@ export const metrics: Metrics[] = [
chartType: "bar",
description:
"Granular distribution of query durations over the last 24 hours.",
chartConfig: {
chartConfig: {
indexBy: "duration_bucket",
query_count: {
label: "Query Count",
color: "hsl(var(--chart-1))",
color: "hsl(var(--chart-1))",
},
},
tiles: 2,
Expand All @@ -358,7 +354,7 @@ export const metrics: Metrics[] = [
indexBy: "minute",
qps: {
label: "QPS",
color: "hsl(var(--chart-3))",
color: "hsl(var(--chart-3))",
},
},
tiles: 2,
Expand Down Expand Up @@ -420,7 +416,7 @@ export const metrics: Metrics[] = [
type: "chart",
chartType: "line",
description: "CPU usage over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
cpu_usage: {
label: "CPU Usage",
Expand All @@ -443,7 +439,7 @@ export const metrics: Metrics[] = [
type: "chart",
chartType: "area",
description: "Memory usage over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
memory_usage: {
label: "Memory Usage",
Expand All @@ -467,7 +463,7 @@ export const metrics: Metrics[] = [
type: "chart",
chartType: "area",
description: "Threads usage over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
threads_running: {
label: "Threads Running",
Expand Down Expand Up @@ -495,7 +491,7 @@ ORDER BY
type: "chart",
chartType: "area",
description: "Network traffic over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
bytes_received: {
label: "Bytes Received",
Expand All @@ -518,11 +514,11 @@ ORDER BY
type: "chart",
chartType: "line",
description: "Average disk usage over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
disk_usage: {
label: "Disk Usage",
color: "hsl(var(--chart-6))",
color: "hsl(var(--chart-6))",
},
},
tiles: 2,
Expand All @@ -541,7 +537,7 @@ ORDER BY
type: "chart",
chartType: "line",
description: "Active Keep alive connections over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
active_connections: {
label: "Active Connections",
Expand Down Expand Up @@ -610,7 +606,7 @@ ORDER BY
type: "chart",
chartType: "area",
description: "Network traffic over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
send_bytes: {
label: "Send (bytes)",
Expand All @@ -635,7 +631,7 @@ ORDER BY
type: "chart",
chartType: "line",
description: "HTTP connections over the last hour.",
chartConfig: {
chartConfig: {
indexBy: "minute",
connections: {
label: "Connections",
Expand Down Expand Up @@ -765,7 +761,7 @@ ORDER BY
type: "chart",
chartType: "line",
description: "Count of exceptions recorded over the last 24 hours.",
chartConfig: {
chartConfig: {
indexBy: "hourERROR",
exception_count: {
label: "Exception Count",
Expand Down Expand Up @@ -797,4 +793,4 @@ ORDER BY
},
],
},
];
];

0 comments on commit a02edc3

Please sign in to comment.