Skip to content

Commit

Permalink
feat: add telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Aug 2, 2022
1 parent baf94a8 commit 474b31e
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 6 deletions.
4 changes: 4 additions & 0 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/numary/auth/pkg/delegatedauth"
"github.com/numary/auth/pkg/storage"
"github.com/numary/go-libs/sharedlogging"
"github.com/numary/go-libs/sharedotlp/pkg/sharedotlptraces"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/zitadel/oidc/pkg/oidc"
Expand Down Expand Up @@ -78,6 +79,7 @@ var serveCmd = &cobra.Command{
delegatedClientSecret,
fmt.Sprintf("%s/authorize/callback", baseUrl),
),
sharedotlptraces.CLITracesModule(viper.GetViper()),
fx.Invoke(func() {
sharedlogging.Infof("App started.")
}),
Expand Down Expand Up @@ -140,4 +142,6 @@ func init() {
serveCmd.Flags().String(delegatedClientSecretFlag, "", "Delegated OIDC client secret")
serveCmd.Flags().String(baseUrlFlag, "http://localhost:8080", "Base service url")
serveCmd.Flags().String(signingKeyFlag, "", "Signing key")

sharedotlptraces.InitOTLPTracesFlags(serveCmd.Flags())
}
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
version: '3.8'

services:
jaeger:
image: jaegertracing/opentelemetry-all-in-one
ports:
- "16686:16686/tcp"
dex:
image: ghcr.io/dexidp/dex:latest
volumes:
Expand Down Expand Up @@ -39,6 +43,9 @@ services:
DEBUG: 1
POSTGRES_URI: "host=postgres user=auth password=auth dbname=auth port=5432 sslmode=disable"
CAOS_OIDC_DEV: 1
OTEL_TRACES: "true"
OTEL_TRACES_EXPORTER: jaeger
OTEL_TRACES_EXPORTER_JAEGER_ENDPOINT: http://jaeger:14268/api/traces
DELEGATED_CLIENT_ID: gateway
DELEGATED_CLIENT_SECRET: ZXhhbXBsZS1hcHAtc2VjcmV0
DELEGATED_ISSUER: http://localhost:5556/dex
Expand Down Expand Up @@ -75,6 +82,7 @@ services:
depends_on:
- dex
- postgres
- jaeger
volumes:
- .:/src
working_dir: /src
Expand Down
21 changes: 19 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/numary/auth-membership-gateway v0.0.0-20220729072203-ea1111bb0a6b
github.com/numary/go-libs v0.0.0-20220801164020-fc3e3280ca13
github.com/numary/go-libs/sharedhealth v0.0.0-20220801164020-fc3e3280ca13
github.com/numary/go-libs/sharedotlp v0.0.0-20220802090414-d0ae0613f325
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.12.0
Expand All @@ -23,12 +23,16 @@ require (
)

require (
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/schema v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
Expand All @@ -53,6 +57,17 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/zitadel/logging v0.3.4 // indirect
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.33.0 // indirect
go.opentelemetry.io/otel v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 // indirect
go.opentelemetry.io/otel/sdk v1.8.0 // indirect
go.opentelemetry.io/otel/trace v1.8.0 // indirect
go.opentelemetry.io/proto/otlp v0.18.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/dig v1.14.1 // indirect
go.uber.org/multierr v1.8.0 // indirect
Expand All @@ -61,6 +76,8 @@ require (
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.46.2 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 474b31e

Please sign in to comment.