{"id":18798724,"url":"https://github.com/liteobject/demo.opentelemetry","last_synced_at":"2025-07-22T17:38:03.910Z","repository":{"id":90788647,"uuid":"522013547","full_name":"LiteObject/Demo.OpenTelemetry","owner":"LiteObject","description":"OpenTelemetry with Jaeger, ZipKin, Prometheus, etc.","archived":false,"fork":false,"pushed_at":"2024-04-12T22:57:52.000Z","size":23,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T18:23:37.800Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiteObject.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-08-06T17:38:50.000Z","updated_at":"2022-08-06T17:39:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"d69559e7-45b5-4b48-80df-526c3a882d95","html_url":"https://github.com/LiteObject/Demo.OpenTelemetry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2FDemo.OpenTelemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2FDemo.OpenTelemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2FDemo.OpenTelemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2FDemo.OpenTelemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiteObject","download_url":"https://codeload.github.com/LiteObject/Demo.OpenTelemetry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239727055,"owners_count":19687099,"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-07T22:12:45.206Z","updated_at":"2025-02-19T20:16:11.029Z","avatar_url":"https://github.com/LiteObject.png","language":"C#","readme":"# Open Telemetry\n\u003eOpenTelemetry is a set of APIs, SDKs, tooling and integrations that are designed for the creation and management of telemetry data such as traces, metrics, and logs. The project provides a vendor-agnostic implementation that can be configured to send telemetry data to the backends of your choice. It supports a variety of popular open-source projects including Jaeger and Prometheus. Also, a lot of vendors support OpenTelemetry directly or using the OpenTelemetry Collector.\n\nOpenTelemetry defines 3 concepts when instrumenting an application:\n- [Logging](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/overview.md)\n  - OpenTelemetry relies on Microsoft.Extensions.Logging.Abstractions to handle logging.\n- [Tracing](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md)\n  - OpenTelemetry relies on types in System.Diagnostics.* to support tracing.\n- [Metrics](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md)\n  - Metrics API are incorporated directly into the .NET runtime itself. So, you can instrument your application by simply depending on System.Diagnostics.*. .NET supports 4 kind of metrics: Counter, ObservableCounter, Histogram, ObservableGauge\n\n## Key Terms\n\n| System.Diagnostics | OpenTelemetry | Meaning |\n|:---|:---|:---|\n|ActivitySource|Tracer|A source of tracing activity. Normal to have many per app.|\n|Activity|TelemetrySpan|Represents a single unit of work recorded during a trace.|\n|ActivityContext|SpanContext|The propagation context used to correlate spans.|\n|Attributes|Attributes|Searchable properties of a span.|\n|Events|Events|Log events and other items recorded during an individual span.|\n|Meter|Meter|ActivitySource equivalent, but for metrics|\n|Counter|Counter|Monotonic counter used for measuring rates and frequencies.|\n|ObservableGauge|ObservableGauge|Async gauge that measures arbitrary values over time.|\n|Histogram|Histogram|Used to bucket counters into distributions.|\n\n## Exporting data\n- Using the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) (recommended)\n  - The recommended way is to use the collector to export data. It makes your application back-end agnostic and provides a consistent way to export data for all your applications.\n    ```mermaid\n    flowchart TB\n        classDef appstyle fill:#1995AD,stroke:#fff,stroke-width:1px;\n        classDef opentelstyle fill:#F34A4A,stroke:#fff,stroke-width:1px;    \n        classDef visstyle fill:#4D648D,stroke:#fff,stroke-width:1px;\n\n        App1(Application #1):::appstyle --Otp--\u003e OTEL(OpenTelemetry)\n        App2(API #2):::appstyle  --Otp--\u003e OTEL(OpenTelemetry)\n        App3(Background Task #3):::appstyle  --Otp--\u003e OTEL(OpenTelemetry)\n        App4(Whatever #4):::appstyle  --Otp--\u003e OTEL(OpenTelemetry)\n    \n        OTEL(OpenTelemetry) --\u003e|Export| Zk(ZipKin):::visstyle\n        OTEL(OpenTelemetry) --\u003e|Export| J(Jaeger):::visstyle\n        OTEL(OpenTelemetry) --\u003e|Export| P(Prometheus):::visstyle\n        OTEL(OpenTelemetry) --\u003e|Export| Am(AzureMonitor):::visstyle\n        OTEL(OpenTelemetry Collector\u003cbr\u003eReceive, Process, Export Data):::opentelstyle --\u003e|Export| EA(ElasticAPM):::visstyle\n    \n    ```\n- Exporting to each back-end directly \n  - If you want to export directly to the backends without using the OpenTelemetry Collector, you can use the [NuGet packages OpenTelemetry.Exporter.*](https://www.nuget.org/packages?q=opentelemetry.exporter)\n  ```mermaid\n    flowchart TB\n        classDef appstyle fill:#1995AD,stroke:#fff,stroke-width:1px;\n        classDef opentelstyle fill:#F34A4A,stroke:#fff,stroke-width:1px;    \n        classDef visstyle fill:#4D648D,stroke:#fff,stroke-width:1px;\n\n        App1(Application #1):::appstyle --\u003e Zk(ZipKin):::visstyle\n        App1(Application #1):::appstyle --\u003e J(Jaeger):::visstyle\n        App1(Application #1):::appstyle --\u003e P(Prometheus):::visstyle\n        App1(Application #1):::appstyle --\u003e EA(ElasticAPM):::visstyle\n\n        App2(Application #2):::appstyle --\u003e Zk(ZipKin):::visstyle\n        App2(Application #2):::appstyle --\u003e J(Jaeger):::visstyle\n        App2(Application #2):::appstyle --\u003e P(Prometheus):::visstyle\n        App2(Application #2):::appstyle --\u003e EA(ElasticAPM):::visstyle\n    \n    ```\nThere are multiple ways to deploy [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/). You can check the documentation for all details. In the following section, we'll use docker-compose to start the server and a few back-ends.\n\n##Starting the collector and back-ends\nThe OpenTelemetry Collector is a generic service. You need to configure it to select how you want to receive, process and export data.\n\n```yaml\notel-collector:\n    image: otel/opentelemetry-collector:latest\n    command: [\"--config=/etc/otel-collector-config.yaml\"]\n    volumes:\n      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml\n      - ./output:/etc/output:rw # Store the logs\n    ports:\n      - \"8888:8888\"   # Prometheus metrics exposed by the collector\n      - \"8889:8889\"   # Prometheus exporter metrics\n      - \"4317:4317\"   # OTLP gRPC receiver\n    depends_on:\n      - zipkin-all-in-one\n```\n---\n\n## What is ZipKin?\nZipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures.\n\n## What is Jaeger?\nJaeger is open source software for tracing transactions between distributed services. It's used for monitoring and troubleshooting complex microservices environments.\n\n---\n## Links:\n- [Monitoring a .NET application using OpenTelemetry](https://www.meziantou.net/monitoring-a-dotnet-application-using-opentelemetry.htm)\n- [OpenTelemetry Implementations - Getting Started](https://opentelemetry.io/docs/instrumentation/net/getting-started/)\n- [Jaeger tracing with OpenTelemetry](https://www.jaegertracing.io/docs/1.21/opentelemetry/)\n- [Jaeger: open source, end-to-end distributed tracing](https://www.jaegertracing.io/)\n- [ZipKin](https://zipkin.io/)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliteobject%2Fdemo.opentelemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliteobject%2Fdemo.opentelemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliteobject%2Fdemo.opentelemetry/lists"}