{"id":21347098,"url":"https://github.com/kybernetwork/kyber-trace-go","last_synced_at":"2026-01-28T21:05:15.268Z","repository":{"id":188908731,"uuid":"679209376","full_name":"KyberNetwork/kyber-trace-go","owner":"KyberNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-10T09:12:18.000Z","size":112,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T10:51:50.116Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KyberNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-16T10:36:09.000Z","updated_at":"2023-08-17T10:46:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"f284af06-1001-47e2-bb4d-b4e1c2a95112","html_url":"https://github.com/KyberNetwork/kyber-trace-go","commit_stats":null,"previous_names":["kybernetwork/kyber-trace-go"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/KyberNetwork/kyber-trace-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2Fkyber-trace-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2Fkyber-trace-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2Fkyber-trace-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2Fkyber-trace-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KyberNetwork","download_url":"https://codeload.github.com/KyberNetwork/kyber-trace-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyberNetwork%2Fkyber-trace-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28851838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T02:12:41.869Z","updated_at":"2026-01-28T21:05:15.250Z","avatar_url":"https://github.com/KyberNetwork.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kyber Trace GO Lib\n\n## Overview\nThis is a library that makes it easier to integrate with Kyber's self-hosted open tracing\n\n## Add this lib to your project\n- Require go version 1.21 or later\n- Step 1:\n```\n$ export GOPRIVATE=github.com/KyberNetwork/kyber-trace-go\n```\n- Step 2: Add file `tools/tools.go` with content:\n```\npackage tools\n\nimport (\n    _ \"github.com/KyberNetwork/kyber-trace-go/tools\"\n)\n```\n- Step 3:\n```\n$ go mod tidy\n$ go mod vendor\n```\n\n## Update to latest version\n```\n$ go get -u github.com/KyberNetwork/kyber-trace-go\n$ go mod vendor\n```\n\n## Docker build\nPlease adjust your `RUN go mod download` statement in your Dockerfile to `RUN GO111MODULE=on GOPRIVATE=github.com/KyberNetwork/kybers-trace-error go mod download`\n\n## How to use\n\n### Init global `TracerProvider`\nIn order to push spans and traces to Kyber's self-hosted agent, you have to initialize a TracerProvider. When you add the following statements into your code: `import _ \"github.com/KyberNetwork/kyber-trace-go/pkg/tracer\"`, `kyber-trace-go`, it will initialize a new TraceProvider, set it to global TracerProvider of `otel` package. Whenever you want to get the Tracer to start (or get) a span, just use the function `tracer.Tracer()` (refer the example at https://github.com/KyberNetwork/kyber-trace-go/blob/main/example/tracer.go for more details).\n### Init global `MeterProvider`\nIn order to push customized metrics to Kyber's self-hosted agent, you have to initialize a MeterProvider. When you add the following statement into your code: `import _ \"github.com/KyberNetwork/kyber-trace-go/pkg/metric\"`, `kyber-trace-go`, it will initialize a new MeterProvider, set it to global MeterProvider of `otel` package. Whenever you want to get the Meter to push customized metrics, just use the function `metric.Meter()` (refer the example at https://github.com/KyberNetwork/kyber-trace-go/blob/main/example/meter.go for more details).\n### Configurations\nWhen initializing the global TracerProvider and global MeterProvider, `kyber-trace-go` loads configurations from the following environment variables: \n  - OTEL_ENABLED: `kyber-trace-go` only initializes global `TracerProvider` and global `MeterProvider` if  `OTEL_ENABLED = true`\n  - 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.\n  - 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.\n  - 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.\n  - 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.\n  - 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.\n  - 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.\n  - 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`.\n  - 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.\n  - 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.\n  - 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`\n\n### For gin framework\nIf your application is using gin framework, you can use [this package](https://pkg.go.dev/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin) to trace requests to your application automatically. You can see the example at https://github.com/KyberNetwork/kyber-trace-go/blob/main/example/gin.go\n\n### For GORM\nOpenTelemetry GORM is designed is easy to use and provides a simple API for instrumenting GORM applications, making it possible for developers to quickly add observability to their applications without having to write a lot of code. To instrument GORM, you need to install the plugin provided by otelgorm:\n```\nimport (\n\t\"github.com/uptrace/opentelemetry-go-extra/otelgorm\"\n\t\"gorm.io/driver/sqlite\"\n\t\"gorm.io/gorm\"\n)\n\ndb, err := gorm.Open(sqlite.Open(\"file::memory:?cache=shared\"), \u0026gorm.Config{})\nif err != nil {\n\tpanic(err)\n}\n\nif err := db.Use(otelgorm.NewPlugin()); err != nil {\n\tpanic(err)\n}\n```\nAnd then use db.WithContext(ctx) to propagate the active span via context:\n```\nvar num int\nif err := db.WithContext(ctx).Raw(\"SELECT 42\").Scan(\u0026num).Error; err != nil {\n\tpanic(err)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybernetwork%2Fkyber-trace-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkybernetwork%2Fkyber-trace-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybernetwork%2Fkyber-trace-go/lists"}