{"id":19331972,"url":"https://github.com/tikv/minitrace-go","last_synced_at":"2025-04-22T23:32:41.017Z","repository":{"id":49206074,"uuid":"273230230","full_name":"tikv/minitrace-go","owner":"tikv","description":"A high-performance timeline tracing library for Golang, used by TiDB","archived":false,"fork":false,"pushed_at":"2024-10-24T06:11:34.000Z","size":91,"stargazers_count":45,"open_issues_count":11,"forks_count":7,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-10-25T00:46:35.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/tikv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","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":"2020-06-18T12:19:46.000Z","updated_at":"2022-11-28T08:04:43.000Z","dependencies_parsed_at":"2024-06-19T00:04:40.913Z","dependency_job_id":"24ccf300-9d86-423a-ba6d-11378130a9d5","html_url":"https://github.com/tikv/minitrace-go","commit_stats":null,"previous_names":["pingcap-incubator/minitrace-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikv%2Fminitrace-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikv%2Fminitrace-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikv%2Fminitrace-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikv%2Fminitrace-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tikv","download_url":"https://codeload.github.com/tikv/minitrace-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223906356,"owners_count":17223046,"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":[],"created_at":"2024-11-10T02:43:12.142Z","updated_at":"2024-11-10T02:43:12.817Z","avatar_url":"https://github.com/tikv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minitrace-Go\n[![Actions Status](https://github.com/tikv/minitrace-go/workflows/CI/badge.svg)](https://github.com/tikv/minitrace-go/actions)\n[![LICENSE](https://img.shields.io/github/license/tikv/minitrace-go.svg)](https://github.com/tikv/minitrace-go/blob/master/LICENSE)\n\nA high-performance, ergonomic timeline tracing library for Golang. \n\n## Basic Usage\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"strconv\"\n\n    \"github.com/tikv/minitrace-go\"\n)\n\nfunc tracedFunc(ctx context.Context, event string) {\n    span := minitrace.StartSpan(ctx, event)\n    // code snippet...\n    span.Finish()\n}\n\nfunc iterTracedFunc(ctx context.Context) {\n    // extend tracing context from parent context\n    ctx, span := minitrace.StartSpanWithContext(ctx, \"1\")\n\n    span.AddProperty(\"k2\", \"v2\")\n\n    for i := 2; i \u003c 10; i++ {\n        tracedFunc(ctx, strconv.Itoa(i))\n    }\n    \n    span.Finish()\n}\n\nfunc main() {\n    ctx := context.Background()\n\n    // enable tracing\n    ctx, root := minitrace.StartRootSpan(ctx, \"root\", 0, nil)\n\n    root.AddProperty(\"k1\", \"v1\")\n\n    // pass the context to traced functions\n    iterTracedFunc(ctx)\n\n    // collect tracing results into `spans`\n    spans, _ := root.Collect()\n\n    // do something with `spans`\n    fmt.Printf(\"%+v\", spans)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikv%2Fminitrace-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftikv%2Fminitrace-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikv%2Fminitrace-go/lists"}