{"id":21497045,"url":"https://github.com/financial-times/transactionid-utils-go","last_synced_at":"2026-01-10T16:55:34.478Z","repository":{"id":54494879,"uuid":"49529341","full_name":"Financial-Times/transactionid-utils-go","owner":"Financial-Times","description":"For handling/creating transactionIDs and passing them around in a Go app","archived":false,"fork":false,"pushed_at":"2024-05-13T13:19:26.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-06-20T11:16:52.788Z","etag":null,"topics":["universal-publishing"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Financial-Times.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-12T21:16:01.000Z","updated_at":"2024-05-13T12:50:12.000Z","dependencies_parsed_at":"2024-06-19T01:27:51.100Z","dependency_job_id":null,"html_url":"https://github.com/Financial-Times/transactionid-utils-go","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Ftransactionid-utils-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Ftransactionid-utils-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Ftransactionid-utils-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Ftransactionid-utils-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Financial-Times","download_url":"https://codeload.github.com/Financial-Times/transactionid-utils-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226065538,"owners_count":17568226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["universal-publishing"],"created_at":"2024-11-23T16:21:10.446Z","updated_at":"2026-01-10T16:55:34.440Z","avatar_url":"https://github.com/Financial-Times.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transaction ID library\n\nThis library supports transaction id handling. It provides methods for checking an http request for an\n'X-Request-Id' header, and if present using the value of this as a transaction id.\n\nIf the header isn't present, the library will generate a transaction with a 'tid_' prefix\n and a random 10 character string.\n\nGo provides support for passing around variables associated with a request lifecycle via the [context package](https://godoc.org/golang.org/x/net/context)\n\nBest practice for using this is to specify a context as the first argument to your function\n (see [here](https://blog.golang.org/context) for more information along with examples that this library draws on).\n\n## Examples\nTo extract a transactionID from a request, and create one if none found:\n\n    transactionID := transactionidutils.GetTransactionIDFromRequest(req)\n\nTo store that on a context:\n\n    transactionAwareContext := transactionidutils.TransactionAwareContext(context.Background(), transactionID)\n\nNB: context.Background() is a non-nil, empty Context, typically used as the top-level context for incoming requests.\n\nFor extracting from a context:\n\n  transactionID, err := GetTransactionIDFromContext(ctx)\n\nIt's expected that the transaction ID will be used to output logs. An example using logrus:\n\n\tlog := log.WithFields(log.Fields{\n\t\ttransactionIdKey: ctx.Value(transactionIdKey),\n\t})\n\nNB: this will use the standard transaction id key(\"transaction_id\") that is already used for Content programme log files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Ftransactionid-utils-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinancial-times%2Ftransactionid-utils-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Ftransactionid-utils-go/lists"}