diff --git a/config/config.production.yml b/config/config.production.yml index 9cbdf1a..0f63a0f 100644 --- a/config/config.production.yml +++ b/config/config.production.yml @@ -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 diff --git a/config/config.yml b/config/config.yml index 0d8d3ae..8cdcfab 100644 --- a/config/config.yml +++ b/config/config.yml @@ -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 diff --git a/go.mod b/go.mod index d521954..cf38366 100644 --- a/go.mod +++ b/go.mod @@ -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 ( @@ -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 diff --git a/go.sum b/go.sum index 7a305cb..a2151ea 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/config/schema.go b/internal/config/schema.go index dc1545d..32a2ef1 100644 --- a/internal/config/schema.go +++ b/internal/config/schema.go @@ -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"` diff --git a/service/play/README.md b/service/play/README.md index d5c52f9..5dacbdf 100644 --- a/service/play/README.md +++ b/service/play/README.md @@ -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