From df9307ff6a82cd117f5c2042266fb089bcb219c0 Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 4 Jun 2025 18:02:13 +0100 Subject: [PATCH 01/12] Enable deterministic builds - Enable deterministic builds for binaries/packages. - Centralise common settings in `Directory.Build.props`. - Refactor some MSBuild conditions to not need changing for .NET 9 and beyond. --- Directory.Build.props | 28 +++++++++++++++++++ .../Grafana.OpenTelemetry.Base.csproj | 28 ++++--------------- .../Grafana.OpenTelemetry.csproj | 28 ++++--------------- .../Grafana.OpenTelemetry.Tests.csproj | 3 -- 4 files changed, 40 insertions(+), 47 deletions(-) create mode 100644 Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..a08160c1 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,28 @@ + + + Grafana Labs + SHA256 + Grafana Labs + true + Copyright (c) Grafana Labs + true + true + false + en-US + disable + Grafana_icon.png + Apache-2.0 + https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ + https://github.com/grafana/grafana-opentelemetry-dotnet/blob/main/CHANGELOG.md + false + OpenTelemetry;Grafana;Metrics;Logs;Traces;Observability;Monitoring + true + git + https://github.com/grafana/grafana-opentelemetry-dotnet + snupkg + true + + + + + diff --git a/src/Grafana.OpenTelemetry.Base/Grafana.OpenTelemetry.Base.csproj b/src/Grafana.OpenTelemetry.Base/Grafana.OpenTelemetry.Base.csproj index 5f2c9708..77d992a5 100644 --- a/src/Grafana.OpenTelemetry.Base/Grafana.OpenTelemetry.Base.csproj +++ b/src/Grafana.OpenTelemetry.Base/Grafana.OpenTelemetry.Base.csproj @@ -1,21 +1,9 @@ - net8.0;netstandard2.0;net462 - disable - true - - Minimal Grafana distribution of OpenTelemetry .NET - Grafana Labs - Copyright (c) Grafana Labs - Apache-2.0 - OpenTelemetry;Grafana;Metrics;Logs;Traces;Observability;Monitoring - Grafana_icon.png - https://github.com/grafana/grafana-opentelemetry-dotnet/blob/main/CHANGELOG.md - https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ - https://github.com/grafana/grafana-opentelemetry-dotnet - git + true + net8.0;netstandard2.0;net462 @@ -52,18 +40,14 @@ + + + + <_Parameter1>Grafana.OpenTelemetry.Tests - - - - - - - - diff --git a/src/Grafana.OpenTelemetry/Grafana.OpenTelemetry.csproj b/src/Grafana.OpenTelemetry/Grafana.OpenTelemetry.csproj index b846e65d..b58adfb7 100644 --- a/src/Grafana.OpenTelemetry/Grafana.OpenTelemetry.csproj +++ b/src/Grafana.OpenTelemetry/Grafana.OpenTelemetry.csproj @@ -1,21 +1,9 @@ - net8.0;netstandard2.0;net462 - disable - true - - Full Grafana distribution of OpenTelemetry .NET - Grafana Labs - Copyright (c) Grafana Labs - Apache-2.0 - OpenTelemetry;Grafana;Metrics;Logs;Traces;Observability;Monitoring - Grafana_icon.png - https://github.com/grafana/grafana-opentelemetry-dotnet/blob/main/CHANGELOG.md - https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ - https://github.com/grafana/grafana-opentelemetry-dotnet - git + true + net8.0;netstandard2.0;net462 + $(NoWarn);NU5104 disable Grafana_icon.png Apache-2.0 From c5a07a5cb560f49cfae19218d1df593cc95e871b Mon Sep 17 00:00:00 2001 From: martincostello Date: Thu, 5 Jun 2025 14:00:08 +0100 Subject: [PATCH 11/12] Add package README Add a NuGet package README. --- Directory.Build.props | 4 ++- package-readme.md | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 package-readme.md diff --git a/Directory.Build.props b/Directory.Build.props index f772b732..cd3b7614 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,6 +16,7 @@ Grafana_icon.png Apache-2.0 https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ + package-readme.md https://github.com/grafana/grafana-opentelemetry-dotnet/blob/main/CHANGELOG.md false OpenTelemetry;Grafana;Metrics;Logs;Traces;Observability;Monitoring @@ -27,6 +28,7 @@ true - + + diff --git a/package-readme.md b/package-readme.md new file mode 100644 index 00000000..83d58645 --- /dev/null +++ b/package-readme.md @@ -0,0 +1,63 @@ +# Grafana OpenTelemetry distribution for .NET + + +[![NuGet][package-badge-version]][package-download] +[![SDK][otel-badge]][otel] +[![Slack][slack-badge]][slack-channel] + + +## About + +This is a pre-configured and pre-packaged bundle of [OpenTelemetry .NET components][otel-contrib], +optimized for [Grafana Cloud Application Observability][app-o11y]. + +It requires only minimal setup and configuration and makes it very easy to emit +OpenTelemetry metrics, logs, and traces from your .NET application. + +## Getting Started + +### Step 1: Install package + +For installing the distribution with the full set of dependencies, add a +reference to the [`Grafana.OpenTelemetry`][package] package to your project. + +```sh +dotnet add package Grafana.OpenTelemetry +``` + +### Step 2: Enable the Grafana distribution at application startup + +The `UseGrafana` extension method on the `TracerProviderBuilder` or the +`MetricProviderBuilder` can be used to set up the Grafana distribution. By +default, telemetry data will be sent to Grafana Alloy or an OpenTelemetry collector +that runs locally and listens to default OTLP ports. + +```csharp +using var tracerProvider = Sdk.CreateTracerProviderBuilder() + .UseGrafana() + .Build(); +``` + +Alternatively, you can send telemetry data directly to Grafana Cloud without +involving an agent or collector. This can be configured via the environment +variables `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_ENDPOINT`, and +`OTEL_EXPORTER_OTLP_HEADERS`. + +For details on how to obtain those values, refer to +[Send data to the Grafana Cloud OTLP endpoint: Quickstart architecture][push-oltp]. + +## Documentation + +For detailed documentation and setup instructions, refer to [our documentation][docs]. + +[app-o11y]: https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ +[docs]: https://github.com/grafana/grafana-opentelemetry-dotnet/tree/main/docs +[otel]: https://github.com/open-telemetry/opentelemetry-dotnet +[otel-badge]: https://img.shields.io/badge/OTel--SDK-1.9.0-blue?style=flat&logo=opentelemetry +[otel-contrib]: http://github.com/open-telemetry/opentelemetry-dotnet-contrib +[package]: https://www.nuget.org/packages/Grafana.OpenTelemetry +[package-badge-version]: https://img.shields.io/nuget/v/Grafana.OpenTelemetry?logo=nuget&label=NuGet&color=blue +[package-download]: https://www.nuget.org/profiles/Grafana +[push-oltp]: https://grafana.com/docs/grafana-cloud/send-data/otlp/send-data-otlp/#quickstart-architecture +[slack-badge]: https://img.shields.io/badge/%20Slack-%23app--o11y-brightgreen.svg?logo=slack +[slack-channel]: https://grafana.slack.com/archives/C05E87XRK3J From 270dccce4cd54f9961af6377064193fcd59e673e Mon Sep 17 00:00:00 2001 From: martincostello Date: Thu, 5 Jun 2025 16:22:13 +0100 Subject: [PATCH 12/12] Update badge URLs Point to `ci` not `unit-tests`. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78a72c56..0f8e4a9e 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ To engage with the Grafana Application Observability community: * [File an issue][issues] for bugs, issues, and feature suggestions. [app-o11y]: https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/ -[ci-badge]: https://github.com/grafana/grafana-opentelemetry-dotnet/actions/workflows/unit-tests.yml/badge.svg?branch=main -[ci-status]: https://github.com/grafana/grafana-opentelemetry-dotnet/actions/workflows/unit-tests.yml +[ci-badge]: https://github.com/grafana/grafana-opentelemetry-dotnet/actions/workflows/ci.yml/badge.svg?branch=main +[ci-status]: https://github.com/grafana/grafana-opentelemetry-dotnet/actions/workflows/ci.yml [discussions]: https://github.com/grafana/grafana-opentelemetry-dotnet/discussions [issues]: https://github.com/grafana/grafana-opentelemetry-dotnet/issues/new [oats-badge]: https://github.com/grafana/grafana-opentelemetry-dotnet/actions/workflows/oats.yml/badge.svg?branch=main