{"id":20321320,"url":"https://github.com/go-coldbrew/tracing","last_synced_at":"2026-04-01T19:45:06.409Z","repository":{"id":57561175,"uuid":"328141727","full_name":"go-coldbrew/tracing","owner":"go-coldbrew","description":"Distributed tracing abstraction — OpenTelemetry, OpenTracing, Jaeger, Zipkin, and New Relic","archived":false,"fork":false,"pushed_at":"2026-03-27T14:29:36.000Z","size":189,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T23:42:27.415Z","etag":null,"topics":["coldbrew","distributed-tracing","go","golang","jaeger","jaegertracing","opentelemetry","opentracing","zipkin"],"latest_commit_sha":null,"homepage":"https://docs.coldbrew.cloud","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-coldbrew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-09T11:41:42.000Z","updated_at":"2026-03-27T14:29:38.000Z","dependencies_parsed_at":"2024-06-08T11:46:55.810Z","dependency_job_id":"646e4015-7e60-4583-a088-dcd81e091837","html_url":"https://github.com/go-coldbrew/tracing","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/go-coldbrew/tracing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-coldbrew%2Ftracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-coldbrew%2Ftracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-coldbrew%2Ftracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-coldbrew%2Ftracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-coldbrew","download_url":"https://codeload.github.com/go-coldbrew/tracing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-coldbrew%2Ftracing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"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":["coldbrew","distributed-tracing","go","golang","jaeger","jaegertracing","opentelemetry","opentracing","zipkin"],"created_at":"2024-11-14T19:13:37.857Z","updated_at":"2026-04-01T19:45:06.401Z","avatar_url":"https://github.com/go-coldbrew.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Code generated by gomarkdoc. DO NOT EDIT --\u003e\n\n[![CI](https://github.com/go-coldbrew/tracing/actions/workflows/go.yml/badge.svg)](https://github.com/go-coldbrew/tracing/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-coldbrew/tracing)](https://goreportcard.com/report/github.com/go-coldbrew/tracing)\n[![GoDoc](https://pkg.go.dev/badge/github.com/go-coldbrew/tracing.svg)](https://pkg.go.dev/github.com/go-coldbrew/tracing)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\n\n# tracing\n\n```go\nimport \"github.com/go-coldbrew/tracing\"\n```\n\nPackage tracing provides distributed tracing for Go applications. It offers features such as collecting performance data, identifying where requests spend most of their time, and segmenting requests.\n\nTraces are created and exported via OpenTelemetry. The core package configures the OTEL tracer provider at startup, sending traces to any OTLP\\-compatible backend \\(Jaeger, Grafana Tempo, Honeycomb, etc.\\) or New Relic.\n\n## Index\n\n- [Constants](\u003c#constants\u003e)\n- [func ClientSpan\\(operationName string, ctx context.Context\\) \\(context.Context, oteltrace.Span\\)](\u003c#ClientSpan\u003e)\n- [func CloneContextValues\\(parent context.Context\\) context.Context](\u003c#CloneContextValues\u003e)\n- [func GRPCTracingSpan\\(operationName string, ctx context.Context\\) context.Context](\u003c#GRPCTracingSpan\u003e)\n- [func MergeContextValues\\(parent context.Context, main context.Context\\) context.Context](\u003c#MergeContextValues\u003e)\n- [func MergeParentContext\\(parent context.Context, main context.Context\\) context.Context](\u003c#MergeParentContext\u003e)\n- [func NewContextWithParentValues\\(parent context.Context\\) context.Context](\u003c#NewContextWithParentValues\u003e)\n- [type Span](\u003c#Span\u003e)\n  - [func NewDatastoreSpan\\(ctx context.Context, datastore, operation, collection string\\) \\(Span, context.Context\\)](\u003c#NewDatastoreSpan\u003e)\n  - [func NewExternalSpan\\(ctx context.Context, name string, url string\\) \\(Span, context.Context\\)](\u003c#NewExternalSpan\u003e)\n  - [func NewHTTPExternalSpan\\(ctx context.Context, name string, url string, hdr http.Header\\) \\(Span, context.Context\\)](\u003c#NewHTTPExternalSpan\u003e)\n  - [func NewInternalSpan\\(ctx context.Context, name string\\) \\(Span, context.Context\\)](\u003c#NewInternalSpan\u003e)\n\n\n## Constants\n\n\u003ca name=\"SupportPackageIsVersion1\"\u003e\u003c/a\u003eSupportPackageIsVersion1 is a compile\\-time assertion constant. Downstream packages reference this to enforce version compatibility.\n\n```go\nconst SupportPackageIsVersion1 = true\n```\n\n\u003ca name=\"ClientSpan\"\u003e\u003c/a\u003e\n## func [ClientSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L282\u003e)\n\n```go\nfunc ClientSpan(operationName string, ctx context.Context) (context.Context, oteltrace.Span)\n```\n\nClientSpan starts a new client span linked to the existing spans if any are found in the context. The returned context should be used in place of the original.\n\n\u003ca name=\"CloneContextValues\"\u003e\u003c/a\u003e\n## func [CloneContextValues](\u003chttps://github.com/go-coldbrew/tracing/blob/main/context.go#L25\u003e)\n\n```go\nfunc CloneContextValues(parent context.Context) context.Context\n```\n\nDeprecated: Use [NewContextWithParentValues](\u003c#NewContextWithParentValues\u003e) instead.\n\n\u003ca name=\"GRPCTracingSpan\"\u003e\u003c/a\u003e\n## func [GRPCTracingSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L288\u003e)\n\n```go\nfunc GRPCTracingSpan(operationName string, ctx context.Context) context.Context\n```\n\nGRPCTracingSpan starts a new server span from incoming gRPC metadata. The returned context should be used in place of the original.\n\n\u003ca name=\"MergeContextValues\"\u003e\u003c/a\u003e\n## func [MergeContextValues](\u003chttps://github.com/go-coldbrew/tracing/blob/main/context.go#L47\u003e)\n\n```go\nfunc MergeContextValues(parent context.Context, main context.Context) context.Context\n```\n\nMergeContextValues merged the given main context with a parent context, Cancel/Deadline etc are used from the main context and values are looked in both the contexts can be use to merge a parent context with a new context, the new context will have the values from both the contexts\n\n\u003ca name=\"MergeParentContext\"\u003e\u003c/a\u003e\n## func [MergeParentContext](\u003chttps://github.com/go-coldbrew/tracing/blob/main/context.go#L41\u003e)\n\n```go\nfunc MergeParentContext(parent context.Context, main context.Context) context.Context\n```\n\nDeprecated: Use [MergeContextValues](\u003c#MergeContextValues\u003e) instead.\n\n\u003ca name=\"NewContextWithParentValues\"\u003e\u003c/a\u003e\n## func [NewContextWithParentValues](\u003chttps://github.com/go-coldbrew/tracing/blob/main/context.go#L31\u003e)\n\n```go\nfunc NewContextWithParentValues(parent context.Context) context.Context\n```\n\nNewContextWithParentValues clones a given context values and returns a new context obj which is not affected by Cancel, Deadline etc can be used to pass context values to a new context which is not affected by the parent context cancel/deadline etc from parent\n\n\u003ca name=\"Span\"\u003e\u003c/a\u003e\n## type [Span](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L46-L57\u003e)\n\nSpan defines an interface for implementing a tracing span. Consumers use this to create and annotate spans without coupling to a specific tracing backend.\n\n```go\ntype Span interface {\n    // End ends the span, can also use Finish()\n    End()\n    // Finish ends the span, can also use End()\n    Finish()\n    // SetTag sets a tag on the span, can be used to add custom attributes\n    SetTag(key string, value any)\n    // SetQuery sets the query on the span, can be used to add query for datastore spans\n    SetQuery(query string)\n    // SetError sets the error on the span\n    SetError(err error) error\n}\n```\n\n\u003ca name=\"NewDatastoreSpan\"\u003e\u003c/a\u003e\n### func [NewDatastoreSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L172\u003e)\n\n```go\nfunc NewDatastoreSpan(ctx context.Context, datastore, operation, collection string) (Span, context.Context)\n```\n\nNewDatastoreSpan starts a span for tracing data store actions. This is used to trace actions against a data store, for example, a database query or a redis call.\n\n\u003cdetails\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\u003cp\u003e\n\n\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-coldbrew/tracing\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t// Create a span for a database operation\n\tspan, ctx := tracing.NewDatastoreSpan(ctx, \"postgres\", \"SELECT\", \"users\")\n\tdefer span.End()\n\n\t// Run your query — the span records datastore, operation, and collection\n\t_ = ctx\n}\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003ca name=\"NewExternalSpan\"\u003e\u003c/a\u003e\n### func [NewExternalSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L258\u003e)\n\n```go\nfunc NewExternalSpan(ctx context.Context, name string, url string) (Span, context.Context)\n```\n\nNewExternalSpan starts a span for tracing external actions. This is used to trace actions against an external service.\n\n\u003cdetails\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\u003cp\u003e\n\n\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-coldbrew/tracing\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t// Create a span for an external service call\n\tspan, ctx := tracing.NewExternalSpan(ctx, \"payment-gateway\", \"/charge\")\n\tdefer span.End()\n\n\t// Make the external call — the span tracks the dependency\n\t_ = ctx\n}\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003ca name=\"NewHTTPExternalSpan\"\u003e\u003c/a\u003e\n### func [NewHTTPExternalSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L265\u003e)\n\n```go\nfunc NewHTTPExternalSpan(ctx context.Context, name string, url string, hdr http.Header) (Span, context.Context)\n```\n\nNewHTTPExternalSpan starts a span for tracing external HTTP actions. It also injects trace propagation headers so the external service can correlate the call back to this service.\n\n\u003ca name=\"NewInternalSpan\"\u003e\u003c/a\u003e\n### func [NewInternalSpan](\u003chttps://github.com/go-coldbrew/tracing/blob/main/tracing.go#L143\u003e)\n\n```go\nfunc NewInternalSpan(ctx context.Context, name string) (Span, context.Context)\n```\n\nNewInternalSpan starts a span for tracing internal actions. This is used to trace actions within the same service, for example, a function call.\n\n\u003cdetails\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\u003cp\u003e\n\n\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-coldbrew/tracing\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t// Create a span for internal business logic\n\tspan, ctx := tracing.NewInternalSpan(ctx, \"processOrder\")\n\tdefer span.End()\n\n\t// Your logic here — the span tracks duration and errors\n\t_ = ctx\n}\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\nGenerated by [gomarkdoc](\u003chttps://github.com/princjef/gomarkdoc\u003e)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-coldbrew%2Ftracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-coldbrew%2Ftracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-coldbrew%2Ftracing/lists"}