forked from johejo/sora_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
505 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,29 @@ name: Go Static Check | |
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
- "main" | ||
tags-ignore: | ||
- '*' | ||
- "*" | ||
paths: | ||
- "**.go" | ||
|
||
jobs: | ||
|
||
build: | ||
name: static-check | ||
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 version | ||
- run: go version | ||
|
||
- run: go fmt . | ||
- run: go fmt . | ||
|
||
- uses: dominikh/[email protected].0 | ||
with: | ||
version: "2023.1.6" | ||
install-go: false | ||
- uses: dominikh/[email protected].1 | ||
with: | ||
version: "2024.1.1" | ||
install-go: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package collector | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
var ( | ||
sctpMetrics = SctpMetrics{ | ||
totalReceivedSctp: newDesc("sctp_received_packets_total", "The total number of received SCTP packets."), | ||
totalReceivedSctpByteSize: newDesc("sctp_received_bytes_total", "The total number of received SCTP bytes."), | ||
totalSentSctp: newDesc("sctp_sent_packets_total", "The total number of sent SCTP packets."), | ||
totalSentSctpByteSize: newDesc("sctp_sent_bytes_total", "The total number of sent SCTP bytes."), | ||
} | ||
) | ||
|
||
type SctpMetrics struct { | ||
totalReceivedSctp *prometheus.Desc | ||
totalReceivedSctpByteSize *prometheus.Desc | ||
totalSentSctp *prometheus.Desc | ||
totalSentSctpByteSize *prometheus.Desc | ||
} | ||
|
||
func (m *SctpMetrics) Describe(ch chan<- *prometheus.Desc) { | ||
ch <- m.totalReceivedSctp | ||
ch <- m.totalReceivedSctpByteSize | ||
ch <- m.totalSentSctp | ||
ch <- m.totalSentSctpByteSize | ||
} | ||
|
||
func (m *SctpMetrics) Collect(ch chan<- prometheus.Metric, report soraSctpReport) { | ||
ch <- newCounter(m.totalReceivedSctp, float64(report.TotalReceivedSctp)) | ||
ch <- newCounter(m.totalReceivedSctpByteSize, float64(report.TotalReceivedSctpByteSize)) | ||
ch <- newCounter(m.totalSentSctp, float64(report.TotalSentSctp)) | ||
ch <- newCounter(m.totalSentSctpByteSize, float64(report.TotalSentSctpByteSize)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package collector | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
var ( | ||
srtpMetrics = SrtpMetrics{ | ||
totalReceivedSrtp: newDesc("srtp_received_packets_total", "The total number of received SRTP packets."), | ||
totalReceivedSrtpByteSize: newDesc("srtp_received_bytes_total", "The total number of received SRTP bytes."), | ||
totalSentSrtp: newDesc("srtp_sent_packets_total", "The total number of sent SRTP packets."), | ||
totalSentSrtpByteSize: newDesc("srtp_sent_bytes_total", "The total number of sent SRTP bytes."), | ||
totalDecryptedSrtp: newDesc("srtp_decrypted_packets_total", "The total number of decrpyted SRTP packets."), | ||
totalDecryptedSrtpByteSize: newDesc("srtp_decrpyted_bytes_total", "The total number of decrypted SRTP bytes."), | ||
} | ||
) | ||
|
||
type SrtpMetrics struct { | ||
totalReceivedSrtp *prometheus.Desc | ||
totalReceivedSrtpByteSize *prometheus.Desc | ||
totalSentSrtp *prometheus.Desc | ||
totalSentSrtpByteSize *prometheus.Desc | ||
totalDecryptedSrtp *prometheus.Desc | ||
totalDecryptedSrtpByteSize *prometheus.Desc | ||
} | ||
|
||
func (m *SrtpMetrics) Describe(ch chan<- *prometheus.Desc) { | ||
ch <- m.totalReceivedSrtp | ||
ch <- m.totalReceivedSrtpByteSize | ||
ch <- m.totalSentSrtp | ||
ch <- m.totalSentSrtpByteSize | ||
ch <- m.totalDecryptedSrtp | ||
ch <- m.totalDecryptedSrtpByteSize | ||
} | ||
|
||
func (m *SrtpMetrics) Collect(ch chan<- prometheus.Metric, report soraSrtpReport) { | ||
ch <- newCounter(m.totalReceivedSrtp, float64(report.TotalReceivedSrtp)) | ||
ch <- newCounter(m.totalReceivedSrtpByteSize, float64(report.TotalReceivedSrtpByteSize)) | ||
ch <- newCounter(m.totalSentSrtp, float64(report.TotalSentSrtp)) | ||
ch <- newCounter(m.totalSentSrtpByteSize, float64(report.TotalSentSrtpByteSize)) | ||
ch <- newCounter(m.totalDecryptedSrtp, float64(report.TotalDecryptedSrtp)) | ||
ch <- newCounter(m.totalDecryptedSrtpByteSize, float64(report.TotalDecryptedSrtpByteSize)) | ||
} |
Oops, something went wrong.