{"id":18811743,"url":"https://github.com/logicmonitor/lm-telemetry-sdk-dotnet","last_synced_at":"2026-02-03T23:31:52.384Z","repository":{"id":40514601,"uuid":"440043340","full_name":"logicmonitor/lm-telemetry-sdk-dotnet","owner":"logicmonitor","description":"LogicMonitor Telemetry SDK","archived":false,"fork":false,"pushed_at":"2022-08-03T21:34:27.000Z","size":791,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T21:05:09.698Z","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":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logicmonitor.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}},"created_at":"2021-12-20T04:36:14.000Z","updated_at":"2022-03-15T13:54:55.000Z","dependencies_parsed_at":"2022-07-22T14:48:04.644Z","dependency_job_id":null,"html_url":"https://github.com/logicmonitor/lm-telemetry-sdk-dotnet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/logicmonitor/lm-telemetry-sdk-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-telemetry-sdk-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-telemetry-sdk-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-telemetry-sdk-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-telemetry-sdk-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicmonitor","download_url":"https://codeload.github.com/logicmonitor/lm-telemetry-sdk-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-telemetry-sdk-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263568050,"owners_count":23481605,"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-11-07T23:27:30.741Z","updated_at":"2026-02-03T23:31:52.267Z","avatar_url":"https://github.com/logicmonitor.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lm-telemetry-sdk-dotnet\nLogicMonitor Telemetry SDK\n\n## AUTO INSTRUMENTATION\n\nTo auto-instrument applications, the instrumentation:\n\n1. Injects and configures the [OpenTelemetry .NET SDK](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/README.md#opentelemetry-net-sdk) into the application.\n2. Adds [OpenTelemetry Instrumentation](https://opentelemetry.io/docs/concepts/instrumenting/) to key packages and APIs used by the application.\n\nThe auto-instrumentation is capable of injecting instrumentations at runtime, a technique known as monkey-patching. This allows to instrument specific packages or APIs that don't provide the necessary hooks to generate .NET instrumentation packages.\n\n### Mimimun Requirement\n\n`System.Diagnostics.DiagnosticSource version 6.0.0`\n\nDynamically loading System.Diagnostics.DiagnosticSource.dll with a higher version than the one from framework/package will crash the process.\nLinked issue - [`Diagnostic Source assembly versioning Issue`](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/issues/260).\nHence it is recommended to uses System.Diagnostics.DiagnosticSource version 6.0.0 or higher.\n\n### Instrument a .NET application\n\nBefore executing the application,first build the application and then set the following environment variables:\n\n```env\nDOTNET_ADDITIONAL_DEPS=./%InstallationLocation%/AdditionalDeps\nDOTNET_SHARED_STORE=%InstallationLocation%/store\nDOTNET_STARTUP_HOOKS=%InstallationLocation%/netcoreapp3.1/LMStartupHook.dll\nOTEL_DOTNET_AUTO_ENABLED_INSTRUMENTATIONS=AspNet,HttpClient,SqlClient\nOTEL_TRACES_EXPORTER=otlp\nOTEL_EXPORTER_OTLP_ENDPOINT=\u003cYOUR_OTLP_ENDPOINT\u003e\nOTEL_SERVICE_NAME=\u003cYOUR_SERVICE_NAME\u003e\n```\n** InstallationLocation refers to /bin/tracer-home **\n\n## ENVIRONMENT VARIABLES\n\nTo Auto instrument .Net application using LMStartupHook, the following environment variables need to be set:\n\n### LMStartupHook\n\nTo initialise LMStartupHook which will then invoke opentelemetry startuphook.\n| Environment variable | Value |\n|-|-|\n| `DOTNET_STARTUP_HOOKS` | `%InstallationLocation%/netcoreapp3.1/LMStartupHook.dll` |\n\n\n### .NET Runtime Additional-Deps and Package Store\n\nTo resolve assembly version conflicts in .NET Core,\nset the\n[`DOTNET_ADDITIONAL_DEPS`](https://github.com/dotnet/runtime/blob/main/docs/design/features/additional-deps.md)\nand [`DOTNET_SHARED_STORE`](https://docs.microsoft.com/en-us/dotnet/core/deploying/runtime-store)\nenvironment variables to the following values:\n\n| Environment variable | Value |\n|-|-|\n| `DOTNET_ADDITIONAL_DEPS` | `./%InstallationLocation%/AdditionalDeps` |\n| `DOTNET_SHARED_STORE` | `%InstallationLocation%/store` |\n\n### Resources\n\n| Environment variable | Description | Default |\n|-|-|-|\n| `OTEL_RESOURCE_ATTRIBUTES` | Key-value pairs to be used as resource attributes. See [Resource SDK](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. For example, OTEL_RESOURCE_ATTRIBUTES=\"key1=value1,key2=value2\"| See [Resource semantic conventions](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value) for details. |\n| `OTEL_SERVICE_NAME` | Sets the value of the [`service.name`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service) resource attribute. If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. | `unknown_service:%ProcessName%` |\n\nThe LMStartupHook invokes Lm-telemetry-dotnet resource detector to automatically detect resource attributes.Currently lm-telemetry-dotnet resource detector can only detect AWS EC2 environment variables along with service name.\nTo disable lm auto resource detection, set the `DISABLE_RESOURCE_DETECTION` variable to `1`. Default value is `0`.\n\n### Instumented libraries and framework\nTo use specific instrumentations, set the `OTEL_DOTNET_AUTO_ENABLED_INSTRUMENTATIONS` environment variable. Following are currently supported instrumentation libraries and frameworks.\n\n| ID | Library | Instrumentation type |\n|-|-|-|\n| `AspNet` | ASP.NET and ASP.NET Core | source |\n| `GraphQL` | [GraphQL](https://www.nuget.org/packages/GraphQL/) | bytecode |\n| `HttpClient` | [System.Net.Http.HttpClient](https://docs.microsoft.com/dotnet/api/system.net.http.httpclient) and [System.Net.HttpWebRequest](https://docs.microsoft.com/dotnet/api/system.net.httpwebrequest) | source |\n| `MongoDb` | [MongoDB.Driver.Core](https://www.nuget.org/packages/MongoDB.Driver.Core/) | bytecode |\n| `SqlClient` | [Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient) and [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient) | source |\n\n### ASP.NET (.NET Framework) Instrumentation\n\nASP.NET instrumentation on .NET Framework requires installing the\n[`OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule`](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/)\nNuGet package on the instrumented project.\nSee [the WebConfig section](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.AspNet#step-2-modify-webconfig) for more information.\n\n### Exporters\n\nThe exporter is used to output the telemetry.\n| Environment variable | Description | Default |\n|-|-|-|\n| `OTEL_TRACES_EXPORTER` | The traces exporter to be used. Available values are: `jeager`, `otlp`, `none`. | `otlp` |\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | Target endpoint for OTLP exporter. More details [here](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md). | `http://localhost:4318` for `http/protobuf` protocol, `http://localhost:4317` for `grpc` protocol |\n| `OTEL_EXPORTER_OTLP_HEADERS` | Key-value pairs to be used as headers associated with gRPC or HTTP requests. More details [here](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md). | |\n| `OTEL_EXPORTER_OTLP_TIMEOUT` | Maximum time the OTLP exporter will wait for each batch export. | `1000` (ms) |\n| `OTEL_EXPORTER_OTLP_PROTOCOL` | The OTLP expoter transport protocol. Supported values: `grpc`, `http/protobuf`. [1] | `http/protobuf` |\n\n### Environment Change Log\n\n| Old Environment variable | New Environment variable | Description | Default |\n|-|-|-|-|\n| `OTEL_DOTNET_TRACER_INSTRUMENTATIONS` | `OTEL_DOTNET_AUTO_ENABLED_INSTRUMENTATIONS` | Comma-separated list of source instrumentations you want to enable.| |\n| `OTEL_DOTNET_TRACER_CONSOLE_EXPORTER_ENABLED` | `OTEL_DOTNET_AUTO_CONSOLE_EXPORTER_ENABLED` | Whether the console exporter is enabled or not.| `false` |\n| `OTEL_DOTNET_TRACER_LOAD_AT_STARTUP` | `OTEL_DOTNET_AUTO_LOAD_AT_STARTUP` | Whether the tracer is created by the automatic instrumentation library or not. Set to false when the application initializes the OpenTelemetry .NET SDK Tracer on its own. This configuration can be used, for example, to retrieve the bytecode instrumentations.| `true` |\n| `OTEL_DOTNET_TRACER_ADDITIONAL_SOURCES` | `OTEL_DOTNET_AUTO_ADDITIONAL_SOURCES` |Comma-separated list of additional ActivitySource names to be added to the tracer at the startup. Use it to capture manually instrumented spans.||å\n| `OTEL_DOTNET_TRACER_INSTRUMENTATION_PLUGINS` | `OTEL_DOTNET_AUTO_INSTRUMENTATION_PLUGINS` | Colon-separated list of OTel SDK instrumentation plugins represented by System.Type.AssemblyQualifiedName.||\n## UPDATING OPENTELEMETRY-DOTNET-INSTRUMENTATION SUBMODULE\n\n - To initialise submodule: \n   -  git submodule init\n   -  git submodule update\n - To checkout specific commit of [opentelemetry-dotnet-instrumentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation) repository \n   -  git checkout \u003ccommit-id\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-telemetry-sdk-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicmonitor%2Flm-telemetry-sdk-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-telemetry-sdk-dotnet/lists"}