Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Add metric IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Sep 5, 2023
1 parent 5b31d24 commit 6d55e36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions crew/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ func registerMetrics() (err error) {
nil,
&metrics.Options{
Name: "SPN Total Connect Operations",
InternalID: "spn_connect_count",
Permission: api.PermitUser,
Persist: true,
},
)
if err != nil {
Expand All @@ -61,7 +63,9 @@ func registerMetrics() (err error) {
nil,
&metrics.Options{
Name: "SPN Connect Operation Incoming Bytes",
InternalID: "spn_connect_in_bytes",
Permission: api.PermitUser,
Persist: true,
},
)
if err != nil {
Expand All @@ -73,7 +77,9 @@ func registerMetrics() (err error) {
nil,
&metrics.Options{
Name: "SPN Connect Operation Outgoing Bytes",
InternalID: "spn_connect_out_bytes",
Permission: api.PermitUser,
Persist: true,
},
)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions crew/op_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func init() {

// NewConnectOp starts a new connect operation.
func NewConnectOp(tunnel *Tunnel) (*ConnectOp, *terminal.Error) {
// Submit metrics.
newConnectOp.Inc()

// Create request.
request := &ConnectRequest{
Domain: tunnel.connInfo.Entity.Domain,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/mr-tron/base58 v1.2.0
github.com/rot256/pblind v0.0.0-20230622102829-4dc2c6e4b857
github.com/safing/jess v0.3.1
github.com/safing/portbase v0.17.2
github.com/safing/portbase v0.17.3
github.com/safing/portmaster v1.4.4-prep
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ github.com/safing/portbase v0.15.2/go.mod h1:5bHi99fz7Hh/wOsZUOI631WF9ePSHk57c4f
github.com/safing/portbase v0.16.2/go.mod h1:mzNCWqPbO7vIYbbK5PElGbudwd2vx4YPNawymL8Aro8=
github.com/safing/portbase v0.17.2 h1:HzJkURMmXkv30wMHB7xJ+Z5U5aTMe+EzvlHavKoKkos=
github.com/safing/portbase v0.17.2/go.mod h1:1cVgDZIsPiqM5b+K88Kshir5PGIvsftYkx7y1x925+8=
github.com/safing/portbase v0.17.3 h1:LLV2kq4mli2phHFHxigTkIoOjConieMTWsDyi9kJd00=
github.com/safing/portbase v0.17.3/go.mod h1:1cVgDZIsPiqM5b+K88Kshir5PGIvsftYkx7y1x925+8=
github.com/safing/portmaster v1.4.4-prep h1:r1GqXl8UEyWOqC1QecCO+HEV5YFhHrWvwGC7FQ+wTfs=
github.com/safing/portmaster v1.4.4-prep/go.mod h1:u35kfStZppEViVmONmSTtaQh7/6vtGEB2kAraj8C9OU=
github.com/safing/portmaster-android/go v0.0.0-20230605085256-6abf4c495626 h1:olc/REnUdpJN/Gmz8B030OxLpMYxyPDTrDILNEw0eKs=
Expand Down Expand Up @@ -413,3 +415,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5 h1:cv/zaNV0nr1mJzaeo4S5mHIm5va1W0/9J3/5prlsuRM=
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5/go.mod h1:TIvkJD0sxe8pIob3p6T8IzxXunlp6yfgktvTNp+DGNM=
honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=

0 comments on commit 6d55e36

Please sign in to comment.