Skip to content

Commit

Permalink
fix(telemetry): now export go_goroutines
Browse files Browse the repository at this point in the history
go_goroutines are now exposed by prometheus

open-telemetry/opentelemetry-go#2171
  • Loading branch information
xmlking committed Aug 7, 2021
1 parent 6374d39 commit 7b18b89
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 24 deletions.
3 changes: 1 addition & 2 deletions config/config.production.yml
Expand Up @@ -19,10 +19,9 @@ features:

metrics:
target: gcp
endpoint: ":9213"
endpoint: ":9213" # using Custom Exporter port as default from: https://github.com/prometheus/prometheus/wiki/Default-port-allocations
sampling_fraction: 0.0001

tracing:
target: gcp
endpoint: ":9213"
sampling_fraction: 0.0001
1 change: 1 addition & 0 deletions config/config.yml
Expand Up @@ -79,6 +79,7 @@ features:
endpoint: ":0"
sampling_fraction: 1.0
collect_period: 10s
# histogram_distribution: [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]
tracing:
enabled: false
backend: stdout
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Expand Up @@ -10,6 +10,8 @@ replace github.com/xmlking/grpc-starter-kit => ./

//replace github.com/xmlking/toolkit/logger => ../toolkit/logger

//replace github.com/xmlking/toolkit/telemetry => ../toolkit/telemetry

//replace github.com/xmlking/toolkit => github.com/xmlking/toolkit v0.1.2-0.20210125025404-51fc2d71fb2d

require (
Expand All @@ -35,7 +37,7 @@ require (
github.com/xmlking/toolkit/broker/cloudevents v0.2.1
github.com/xmlking/toolkit/confy v0.2.1
github.com/xmlking/toolkit/logger v0.2.1
github.com/xmlking/toolkit/telemetry v0.2.1
github.com/xmlking/toolkit/telemetry v0.2.2-0.20210807070629-098bbac6595c
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.22.0
go.opentelemetry.io/otel v1.0.0-RC2
go.opentelemetry.io/otel/metric v0.22.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -627,8 +627,8 @@ github.com/xmlking/toolkit/confy v0.2.1 h1:ibgDZRsWGSxoLBqNfGkooUszoew1QsnETuMBy
github.com/xmlking/toolkit/confy v0.2.1/go.mod h1:+kiAzggAehxbARiXxzD0zIzYDnZW4WmI3u1mxhq5QM0=
github.com/xmlking/toolkit/logger v0.2.1 h1:6szYX1oQEOdms6zfWe8WPKOLbZtm7Ma9pJpeBxUANIE=
github.com/xmlking/toolkit/logger v0.2.1/go.mod h1:9I+copkbirFrYQBDsXVZ3OnrDzPHp+HWk6Y2FxfkGrA=
github.com/xmlking/toolkit/telemetry v0.2.1 h1:oQQUk+hLPn9ewGcxM7ffJFmjwrMTKfLe4o1DTVbKzJw=
github.com/xmlking/toolkit/telemetry v0.2.1/go.mod h1:PYbKit3k+UjvA3Qffh+KhE/0ByNS6X2dTRUU+cncNp8=
github.com/xmlking/toolkit/telemetry v0.2.2-0.20210807070629-098bbac6595c h1:BXXtTJ1zayPbRQCasFzr+rrVZqsBw0yrjQjDtzQDOtk=
github.com/xmlking/toolkit/telemetry v0.2.2-0.20210807070629-098bbac6595c/go.mod h1:AGWKP5cgDpEC4M/WqJDzA7IYSpAScb9PECY8bkFRj40=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
Expand Down
19 changes: 0 additions & 19 deletions internal/config/schema.go
Expand Up @@ -74,25 +74,6 @@ type Features struct {
Translog *Features_Translog `yaml:"translog,omitempty"`
}

// Features_Metrics struct
type Features_Metrics struct {
Enabled bool `yaml:",omitempty" default:"false"`
Backend string `yaml:",omitempty" validate:"oneof=gcp prometheus stdout" default:"stdout"`
Endpoint string `yaml:"endpoint,omitempty"`
// SamplingFraction >= 1 will always sample. SamplingFraction < 0 are treated as zero.
SamplingFraction float64 `yaml:"sampling_fraction,omitempty" default:"1.0"`
CollectPeriod time.Duration `yaml:"collect_period,omitempty" default:"10s"`
}

// Features_Tracing struct
type Features_Tracing struct {
Enabled bool `yaml:",omitempty" default:"false"`
Backend string `yaml:",omitempty" validate:"oneof=gcp stdout" default:"stdout"`
Endpoint string `yaml:"endpoint,omitempty"`
// SamplingFraction >= 1 will always sample. SamplingFraction < 0 are treated as zero.
SamplingFraction float64 `yaml:"sampling_fraction,omitempty" default:"1.0"`
}

// Features_TLS struct
type Features_TLS struct {
Enabled bool `yaml:",omitempty" default:"false"`
Expand Down
2 changes: 2 additions & 0 deletions service/play/README.md
Expand Up @@ -18,6 +18,8 @@ export CONFY_FEATURES_TRACING_ENABLED=true
# enable metrics target: `prometheus` and tracing target: `stdout`
export CONFY_FEATURES_METRICS_TARGET=prometheus
export CONFY_FEATURES_TRACING_TARGET=stdout
# lock `prometheus` exporter port
export CONFY_FEATURES_METRICS_ENDPOINT=":9213"
# when using with target: `gcp`
export GOOGLE_CLOUD_PROJECT=xyz
export GOOGLE_APPLICATION_CREDENTIALS=../../../Apps/micro-starter-kit.json
Expand Down

0 comments on commit 7b18b89

Please sign in to comment.