Skip to content

Commit

Permalink
Merge branch 'sbruens/service' into sbruens/caddy
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Sep 6, 2024
2 parents 469a18b + 2738b45 commit c5296a3
Show file tree
Hide file tree
Showing 6 changed files with 953 additions and 156 deletions.
4 changes: 3 additions & 1 deletion cmd/outline-ss-server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@ func newPrometheusServerMetrics() *serverMetrics {
}),
ports: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "ports",
Help: "Count of open Shadowsocks ports",
Help: "Count of open ports",
}),
}
}

func (m *serverMetrics) Describe(ch chan<- *prometheus.Desc) {
m.buildInfo.Describe(ch)
m.accessKeys.Describe(ch)
m.ports.Describe(ch)
}

func (m *serverMetrics) Collect(ch chan<- prometheus.Metric) {
m.buildInfo.Describe(ch)
m.accessKeys.Collect(ch)
m.ports.Collect(ch)
}
Expand Down
9 changes: 6 additions & 3 deletions cmd/outline-ss-server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ package main
import (
"testing"
"time"

"github.com/Jigsaw-Code/outline-ss-server/prometheus"
)

func TestRunSSServer(t *testing.T) {
m, err := newPrometheusOutlineMetrics(nil)
serverMetrics := newPrometheusServerMetrics()
serviceMetrics, err := prometheus.NewServiceMetrics(nil)
if err != nil {
t.Fatalf("Failed to create Prometheus metrics: %v", err)
t.Fatalf("Failed to create Prometheus service metrics: %v", err)
}
server, err := RunSSServer("config_example.yml", 30*time.Second, m, 10000)
server, err := RunSSServer("config_example.yml", 30*time.Second, serverMetrics, serviceMetrics, 10000)
if err != nil {
t.Fatalf("RunSSServer() error = %v", err)
}
Expand Down
Loading

0 comments on commit c5296a3

Please sign in to comment.