Skip to content

Commit

Permalink
Merge branch 'release/2024.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tnamao committed Jun 5, 2024
2 parents e463cba + 3a93edd commit e61b189
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 42 deletions.
81 changes: 40 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
10 changes: 9 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGES

## 2024.5.0

- [ADD] Sora の Stats Webhook の統計情報に対応する
- `sora_stats_webhook_total` メトリクスを追加し、ラベルに `successful` `failed` を設ける
- @tnamao
- [UPDATE] CI の `actions/setup-go``v5` に上げる
- @tnamao

## 2024.4.0

- [CHANGE] クラスターリレーのメトリクス名を変更する
Expand All @@ -10,7 +18,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

Expand Down
2 changes: 2 additions & 0 deletions collector/sora_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions collector/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}),
}
)

Expand All @@ -16,13 +17,15 @@ type WebhookMetrics struct {
totalAuthWebhook *prometheus.Desc
totalSessionWebhook *prometheus.Desc
totalEventWebhook *prometheus.Desc
totalStatsWebhook *prometheus.Desc
}

func (m *WebhookMetrics) Describe(ch chan<- *prometheus.Desc) {
ch <- m.totalSuccessfulAuthWebhook
ch <- m.totalAuthWebhook
ch <- m.totalSessionWebhook
ch <- m.totalEventWebhook
ch <- m.totalStatsWebhook
}

func (m *WebhookMetrics) Collect(ch chan<- prometheus.Metric, report soraWebhookReport) {
Expand All @@ -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")
}
4 changes: 4 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions test/maximum.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/minimum.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/sora_client_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/sora_cluster_metrics_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/sora_connection_error_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/sora_erlang_vm_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e61b189

Please sign in to comment.