{"id":30872942,"url":"https://github.com/mralias/bind","last_synced_at":"2025-09-07T22:47:01.080Z","repository":{"id":310748377,"uuid":"1041007199","full_name":"MrAlias/bind","owner":"MrAlias","description":"Bind OpenTelemetry metric instruments to attributes","archived":false,"fork":false,"pushed_at":"2025-09-07T14:50:07.000Z","size":76,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-07T16:31:18.577Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrAlias.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","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":"2025-08-19T20:53:59.000Z","updated_at":"2025-09-07T14:50:08.000Z","dependencies_parsed_at":"2025-08-20T02:32:53.806Z","dependency_job_id":"6d22aadd-a948-490a-8ccd-dc01af99a165","html_url":"https://github.com/MrAlias/bind","commit_stats":null,"previous_names":["mralias/bind"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/MrAlias/bind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fbind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fbind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fbind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fbind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrAlias","download_url":"https://codeload.github.com/MrAlias/bind/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fbind/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274107985,"owners_count":25223473,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-09-07T22:46:56.207Z","updated_at":"2025-09-07T22:47:01.072Z","avatar_url":"https://github.com/MrAlias.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bind\n\n[![CI](https://github.com/MrAlias/bind/actions/workflows/ci.yml/badge.svg)](https://github.com/MrAlias/bind/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/MrAlias/bind/branch/main/graph/badge.svg)](https://codecov.io/gh/MrAlias/bind)\n[![Go Report Card](https://goreportcard.com/badge/github.com/MrAlias/bind)](https://goreportcard.com/report/github.com/MrAlias/bind)\n[![Go Reference](https://pkg.go.dev/badge/github.com/MrAlias/bind.svg)](https://pkg.go.dev/github.com/MrAlias/bind)\n[![GitHub release](https://img.shields.io/github/release/MrAlias/bind.svg)](https://github.com/MrAlias/bind/releases)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n`bind` is a Go library for binding [OpenTelemetry] synchronous metric instruments to attributes.\nThis can greatly improve performance for instrumentation when measurements are only recorded for known static attribute sets.\n\n## Installation\n\n```sh\ngo get github.com/MrAlias/bind\n```\n\n## Usage\n\n```go\nimport (\n \"github.com/MrAlias/bind\"\n \"go.opentelemetry.io/otel/attribute\"\n \"go.opentelemetry.io/otel/metric\"\n)\n\n// Example: Bind attributes to a Float64Counter\ncounter := bind.Float64Counter(myCounter, attribute.String(\"user\", \"Alice\"))\n\n// Measured with {\"user\": \"Alice\"}\ncounter.Add(ctx, 1.0)\n\n// Measured with {\"user\": \"Alice\", \"id: 1}\ncounter.Add(ctx, 2.0, metric.WithAttributes(attribute.Int(\"id\", 1)))\n\n// Bind additional attributes to the counter.\ncounter = bind.Float64Counter(counter, attribute.Bool(\"admin\", true))\n\n// Measure with {\"user\": \"Alice\", \"admin\": true}\ncounter.Add(ctx, -1.0)\n\n// Unwrap to get the underlying instrument (i.e. myCounter) and attributes\n// (i.e. {\"user\": \"Alice\", \"admin\": true})\nbase, attrs := bind.Unwrap(counter)\n```\n\nSee [GoDoc] for full API documentation and examples.\n\n## Contributing\n\nContributions are welcome!\nPlease see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n\nLicensed under the [Apache 2.0 License](LICENSE).\n\n[OpenTelemetry]: opentelemetry.io\n[GoDoc]: https://pkg.go.dev/github.com/MrAlias/bind\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmralias%2Fbind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmralias%2Fbind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmralias%2Fbind/lists"}