-
-
Save up1/beb229a8b438df80f95b0a7d62a3bd6f to your computer and use it in GitHub Desktop.
OpenTelemetry + Test result + Prometheus + Grafana
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) | |
defer cancel() | |
shutdown := initProvider(ctx) | |
defer shutdown() | |
commonLabels := []attribute.KeyValue{ | |
attribute.String("result", "[skiped|success|failure]"), | |
} | |
meter := otel.Meter("demo-client-meter") | |
testRequestCount, _ := meter.Int64Counter( | |
"test_request_count", | |
metric.WithDescription("The number of test result"), | |
) | |
testRequestCount.Add(ctx, 0, metric.WithAttributes(commonLabels...)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
receivers: | |
otlp: | |
protocols: | |
grpc: | |
exporters: | |
prometheus: | |
endpoint: "0.0.0.0:8889" | |
namespace: promexample | |
const_labels: | |
label1: value1 | |
logging: | |
loglevel: debug | |
file: | |
path: /tmp/tests.json | |
processors: | |
batch: | |
extensions: | |
health_check: | |
pprof: | |
endpoint: :1888 | |
zpages: | |
endpoint: :55679 | |
service: | |
extensions: [pprof, zpages, health_check] | |
pipelines: | |
traces: | |
receivers: [otlp] | |
processors: [batch] | |
exporters: [file, logging] | |
metrics: | |
receivers: [otlp] | |
processors: [batch] | |
exporters: [file, logging, prometheus] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment