From 33056c340a10df1e6ea4d173734d858634e3ea02 Mon Sep 17 00:00:00 2001 From: anhnv Date: Thu, 31 Aug 2023 16:42:08 +0700 Subject: [PATCH] refactor: update docs (README, comment in examples) --- README.md | 16 ++++++++-------- example/gin.go | 4 ++-- example/meter.go | 4 ++-- example/tracer.go | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0f79e8a..541f217 100644 --- a/README.md +++ b/README.md @@ -40,15 +40,15 @@ In order to push customized metrics to Kyber's self-hosted agent, you have to in ### Configurations When initializing the global TracerProvider and global MeterProvider, `kyber-trace-go` loads configurations from the following environment variables: - OTEL_ENABLED: `kyber-trace-go` only initializes global `TracerProvider` and global `MeterProvider` if `OTEL_ENABLED = true` - - OTEL_AGENT_HOST: The host of the agent where traces, spans, customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. - - OTEL_METRIC_AGENT_GRPC_PORT: The gRPC port of the agent where customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. - - OTEL_METRIC_AGENT_HTTP_PORT: The HTTP port of the agent where customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. - - OTEL_TRACE_AGENT_GRPC_PORT: The gRPC port of the agent where traces, spans will be sent to. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. - - OTEL_TRACE_AGENT_HTTP_PORT: The HTTP port of the agent where traces, spans will be sent to. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. - - OTEL_INSECURE: Disables client transport security for HTTP/gRPC connection when connecting to agent. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be set to `true` automatically. + - OTEL_AGENT_HOST: The host of the agent where traces, spans, customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. + - OTEL_METRIC_AGENT_GRPC_PORT: The gRPC port of the agent where customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. + - OTEL_METRIC_AGENT_HTTP_PORT: The HTTP port of the agent where customized metrics will be sent to. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. + - OTEL_TRACE_AGENT_GRPC_PORT: The gRPC port of the agent where traces, spans will be sent to. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. + - OTEL_TRACE_AGENT_HTTP_PORT: The HTTP port of the agent where traces, spans will be sent to. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in kyber-application. Otherwise, you have to set it yourself. + - OTEL_INSECURE: Disables client transport security for HTTP/gRPC connection when connecting to agent. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be set to `true` automatically. - OTEL_PROTOCOL: Specify which protocol will be used to connect to the agent. Enum: `grpc`, `http`. The default value is `grpc`. Only add this environment variable to your `value.yaml` in kyber-application when you want to use `http`. - - OTEL_SERVICE_NAME: Name of your service which can be used in your query in grafana jaeger. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in `kyber-application`. Otherwise, you have to set it yourself. - - OTEL_SERVICE_VERSION: The current version of your service. If you are using helm chart with dependency `base-service` version `0.5.15` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in `kyber-application`. Otherwise, you have to set it to your current image tag. + - OTEL_SERVICE_NAME: Name of your service which can be used in your query in grafana jaeger. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in `kyber-application`. Otherwise, you have to set it yourself. + - OTEL_SERVICE_VERSION: The current version of your service. If you are using helm chart with dependency `base-service` version `0.5.16` or later, this environment variable will be injected via helm chart, and you don't need to set it in your `values.yaml` in `kyber-application`. Otherwise, you have to set it to your current image tag. - OTEL_TRACE_SAMPLE_RATE: The default value is `0.5`. If you want your all traces and spans will be recorded, set `OTEL_TRACE_SAMPLE_RATE = 1` ### For gin framework diff --git a/example/gin.go b/example/gin.go index c9dad38..f892094 100644 --- a/example/gin.go +++ b/example/gin.go @@ -21,9 +21,9 @@ func GinFramework() { // export OTEL_METRIC_AGENT_GRPC_PORT=4315 // export OTEL_INSECURE=true - // When you deploy your service using helm chart with base-service from version 0.5.15, the following variables will be injected directly via helm chart: + // When you deploy your service using helm chart with base-service from version 0.5.16, the following variables will be injected directly via helm chart: // OTEL_AGENT_HOST, OTEL_SERVICE_NAME, OTEL_SERVICE_VERSION, OTEL_TRACE_AGENT_GRPC_PORT, OTEL_METRIC_AGENT_GRPC_PORT, OTEL_INSECURE - // You just need to set OTEL_ENABLED, OTEL_TRACE_SAMPLE_RATE. + // You just need to set OTEL_ENABLED. server := newServer() err := server.Run() diff --git a/example/meter.go b/example/meter.go index a6b900f..da2cea0 100644 --- a/example/meter.go +++ b/example/meter.go @@ -19,9 +19,9 @@ func PushMetric() { // export OTEL_METRIC_AGENT_GRPC_PORT=4315 // export OTEL_INSECURE=true - // When you deploy your service using helm chart with base-service from version 0.5.15, the following variables will be injected directly via helm chart: + // When you deploy your service using helm chart with base-service from version 0.5.16, the following variables will be injected directly via helm chart: // OTEL_AGENT_HOST, OTEL_SERVICE_NAME, OTEL_SERVICE_VERSION, OTEL_TRACE_AGENT_GRPC_PORT, OTEL_METRIC_AGENT_GRPC_PORT, OTEL_INSECURE - // You just need to set OTEL_ENABLED, OTEL_TRACE_SAMPLE_RATE. + // You just need to set OTEL_ENABLED. counter, err := metric.Meter().Int64Counter("example_count_metric") if err != nil { diff --git a/example/tracer.go b/example/tracer.go index 9fed2df..bb4a4fe 100644 --- a/example/tracer.go +++ b/example/tracer.go @@ -21,9 +21,9 @@ func Tracing() { // export OTEL_METRIC_AGENT_GRPC_PORT=4315 // export OTEL_INSECURE=true - // When you deploy your service using helm chart with base-service from version 0.5.15, the following variables will be injected directly via helm chart: + // When you deploy your service using helm chart with base-service from version 0.5.16, the following variables will be injected directly via helm chart: // OTEL_AGENT_HOST, OTEL_SERVICE_NAME, OTEL_SERVICE_VERSION, OTEL_TRACE_AGENT_GRPC_PORT, OTEL_METRIC_AGENT_GRPC_PORT, OTEL_INSECURE - // You just need to set OTEL_ENABLED, OTEL_TRACE_SAMPLE_RATE. + // You just need to set OTEL_ENABLED. ctx := context.Background()