{"id":16089615,"url":"https://github.com/jbogard/mongodb.driver.core.extensions.diagnosticsources","last_synced_at":"2025-04-09T10:08:55.057Z","repository":{"id":44512259,"uuid":"269366509","full_name":"jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources","owner":"jbogard","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-01T14:37:51.000Z","size":71,"stargazers_count":51,"open_issues_count":6,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T08:11:24.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jbogard.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":"2020-06-04T13:25:46.000Z","updated_at":"2025-03-11T11:26:50.000Z","dependencies_parsed_at":"2022-09-19T02:01:31.924Z","dependency_job_id":"3e3c0769-cfe3-40ca-86d4-d2c762a320db","html_url":"https://github.com/jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbogard%2FMongoDB.Driver.Core.Extensions.DiagnosticSources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbogard%2FMongoDB.Driver.Core.Extensions.DiagnosticSources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbogard%2FMongoDB.Driver.Core.Extensions.DiagnosticSources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbogard%2FMongoDB.Driver.Core.Extensions.DiagnosticSources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbogard","download_url":"https://codeload.github.com/jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"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-10-09T14:04:55.354Z","updated_at":"2025-04-09T10:08:55.030Z","avatar_url":"https://github.com/jbogard.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDB.Driver.Core.Extensions.DiagnosticSources\n\n![CI](https://github.com/jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources/workflows/CI/badge.svg)\n[![NuGet](https://img.shields.io/nuget/dt/MongoDB.Driver.Core.Extensions.DiagnosticSources.svg)](https://www.nuget.org/packages/MongoDB.Driver.Core.Extensions.DiagnosticSources) \n[![NuGet](https://img.shields.io/nuget/vpre/MongoDB.Driver.Core.Extensions.DiagnosticSources.svg)](https://www.nuget.org/packages/MongoDB.Driver.Core.Extensions.DiagnosticSources)\n[![MyGet (dev)](https://img.shields.io/myget/jbogard-ci/v/MongoDB.Driver.Core.Extensions.DiagnosticSources.svg)](https://myget.org/gallery/jbogard-ci)\n\n## Usage\n\nThis repo includes the package:\n\n - [MongoDB.Driver.Core.Extensions.DiagnosticSources](https://www.nuget.org/packages/MongoDB.Driver.Core.Extensions.DiagnosticSources/)\n\nThe `MongoDB.Driver.Core.Extensions.DiagnosticSources` package extends the core MongoDB C# driver to expose telemetry information via `System.Diagnostics`.\n\nTo use `MongoDB.Driver.Core.Extensions.DiagnosticSources`, you need to configure your `MongoClientSettings` to add this MongoDB event subscriber:\n\n```csharp\nvar clientSettings = MongoClientSettings.FromUrl(mongoUrl);\nclientSettings.ClusterConfigurator = cb =\u003e cb.Subscribe(new DiagnosticsActivityEventSubscriber());\nvar mongoClient = new MongoClient(clientSettings);\n```\n\nTo capture the command text as part of the activity:\n\n```csharp\nvar clientSettings = MongoClientSettings.FromUrl(mongoUrl);\nvar options = new InstrumentationOptions { CaptureCommandText = true };\nclientSettings.ClusterConfigurator = cb =\u003e cb.Subscribe(new DiagnosticsActivityEventSubscriber(options));\nvar mongoClient = new MongoClient(clientSettings);\n```\n\nTo filter activities by collection name:\n\n```csharp\nvar clientSettings = MongoClientSettings.FromUrl(mongoUrl);\nvar options = new InstrumentationOptions { ShouldStartActivity = @event =\u003e !\"collectionToIgnore\".Equals(@event.GetCollectionName()) };\nclientSettings.ClusterConfigurator = cb =\u003e cb.Subscribe(new DiagnosticsActivityEventSubscriber(options));\nvar mongoClient = new MongoClient(clientSettings);\n```\n\nThis package exposes an [`ActivitySource`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.activitysource?view=net-5.0) with a `Name` the same as the assembly, `MongoDB.Driver.Core.Extensions.DiagnosticSources`. Use this name in any [`ActivityListener`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.activitylistener?view=net-5.0)-based listeners.\n\nAll the available [OpenTelemetry semantic tags](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md) are set.\n \nThis package supports MongoDB C# Driver versions 3.0.0 and above.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbogard%2Fmongodb.driver.core.extensions.diagnosticsources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbogard%2Fmongodb.driver.core.extensions.diagnosticsources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbogard%2Fmongodb.driver.core.extensions.diagnosticsources/lists"}