{"id":30135912,"url":"https://github.com/dotnetkit/metricflow","last_synced_at":"2025-08-10T22:54:57.530Z","repository":{"id":268040986,"uuid":"902616022","full_name":"DotnetKit/MetricFlow","owner":"DotnetKit","description":"MetricFlow is a .NET library designed to help developers define and track functional and domain-oriented metrics (such as counters, timers, and event-based measurements)","archived":false,"fork":false,"pushed_at":"2025-03-01T21:28:01.000Z","size":106,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-05T01:47:28.575Z","etag":null,"topics":["csharp-library","diagnostics","events","logging","metrics","monitoring"],"latest_commit_sha":null,"homepage":"","language":"C#","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/DotnetKit.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}},"created_at":"2024-12-12T23:23:19.000Z","updated_at":"2025-02-26T23:28:37.000Z","dependencies_parsed_at":"2024-12-14T01:35:00.654Z","dependency_job_id":null,"html_url":"https://github.com/DotnetKit/MetricFlow","commit_stats":null,"previous_names":["dotnetkit/metricflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DotnetKit/MetricFlow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotnetKit%2FMetricFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotnetKit%2FMetricFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotnetKit%2FMetricFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotnetKit%2FMetricFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DotnetKit","download_url":"https://codeload.github.com/DotnetKit/MetricFlow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotnetKit%2FMetricFlow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269803772,"owners_count":24477650,"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-08-10T02:00:08.965Z","response_time":71,"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":["csharp-library","diagnostics","events","logging","metrics","monitoring"],"created_at":"2025-08-10T22:54:55.921Z","updated_at":"2025-08-10T22:54:57.522Z","avatar_url":"https://github.com/DotnetKit.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MetricFlow\n\n![internal](https://github.com/dotnetkit/metricflow/actions/workflows/publish-internal.yml/badge.svg)\n![public](https://github.com/dotnetkit/metricflow/actions/workflows/publish-public.yml/badge.svg)\n![Dotnetkit.MetricFlow](https://img.shields.io/nuget/v/Dotnetkit.MetricFlow)\n\nMetricFlow is a lightweight .NET library designed to help developers define and track functional and domain-oriented metrics (such as counters, timers, and event-based measurements).\n\n## Features\n\n- **Counters**: Track the number of occurrences of an event.\n- **Timers**: Measure the duration of operations.\n- **Event-based Measurements**: Capture and analyze specific events within your application.\n- **Metadata and Tags**: Add contextual information to your metrics for better analysis and filtering.\n- **Sampling**: Control the frequency of metric collection to manage performance and data volume.\n\n## Getting Started\n\n### Prerequisites\n\n- .NET SDK installed on your machine\n\n### Installation\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/yourusername/DotnetKit.git\n    cd DotnetKit/MetricFlow\n    ```\n\n2. Restore dependencies:\n\n    ```sh\n    dotnet restore\n    ```\n\n### Usage\n\nTo use MetricFlow in your project, follow these steps:\n\n1. Define a metric tracker:\n\n    ```csharp\n    var tracker = new MetricTracker(\"ExecutionTimeMetricsTopic\", new()\n    {\n        [\"tenant_id\"] = \"TenantId1\",\n        [\"session_id\"] = Guid.NewGuid().ToString()\n    });\n    ```\n\n2. Track metrics in different ways:\n\n    ```csharp\n    tracker.In(\"GlobalOperation\");\n\n    for (var i = 0; i \u003c 10; i++)\n    {\n        using (var __ = tracker.Track(\"Operation1\", new() { [\"operation_id\"] = $\"{i}\" }))\n        {\n            await Task.Delay(2);\n        }\n        using (var __ = tracker.Track(\"Operation2\", new() { [\"operation_id\"] = $\"{10 - i}\" }))\n        {\n            await Task.Delay(4);\n        }\n    }\n\n    tracker.Out(\"GlobalOperation\");\n\n    Console.WriteLine(tracker.ToString());\n    ```\n\n### Example\n\nThe `SimpleMetricCountersExample` demonstrates how to use the `MetricFlow` library to track and measure metrics in a .NET application. The example includes a `BenchRunner` class that simulates operations and tracks their execution times.\n\n### Running the Example\n\nTo run the example, execute the following command:\n\n```sh\ndotnet run --project examples/SimpleMetricCountersExample\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetkit%2Fmetricflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnetkit%2Fmetricflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetkit%2Fmetricflow/lists"}