Skip to content

Commit

Permalink
Basic metrics using go-chi/telemetry (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav authored Feb 22, 2024
1 parent e667b55 commit 079ed64
Show file tree
Hide file tree
Showing 405 changed files with 73,167 additions and 97 deletions.
16 changes: 9 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"os"

"github.com/BurntSushi/toml"
"github.com/go-chi/telemetry"
)

type Config struct {
Mode Mode `toml:"-"`
Region string `toml:"region"`
Service ServiceConfig `toml:"service"`
Admin AdminConfig `toml:"admin"`
Endpoints EndpointsConfig `toml:"endpoints"`
KMS KMSConfig `toml:"kms"`
Database DatabaseConfig `toml:"database"`
Mode Mode `toml:"-"`
Region string `toml:"region"`
Service ServiceConfig `toml:"service"`
Admin AdminConfig `toml:"admin"`
Endpoints EndpointsConfig `toml:"endpoints"`
KMS KMSConfig `toml:"kms"`
Database DatabaseConfig `toml:"database"`
Telemetry telemetry.Config `toml:"telemetry"`
}

type AdminConfig struct {
Expand Down
3 changes: 3 additions & 0 deletions etc/waas-auth.next.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ region = "us-east-2"
proxy_port = 8000
debug_profiler = false

[telemetry]
allow_any = true

[admin]
public_key = '''-----BEGIN RSA PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+WUoYyHdSNN802C9q3Z
Expand Down
3 changes: 3 additions & 0 deletions etc/waas-auth.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ region = "us-east-1"
proxy_port = 9124
debug_profiler = true

[telemetry]
allow_any = true

[admin]
# Public key from the keypair used to generate admin JWTs
#
Expand Down
15 changes: 13 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/go-chi/cors v1.2.1
github.com/go-chi/httplog v0.3.2
github.com/go-chi/jwtauth/v5 v5.3.0
github.com/go-chi/telemetry v0.3.3
github.com/goware/rerun v0.0.9
github.com/jxskiss/base62 v1.1.0
github.com/lestrrat-go/jwx/v2 v2.0.19
Expand Down Expand Up @@ -43,6 +44,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect
github.com/aws/smithy-go v1.19.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.24.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
Expand All @@ -60,6 +62,7 @@ require (
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-cz/textcase v1.2.1 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect
Expand Down Expand Up @@ -90,24 +93,32 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/diff v0.0.1 // indirect
github.com/posener/gitfs v1.2.1 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/redis/go-redis/v9 v9.4.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/uber-go/tally/v4 v4.1.11 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
Expand Down
136 changes: 124 additions & 12 deletions go.sum

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
"github.com/go-chi/httplog"
"github.com/go-chi/telemetry"
"github.com/rs/zerolog"
)

Expand Down Expand Up @@ -77,7 +78,6 @@ func New(cfg *config.Config, client HTTPClient) (*RPC, error) {
if err != nil {
return nil, err
}
//awsv2.AWSV2Instrumentor(&awsCfg.APIOptions)

httpServer := &http.Server{
ReadTimeout: 45 * time.Second,
Expand Down Expand Up @@ -177,9 +177,8 @@ func (s *RPC) Handler() http.Handler {
r.Use(middleware.RealIP)

// Metrics and heartbeat
//r.Use(telemetry.Collector(s.Config.Telemetry, []string{"/rpc"}))
r.Use(telemetry.Collector(s.Config.Telemetry, []string{"/rpc"}))
r.Use(middleware.NoCache)
//r.Use(honeybadger.Handler)
r.Use(middleware.Heartbeat("/ping"))

// HTTP request logger
Expand Down
20 changes: 20 additions & 0 deletions vendor/github.com/beorn7/perks/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 079ed64

Please sign in to comment.