{"id":13451277,"url":"https://github.com/opentracing-contrib/csharp-netcore","last_synced_at":"2025-10-19T07:46:28.957Z","repository":{"id":30035311,"uuid":"123456377","full_name":"opentracing-contrib/csharp-netcore","owner":"opentracing-contrib","description":"OpenTracing instrumentation for .NET Core 3.1 \u0026 .NET 6+ apps","archived":false,"fork":false,"pushed_at":"2025-03-15T19:45:36.000Z","size":290,"stargazers_count":263,"open_issues_count":14,"forks_count":72,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-15T00:38:07.789Z","etag":null,"topics":["aspnetcore","distributed-tracing","dotnet-core","opentracing","tracing"],"latest_commit_sha":null,"homepage":"","language":"C#","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/opentracing-contrib.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":"2018-03-01T15:48:34.000Z","updated_at":"2024-12-31T03:20:49.000Z","dependencies_parsed_at":"2024-01-13T17:47:59.491Z","dependency_job_id":"aee85c0e-8b1e-4ded-a20d-76e6fe999da3","html_url":"https://github.com/opentracing-contrib/csharp-netcore","commit_stats":{"total_commits":85,"total_committers":17,"mean_commits":5.0,"dds":0.2823529411764706,"last_synced_commit":"f64af79ae582cebf52dcdb54797d2545a2bb0565"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fcsharp-netcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fcsharp-netcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fcsharp-netcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fcsharp-netcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentracing-contrib","download_url":"https://codeload.github.com/opentracing-contrib/csharp-netcore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986270,"owners_count":21194024,"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":["aspnetcore","distributed-tracing","dotnet-core","opentracing","tracing"],"created_at":"2024-07-31T07:00:51.039Z","updated_at":"2025-10-19T07:46:28.904Z","avatar_url":"https://github.com/opentracing-contrib.png","language":"C#","funding_links":[],"categories":["C\\#","C# #"],"sub_categories":[],"readme":"[![nuget](https://img.shields.io/nuget/v/OpenTracing.Contrib.NetCore.svg?logo=nuget)](https://www.nuget.org/packages/OpenTracing.Contrib.NetCore)\n\n# OpenTracing instrumentation for .NET Core apps\n\nThis repository provides OpenTracing instrumentation for .NET Core based applications.\nIt can be used with any OpenTracing compatible tracer.\n\n_**IMPORTANT:** OpenTracing and OpenCensus have merget to form **[OpenTelemetry](https://opentelemetry.io)**! The OpenTelemetry .NET library can be found at [https://github.com/open-telemetry/opentelemetry-dotnet](https://github.com/open-telemetry/opentelemetry-dotnet)._\n\n## Supported .NET versions\n\nThis project currently only supports apps targeting .NET Core 3.1, .NET 6.0, or .NET 7.0!\n\nThis project DOES NOT support the full .NET framework as that uses different instrumentation code.\n\n## Supported libraries and frameworks\n\n#### DiagnosticSource based instrumentation\n\nThis project supports any library or framework that uses .NET's [`DiagnosticSource`](https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md)\nto instrument its code. It will create a span for every [`Activity`](https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md)\nand it will create `span.Log` calls for all other diagnostic events.\n\nTo further improve the tracing output, the library provides enhanced instrumentation\n(Inject/Extract, tags, configuration options) for the following libraries / frameworks:\n\n* ASP.NET Core\n* Entity Framework Core\n* System.Net.Http (HttpClient)\n* System.Data.SqlClient\n* Microsoft.Data.SqlClient\n\n#### Microsoft.Extensions.Logging based instrumentation\n\nThis project also adds itself as a logger provider for logging events from the `Microsoft.Extensions.Logging` system.\nIt will create `span.Log` calls for each logging event, however it will only create them if there is an active span (`ITracer.ActiveSpan`).\n\n## Usage\n\nThis project depends on several packages from Microsofts `Microsoft.Extensions.*` stack (e.g. Dependency Injection, Logging)\nso its main use case is ASP.NET Core apps and any other Microsoft.Extensions-based console apps.\n\n##### 1. Add the NuGet package `OpenTracing.Contrib.NetCore` to your project.\n\n##### 2. Add the OpenTracing services to your `IServiceCollection` via `services.AddOpenTracing()`.\n\nHow you do this depends on how you've setup the `Microsoft.Extensions.DependencyInjection` system in your app.\n\nIn ASP.NET Core apps you can add the call to your `ConfigureServices` method (of your `Program.cs` file):\n\n```csharp\npublic static IWebHost BuildWebHost(string[] args)\n{\n    return WebHost.CreateDefaultBuilder(args)\n        .UseStartup\u003cStartup\u003e()\n        .ConfigureServices(services =\u003e\n        {\n            // Enables and automatically starts the instrumentation!\n            services.AddOpenTracing();\n        })\n        .Build();\n}\n```\n\n##### 3. Make sure `InstrumentationService`, which implements `IHostedService`, is started.\n\n`InstrumentationService` is responsible for starting and stopping the instrumentation.\nThe service implements `IHostedService` so **it is automatically started in ASP.NET Core**,\nhowever if you have your own console host, you manually have to call `StartAsync` and `StopAsync`.\n\nNote that .NET Core 2.1 greatly simplified this setup by introducing a generic `HostBuilder` that works similar to the existing `WebHostBuilder` from ASP.NET Core. Have a look at the `TrafficGenerator` sample for an example of a `HostBuilder` based console application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentracing-contrib%2Fcsharp-netcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentracing-contrib%2Fcsharp-netcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentracing-contrib%2Fcsharp-netcore/lists"}