Compare commits

..

No commits in common. "main" and "1.1.7" have entirely different histories.
main ... 1.1.7

15 changed files with 72 additions and 237 deletions

1
.github/CODEOWNERS vendored
View file

@ -1 +0,0 @@
* @0x46616c6b

View file

@ -4,31 +4,12 @@ updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
groups:
gomod:
patterns:
- "*"
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
groups:
github-actions:
patterns:
- "*"
interval: "daily"

View file

@ -1,41 +0,0 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧹 Maintenance'
labels:
- 'chore'
- 'dependencies'
version-resolver:
major:
labels:
- 'feature'
minor:
labels:
- 'enhancement'
patch:
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'chore'
- 'dependencies'
default: patch
template: |
## Changes
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
## Docker
- `docker pull systemli/prometheus-jitsi-meet-exporter:$RESOLVED_VERSION`

View file

@ -2,31 +2,19 @@ name: Integration
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2.3.4
- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@v2.1.4
with:
go-version: "1.17.x"
- name: Cache Go Dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.16.x'
- name: Vet
run: go vet
@ -36,50 +24,19 @@ jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2.3.4
- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@v2.1.4
with:
go-version: "1.17.x"
- name: Cache Go Dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.16.x'
- name: Build
run: go build ./...
- name: Docker
run: docker build .
automerge:
name: Merge Automatically
needs: [test, build]
runs-on: ubuntu-20.04
permissions:
pull-requests: write
contents: write
steps:
- name: Obtain Access Token
id: acces_token
run: |
TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.SYSTEMLI_APP_CREDENTIALS_TOKEN }})"
echo "token=$TOKEN" >> $GITHUB_OUTPUT
- name: Merge
uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ steps.acces_token.outputs.token }}

View file

@ -2,15 +2,15 @@ name: Quality
on:
push:
branches:
- main
pull_request:
jobs:
golangci:
name: GolangCI
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2.3.4
- name: GolangCI
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v2.5.2
with:
version: v1.31

View file

@ -1,18 +0,0 @@
name: Release Drafter
on:
push:
branches:
- main
jobs:
release:
name: Update Release
runs-on: ubuntu-20.04
steps:
- name: Publish Release
uses: release-drafter/release-drafter@v5
with:
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,40 +1,33 @@
name: Release
on:
release:
types: [published]
push:
tags:
- '*'
jobs:
release:
name: Release
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@v2
with:
go-version: "1.17.x"
- name: Cache Go Dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.16.x
- name: Login to Docker Hub
uses: docker/login-action@v3.0.0
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Releases
uses: goreleaser/goreleaser-action@v5.0.0
- name: Release
uses: goreleaser/goreleaser-action@v2.6.1
with:
version: latest
args: release --rm-dist

2
.gitignore vendored
View file

@ -1 +1 @@
dist
build

View file

@ -9,8 +9,8 @@ builds:
- windows
- darwin
goarm:
- "6"
- "7"
- 6
- 7
ldflags:
- -s -w
dockers:
@ -27,4 +27,8 @@ checksum:
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
skip: true
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

View file

@ -1,30 +1,28 @@
# syntax=docker/dockerfile:1
# Build the application from source
FROM golang:1.21.4 AS build-stage
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /prometheus-jitsi-meet-exporter
FROM alpine:3.14.0 as builder
# Run the tests in the container
FROM build-stage AS run-test-stage
RUN go test -v ./...
WORKDIR /go/src/github.com/systemli/prometheus-jitsi-meet-exporter
# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage
ENV USER=appuser
ENV UID=10001
WORKDIR /
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
COPY --from=build-stage /prometheus-jitsi-meet-exporter /prometheus-jitsi-meet-exporter
FROM scratch
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY prometheus-jitsi-meet-exporter /prometheus-jitsi-meet-exporter
USER appuser:appuser
EXPOSE 9888
USER nonroot:nonroot
ENTRYPOINT ["/prometheus-jitsi-meet-exporter"]

View file

