{"id":17462855,"url":"https://github.com/mralias/flow","last_synced_at":"2025-04-19T18:53:04.166Z","repository":{"id":38002452,"uuid":"464611459","full_name":"MrAlias/flow","owner":"MrAlias","description":"An OpenTelemetry SpanProcessor reporting tracing flow metrics","archived":false,"fork":false,"pushed_at":"2025-03-23T05:39:08.000Z","size":210,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T11:51:46.196Z","etag":null,"topics":["metrics","opentelemetry","opentelemetry-go","otel","prometheus","tracing"],"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/MrAlias.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":"2022-02-28T19:12:01.000Z","updated_at":"2025-03-16T14:31:10.000Z","dependencies_parsed_at":"2024-02-25T16:29:16.329Z","dependency_job_id":"deb65f08-d397-417f-8cb6-d043cc79968d","html_url":"https://github.com/MrAlias/flow","commit_stats":{"total_commits":143,"total_committers":3,"mean_commits":"47.666666666666664","dds":0.2027972027972028,"last_synced_commit":"bd02aa1ddeeb145e73a8c9888cc4c5f25c8242f2"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrAlias%2Fflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrAlias","download_url":"https://codeload.github.com/MrAlias/flow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249239263,"owners_count":21235826,"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":["metrics","opentelemetry","opentelemetry-go","otel","prometheus","tracing"],"created_at":"2024-10-18T09:10:05.842Z","updated_at":"2025-04-16T12:30:48.128Z","avatar_url":"https://github.com/MrAlias.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flow\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/MrAlias/flow.svg)](https://pkg.go.dev/github.com/MrAlias/flow)\n\nAn OpenTelemetry [`SpanProcessor`] reporting tracing flow metrics.\n\n## Getting Started\n\nAssuming you have working code using the OpenTelemetry SDK, update the\nregistration of your exporter to use a wrapped [`SpanProcessor`].\n\nUpdate your exporter registration with a [`BatchSpanProcessor`] to use the\nequivalent `flow` [`TracerProviderOption`].\n\n```go\nimport (\n\t\"github.com/MrAlias/flow\"\n\t\"go.opentelemetry.io/otel/sdk/trace\"\n)\n\nfunc main() {\n\tsdk := trace.NewTracerProvider(flow.WithBatcher(exporter{}))\n\t/* ... */\n}\n```\n\nMore generically, all [`SpanProcessor`]s can be wrapped directly.\n\n```go\nimport (\n\t\"github.com/MrAlias/flow\"\n\t\"go.opentelemetry.io/otel/sdk/trace\"\n)\n\nfunc main() {\n\tspanProcessor := trace.NewSimpleSpanProcessor(exporter{})\n\tsdk := trace.NewTracerProvider(flow.WithSpanProcessor(spanProcessor))\n\t/* ... */\n}\n```\n\nSee the included [example](./example) for an end-to-end illustration of\nfunctionality.\n\n## Produced Metrics\n\nThe `flow` [`SpanProcessor`] will report `spans_total` metrics as a counter.\nThey are exposed at `localhost:41820` by default (this can be changed using the\n`WithListenAddress` option).\n\n```sh\n$ curl -s http://localhost:41820/metrics | grep 'spans_total'\n\n# HELP spans_total The total number of processed spans\n# TYPE spans_total counter\nspans_total{state=\"ended\"} 762\nspans_total{state=\"started\"} 762\n```\n\nConfigure a locally running [Prometheus] or [OpenTelemetry Collector] instance\nto scrape these using a scrape target similar to this.\n\n```yaml\nscrape_configs:\n- job_name: myapp\n  static_configs:\n  - targets:\n    - 'localhost:41820'\n```\n\n[`SpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor\n[`BatchSpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#NewBatchSpanProcessor\n[`TracerProviderOption`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#TracerProviderOption\n[Prometheus]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/\n[OpenTelemetry Collector]: https://opentelemetry.io/docs/collector/configuration/#receivers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmralias%2Fflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmralias%2Fflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmralias%2Fflow/lists"}