From 6a8890e57cbcd734e066a4d26597f2800ee3e1f3 Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 17 Apr 2024 17:38:53 +0900 Subject: [PATCH 1/5] =?UTF-8?q?actions/setup-go=20=E3=82=92=20v5=20?= =?UTF-8?q?=E3=81=AB=E4=B8=8A=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 81 +++++++++++++++++------------------ CHANGES.md | 7 ++- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 10354e8..bdb37bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,53 +3,52 @@ name: Release Build on: push: tags: - - '*' + - "*" jobs: - build: name: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version-file: "./go.mod" + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "./go.mod" - - run: go install github.com/tcnksm/ghr@latest + - run: go install github.com/tcnksm/ghr@latest - - name: Build - run: | - VERSION=$(git describe --tag --abbrev=0) - REVISION=$(git rev-parse --short HEAD) - GOOS=linux GOARCH=amd64 go build \ - -o dist/sora_exporter_linux_amd64-${VERSION} \ - -ldflags "\ - -X github.com/prometheus/common/version.Version=${VERSION} \ - -X github.com/prometheus/common/version.Revision=${REVISION} \ - -X github.com/prometheus/common/version.Branch=main \ - -X github.com/prometheus/common/version.BuildUser=shiguredo \ - -X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \ - " \ - main.go - GOOS=linux GOARCH=arm64 go build \ - -o dist/sora_exporter_linux_arm64-${VERSION} \ - -ldflags "\ - -X github.com/prometheus/common/version.Version=${VERSION} \ - -X github.com/prometheus/common/version.Revision=${REVISION} \ - -X github.com/prometheus/common/version.Branch=main \ - -X github.com/prometheus/common/version.BuildUser=shiguredo \ - -X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \ - " \ - main.go - gzip dist/* - - name: Release - run: | - ghr -t "${{ secrets.GITHUB_TOKEN }}" \ - -u "${{ github.repository_owner }}" \ - -r "sora_exporter" \ - -n "${{ github.ref }}" \ - --replace "${GITHUB_REF##*/}" \ - dist/ + - name: Build + run: | + VERSION=$(git describe --tag --abbrev=0) + REVISION=$(git rev-parse --short HEAD) + GOOS=linux GOARCH=amd64 go build \ + -o dist/sora_exporter_linux_amd64-${VERSION} \ + -ldflags "\ + -X github.com/prometheus/common/version.Version=${VERSION} \ + -X github.com/prometheus/common/version.Revision=${REVISION} \ + -X github.com/prometheus/common/version.Branch=main \ + -X github.com/prometheus/common/version.BuildUser=shiguredo \ + -X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \ + " \ + main.go + GOOS=linux GOARCH=arm64 go build \ + -o dist/sora_exporter_linux_arm64-${VERSION} \ + -ldflags "\ + -X github.com/prometheus/common/version.Version=${VERSION} \ + -X github.com/prometheus/common/version.Revision=${REVISION} \ + -X github.com/prometheus/common/version.Branch=main \ + -X github.com/prometheus/common/version.BuildUser=shiguredo \ + -X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \ + " \ + main.go + gzip dist/* + - name: Release + run: | + ghr -t "${{ secrets.GITHUB_TOKEN }}" \ + -u "${{ github.repository_owner }}" \ + -r "sora_exporter" \ + -n "${{ github.ref }}" \ + --replace "${GITHUB_REF##*/}" \ + dist/ diff --git a/CHANGES.md b/CHANGES.md index be1dd1b..a6dc1fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # CHANGES +## develop + +- [UPDATE] CI の `actions/setup-go` を `v5` に上げる + - @tnamao + ## 2024.4.0 - [CHANGE] クラスターリレーのメトリクス名を変更する @@ -10,7 +15,7 @@ - 送受信パケット数 - `sora_cluster_relay_received_packets` を `sora_cluster_relay_recived_packets_total` に変更する - `sora_cluster_relay_sent_packets` を `sora_cluster_relay_sent_packets_total` に変更する - @tnamao + - @tnamao ## 2024.3.0 From e9efba31b3d3f05a3b173059143ef498b6f648cf Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 5 Jun 2024 17:14:06 +0900 Subject: [PATCH 2/5] =?UTF-8?q?Stats=20Webhook=20=E3=81=AE=E7=B5=B1?= =?UTF-8?q?=E8=A8=88=E6=83=85=E5=A0=B1=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collector/sora_api.go | 2 ++ collector/webhook.go | 5 +++++ main_test.go | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/collector/sora_api.go b/collector/sora_api.go index 09c1576..2d30d28 100644 --- a/collector/sora_api.go +++ b/collector/sora_api.go @@ -37,6 +37,8 @@ type soraWebhookReport struct { TotalFailedSessionWebhook int64 `json:"total_failed_session_webhook"` TotalSuccessfulEventWebhook int64 `json:"total_successful_event_webhook"` TotalFailedEventWebhook int64 `json:"total_failed_event_webhook"` + TotalSuccessfulStatsWebhook int64 `json:"total_successful_stats_webhook"` + TotalFailedStatsWebhook int64 `json:"total_failed_stats_webhook"` } type soraClientStatistics struct { diff --git a/collector/webhook.go b/collector/webhook.go index 44c5a89..d7c5cee 100644 --- a/collector/webhook.go +++ b/collector/webhook.go @@ -8,6 +8,7 @@ var ( totalAuthWebhook: newDescWithLabel("auth_webhook_total", "The total number of auth webhook.", []string{"state"}), totalSessionWebhook: newDescWithLabel("session_webhook_total", "The total number of session webhook.", []string{"state"}), totalEventWebhook: newDescWithLabel("event_webhook_total", "The total number of event webhook.", []string{"state"}), + totalStatsWebhook: newDescWithLabel("stats_webhook_total", "The total number of stats webhook.", []string{"state"}), } ) @@ -16,6 +17,7 @@ type WebhookMetrics struct { totalAuthWebhook *prometheus.Desc totalSessionWebhook *prometheus.Desc totalEventWebhook *prometheus.Desc + totalStatsWebhook *prometheus.Desc } func (m *WebhookMetrics) Describe(ch chan<- *prometheus.Desc) { @@ -23,6 +25,7 @@ func (m *WebhookMetrics) Describe(ch chan<- *prometheus.Desc) { ch <- m.totalAuthWebhook ch <- m.totalSessionWebhook ch <- m.totalEventWebhook + ch <- m.totalStatsWebhook } func (m *WebhookMetrics) Collect(ch chan<- prometheus.Metric, report soraWebhookReport) { @@ -34,4 +37,6 @@ func (m *WebhookMetrics) Collect(ch chan<- prometheus.Metric, report soraWebhook ch <- newCounter(m.totalSessionWebhook, float64(report.TotalFailedSessionWebhook), "failed") ch <- newCounter(m.totalEventWebhook, float64(report.TotalSuccessfulEventWebhook), "successful") ch <- newCounter(m.totalEventWebhook, float64(report.TotalFailedEventWebhook), "failed") + ch <- newCounter(m.totalStatsWebhook, float64(report.TotalSuccessfulStatsWebhook), "successful") + ch <- newCounter(m.totalStatsWebhook, float64(report.TotalFailedStatsWebhook), "failed") } diff --git a/main_test.go b/main_test.go index e8c88cc..40c1b1e 100644 --- a/main_test.go +++ b/main_test.go @@ -153,6 +153,7 @@ var ( "total_failed_connections": 0, "total_failed_event_webhook": 94, "total_failed_session_webhook": 95, + "total_failed_stats_webhook": 99, "total_ongoing_connections": 0, "total_received_invalid_turn_tcp_packet": 0, "total_session_created": 1, @@ -161,6 +162,7 @@ var ( "total_successful_connections": 2, "total_successful_event_webhook": 97, "total_successful_session_webhook": 98, + "total_successful_stats_webhook": 100, "total_turn_tcp_connections": 2, "total_turn_udp_connections": 0, "version": "2022.1.0-canary.28" @@ -398,6 +400,7 @@ func TestMinimumMetrics(t *testing.T) { "total_failed_connections": 100, "total_failed_event_webhook": 94, "total_failed_session_webhook": 95, + "total_failed_stats_webhook": 99, "total_ongoing_connections": 88, "total_received_invalid_turn_tcp_packet": 123, "total_session_created": 111, @@ -406,6 +409,7 @@ func TestMinimumMetrics(t *testing.T) { "total_successful_connections": 333, "total_successful_event_webhook": 97, "total_successful_session_webhook": 98, + "total_successful_stats_webhook": 100, "total_turn_tcp_connections": 444, "total_turn_udp_connections": 555, "version": "2022.1.0-canary.28" From 40f26560c3f53e23d9c75e27e251d25882ee2e4d Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 5 Jun 2024 17:14:32 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE?= =?UTF-8?q?=E6=9C=9F=E5=BE=85=E5=80=A4=E3=82=92=20Stats=20Webhook=20?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/maximum.metrics | 4 ++++ test/minimum.metrics | 4 ++++ test/sora_client_enabled.metrics | 4 ++++ test/sora_cluster_metrics_enabled.metrics | 4 ++++ test/sora_connection_error_enabled.metrics | 4 ++++ test/sora_erlang_vm_enabled.metrics | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/test/maximum.metrics b/test/maximum.metrics index e7330ef..1138339 100644 --- a/test/maximum.metrics +++ b/test/maximum.metrics @@ -191,6 +191,10 @@ sora_session_total{state="destroyed"} 0 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 diff --git a/test/minimum.metrics b/test/minimum.metrics index 6be8558..b88e5dd 100644 --- a/test/minimum.metrics +++ b/test/minimum.metrics @@ -45,6 +45,10 @@ sora_session_total{state="destroyed"} 222 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 diff --git a/test/sora_client_enabled.metrics b/test/sora_client_enabled.metrics index 6498602..0b2877a 100644 --- a/test/sora_client_enabled.metrics +++ b/test/sora_client_enabled.metrics @@ -76,6 +76,10 @@ sora_session_total{state="destroyed"} 0 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 diff --git a/test/sora_cluster_metrics_enabled.metrics b/test/sora_cluster_metrics_enabled.metrics index 15648b5..d62ef9a 100644 --- a/test/sora_cluster_metrics_enabled.metrics +++ b/test/sora_cluster_metrics_enabled.metrics @@ -78,6 +78,10 @@ sora_session_total{state="destroyed"} 0 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 diff --git a/test/sora_connection_error_enabled.metrics b/test/sora_connection_error_enabled.metrics index 0b816d8..105a911 100644 --- a/test/sora_connection_error_enabled.metrics +++ b/test/sora_connection_error_enabled.metrics @@ -52,6 +52,10 @@ sora_session_total{state="destroyed"} 0 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 diff --git a/test/sora_erlang_vm_enabled.metrics b/test/sora_erlang_vm_enabled.metrics index 45b94e5..0d91a4e 100644 --- a/test/sora_erlang_vm_enabled.metrics +++ b/test/sora_erlang_vm_enabled.metrics @@ -129,6 +129,10 @@ sora_session_total{state="destroyed"} 0 # TYPE sora_session_webhook_total counter sora_session_webhook_total{state="failed"} 95 sora_session_webhook_total{state="successful"} 98 +# HELP sora_stats_webhook_total The total number of stats webhook. +# TYPE sora_stats_webhook_total counter +sora_stats_webhook_total{state="failed"} 99 +sora_stats_webhook_total{state="successful"} 100 # HELP sora_successful_auth_webhook_total The total number of successful auth webhook. # TYPE sora_successful_auth_webhook_total counter sora_successful_auth_webhook_total{state="allowed"} 91 From 353bab0f942e3dd495c4865ef029bf1504481f35 Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 5 Jun 2024 17:17:22 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=81=AB=E8=BF=BD=E8=A8=98=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a6dc1fb..03e6176 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,9 @@ ## develop +- [ADD] Sora の Stats Webhook の統計情報に対応する + - `sora_stats_webhook_total` メトリクスを追加し、ラベルに `successful` `failed` を設ける + - @tnamao - [UPDATE] CI の `actions/setup-go` を `v5` に上げる - @tnamao From 3a93edda231ec99567aad3905ca4aa4e46a7722e Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 5 Jun 2024 17:41:48 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=81=AB=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92?= =?UTF-8?q?=E5=8F=8D=E6=98=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 03e6176..ede8629 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # CHANGES -## develop +## 2024.5.0 - [ADD] Sora の Stats Webhook の統計情報に対応する - `sora_stats_webhook_total` メトリクスを追加し、ラベルに `successful` `failed` を設ける