Saturn.OpenTelemetry 0.6.0-alpha

This is a prerelease version of Saturn.OpenTelemetry.
dotnet add package Saturn.OpenTelemetry --version 0.6.0-alpha
                    
NuGet\Install-Package Saturn.OpenTelemetry -Version 0.6.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Saturn.OpenTelemetry" Version="0.6.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Saturn.OpenTelemetry" Version="0.6.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Saturn.OpenTelemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Saturn.OpenTelemetry --version 0.6.0-alpha
                    
#r "nuget: Saturn.OpenTelemetry, 0.6.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Saturn.OpenTelemetry@0.6.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Saturn.OpenTelemetry&version=0.6.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Saturn.OpenTelemetry&version=0.6.0-alpha&prerelease
                    
Install as a Cake Tool

Saturn.OpenTelemetry

Includes a small Telemetry wrapper for the dotnet ActivitySource, to make it more compatible with other OpenTelemetry applications in other languages.

Table of Contents

About

Saturn.OpenTelemetry is a library that extends the Saturn Web Application framework with functionality to integrate OpenTelemetry for distributed tracing and metrics. This means that you can easily add observability to your Saturn applications, allowing you to monitor and analyze the performance and behavior of your services.

Inspired by the OpenTelemetry .NET SDK, but adapted to work seamlessly with Saturn's functional programming model and F# syntax.

Getting Started

Add the Saturn.OpenTelemetry NuGet package to your project:

dotnet add package Saturn.OpenTelemetry

Basic use case:

open Saturn
open Saturn.OpenTelemetry

// General OpenTelemetry Configuration
let otelConfig: OtelConfig = {
    Endpoint = "http://localhost:4317"
    AppId = "Example"
    Namespace = "Saturn"
    Version = "1.0.0"
}

// Add OpenTelemetry to the Saturn pipeline
let app = application {
    use_router webAppRouter
    url "http://0.0.0.0:8085/"
    use_otel (
        configure_otel {
            // These are required
            settings otelConfig
            // These are optional and can be used to enable specific features
            // use_efcore
            // use_redis
            // use_openfga
        }
    )
    use_static "static"
    memory_cache
    use_gzip
}

// Start the application and Initialize OpenTelemetry
[<EntryPoint>]
let main _ =
    Telemetry.init otelConfig.AppId
    run app
    0

LGTM stack locally

You can deploy the LGTM (Loki, Grafana, Tempo and Mirmir) stack locally for development purposes.

docker run -p 3002:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtm

This will spin up a container listening for OTEL traces on port 4317 and 4318 and can be accessed on port 3002.

A slightly pimped version of the classic otel-lgtm container preconfigured with DotNet and Dapr dashboards, is available here.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0-alpha 269 12/26/2024
0.5.1-alpha 157 10/19/2024
0.5.0-alpha 82 10/7/2024
0.4.0-alpha 75 9/29/2024
0.3.0-alpha 73 9/25/2024
0.2.0-alpha 63 9/25/2024