@ -1,6 +1,6 @@
# Jitsi Meet Metrics Exporter
[![Integration](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Integration/badge.svg?branch=main)](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Integration/badge.svg?branch=main) [![Quality](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Quality/badge.svg?branch=main)](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Quality/badge.svg?branch=main) [![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/systemli/prometheus-jitsi-meet-exporter)](https://hub.docker.com/r/systemli/prometheus-jitsi-meet-exporter) [![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/systemli/prometheus-jitsi-meet-exporter)](https://hub.docker.com/r/systemli/prometheus-jitsi-meet-exporter)
[![Integration](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Integration/badge.svg?branch=master)](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Integration/badge.svg?branch=master) [![Quality](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Quality/badge.svg?branch=master)](https://github.com/systemli/prometheus-jitsi-meet-exporter/workflows/Quality/badge.svg?branch=master) [![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/systemli/prometheus-jitsi-meet-exporter)](https://hub.docker.com/r/systemli/prometheus-jitsi-meet-exporter) [![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/systemli/prometheus-jitsi-meet-exporter)](https://hub.docker.com/r/systemli/prometheus-jitsi-meet-exporter)
Prometheus Exporter for Jitsi Meet written in Go. Based on [Jitsi Meet Exporter](https://git.autistici.org/ai3/tools/jitsi-prometheus-exporter) from [Autistici](https://www.autistici.org/)
@ -10,7 +10,8 @@ The exporter will handle both of them, but some metrics that aren't exposed may
## Usage
```
go install github.com/systemli/prometheus-jitsi-meet-exporter@latest
go get github.com/systemli/prometheus-jitsi-meet-exporter
go install github.com/systemli/prometheus-jitsi-meet-exporter
$GOPATH/bin/prometheus-jitsi-meet-exporter
```

4
go.mod
View file

@ -1,5 +1,5 @@
module github.com/systemli/prometheus-jitsi-meet-exporter
go 1.17
go 1.14
require github.com/google/go-cmp v0.6.0
require github.com/google/go-cmp v0.5.6

6
go.sum
View file

@ -1,2 +1,4 @@
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

24
main.go
View file

@ -48,19 +48,15 @@ type videoBridgeStats struct {
OctoVersion int `json:"octo_version"`
OctoConferences int `json:"octo_conferences"`
OctoEndpoints int `json:"octo_endpoints"`
OctoReceiveBitrate float64 `json:"octo_receive_bitrate"`
OctoReceivePacketRate float64 `json:"octo_receive_packet_rate"`
OctoSendBitrate float64 `json:"octo_send_bitrate"`
OctoSendPacketRate float64 `json:"octo_send_packet_rate"`
OctoReceiveBitrate int `json:"octo_receive_bitrate"`
OctoReceivePacketRate int `json:"octo_receive_packet_rate"`
OctoSendBitrate int `json:"octo_send_bitrate"`
OctoSendPacketRate int `json:"octo_send_packet_rate"`
TotalBytesReceivedOcto int `json:"total_bytes_received_octo"`
TotalBytesSentOcto int `json:"total_bytes_sent_octo"`
TotalPacketsDroppedOcto int `json:"total_packets_dropped_octo"`
TotalPacketsReceivedOcto int `json:"total_packets_received_octo"`
TotalPacketsSentOcto int `json:"total_packets_sent_octo"`
TotalICESucceededRelayed int `json:"total_ice_succeeded_relayed"`
TotalICESucceeded int `json:"total_ice_succeeded"`
TotalICESucceededTCP int `json:"total_ice_succeeded_tcp"`
TotalICEFailed int `json:"total_ice_failed"`
}
var tpl = template.Must(template.New("stats").Parse(`# HELP jitsi_threads The number of Java threads that the video bridge is using.
@ -189,18 +185,6 @@ jitsi_total_packets_received_octo {{.TotalPacketsReceivedOcto}}
# HELP jitsi_total_packets_sent_octo The total of sent dropped packets handled by the OCTO video bridge.
# TYPE jitsi_total_packets_sent_octo gauge
jitsi_total_packets_sent_octo {{.TotalPacketsSentOcto}}
# HELP total_ice_succeeded_relayed The total number of times an ICE Agent succeeded and the selected candidate pair included a relayed candidate.
# TYPE total_ice_succeeded_relayed gauge
total_ice_succeeded_relayed {{.TotalICESucceededRelayed}}
# HELP total_ice_succeeded The total number of times an ICE Agent succeeded.
# TYPE total_ice_succeeded gauge
total_ice_succeeded {{.TotalICESucceeded}}
# HELP total_ice_succeeded_tcp The total number of times an ICE Agent succeeded and the selected candidate was a TCP candidate.
# TYPE total_ice_succeeded_tcp gauge
total_ice_succeeded_tcp {{.TotalICESucceededTCP}}
# HELP total_ice_failed The total number of times an ICE Agent failed to establish connectivity.
# TYPE total_ice_failed gauge
total_ice_failed {{.TotalICEFailed}}
# HELP jitsi_conference_sizes Distribution of conference sizes
# TYPE jitsi_conference_sizes gauge
{{ range $key, $value := .ConferenceSizes -}}

View file

@ -149,18 +149,6 @@ jitsi_total_packets_received_octo 0
# HELP jitsi_total_packets_sent_octo The total of sent dropped packets handled by the OCTO video bridge.
# TYPE jitsi_total_packets_sent_octo gauge
jitsi_total_packets_sent_octo 0
# HELP total_ice_succeeded_relayed The total number of times an ICE Agent succeeded and the selected candidate pair included a relayed candidate.
# TYPE total_ice_succeeded_relayed gauge
total_ice_succeeded_relayed 0
# HELP total_ice_succeeded The total number of times an ICE Agent succeeded.
# TYPE total_ice_succeeded gauge
total_ice_succeeded 0
# HELP total_ice_succeeded_tcp The total number of times an ICE Agent succeeded and the selected candidate was a TCP candidate.
# TYPE total_ice_succeeded_tcp gauge
total_ice_succeeded_tcp 0
# HELP total_ice_failed The total number of times an ICE Agent failed to establish connectivity.
# TYPE total_ice_failed gauge
total_ice_failed 0
# HELP jitsi_conference_sizes Distribution of conference sizes
# TYPE jitsi_conference_sizes gauge
jitsi_conference_sizes{conference_size="0"} 0
@ -202,9 +190,9 @@ jitsi_conference_sizes{conference_size="21"} 0
"loss_rate_upload": 0.5,
"octo_conferences": 0,
"octo_endpoints": 0,
"octo_receive_bitrate": 0.0,
"octo_receive_bitrate": 0,
"octo_receive_packet_rate": 0,
"octo_send_bitrate": 0.0,
"octo_send_bitrate": 0,
"octo_send_packet_rate": 0,
"octo_version": 1,
"packet_rate_download": 0,
@ -232,7 +220,7 @@ jitsi_conference_sizes{conference_size="21"} 0
"total_failed_conferences": 0,
"total_ice_failed": 0,
"total_ice_succeeded": 2,
"total_ice_succeeded_tcp": 1,
"total_ice_succeeded_tcp": 0,
"total_loss_controlled_participant_seconds": 847,
"total_loss_degraded_participant_seconds": 1,
"total_loss_limited_participant_seconds": 0,
@ -246,7 +234,6 @@ jitsi_conference_sizes{conference_size="21"} 0
"total_packets_sent_octo": 0,
"total_partially_failed_conferences": 0,
"total_participants": 2,
"total_ice_succeeded_relayed": 3,
"videochannels": 0,
"videostreams": 0
}`,
@ -376,18 +363,6 @@ jitsi_total_packets_received_octo 0
# HELP jitsi_total_packets_sent_octo The total of sent dropped packets handled by the OCTO video bridge.
# TYPE jitsi_total_packets_sent_octo gauge
jitsi_total_packets_sent_octo 0
# HELP total_ice_succeeded_relayed The total number of times an ICE Agent succeeded and the selected candidate pair included a relayed candidate.
# TYPE total_ice_succeeded_relayed gauge
total_ice_succeeded_relayed 3
# HELP total_ice_succeeded The total number of times an ICE Agent succeeded.
# TYPE total_ice_succeeded gauge
total_ice_succeeded 2
# HELP total_ice_succeeded_tcp The total number of times an ICE Agent succeeded and the selected candidate was a TCP candidate.
# TYPE total_ice_succeeded_tcp gauge
total_ice_succeeded_tcp 1
# HELP total_ice_failed The total number of times an ICE Agent failed to establish connectivity.
# TYPE total_ice_failed gauge
total_ice_failed 0
# HELP jitsi_conference_sizes Distribution of conference sizes
# TYPE jitsi_conference_sizes gauge
jitsi_conference_sizes{conference_size="0"} 0