APF.Core.Clean.OpenTelemetry 10.0.0.1

dotnet add package APF.Core.Clean.OpenTelemetry --version 10.0.0.1
                    
NuGet\Install-Package APF.Core.Clean.OpenTelemetry -Version 10.0.0.1
                    
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="APF.Core.Clean.OpenTelemetry" Version="10.0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="APF.Core.Clean.OpenTelemetry" Version="10.0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="APF.Core.Clean.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 APF.Core.Clean.OpenTelemetry --version 10.0.0.1
                    
#r "nuget: APF.Core.Clean.OpenTelemetry, 10.0.0.1"
                    
#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 APF.Core.Clean.OpenTelemetry@10.0.0.1
                    
#: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=APF.Core.Clean.OpenTelemetry&version=10.0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=APF.Core.Clean.OpenTelemetry&version=10.0.0.1
                    
Install as a Cake Tool

Core.Clean.OpenTelemetry

Core.Clean.OpenTelemetry is a cross-cutting, feature-level package that provides standardized OpenTelemetry tracing, logging, and metrics configuration for both ECS-hosted and Lambda-hosted services. It serves as a foundational package that can be used across multiple microservices to standardize observability behavior and Dynatrace integration.

Projects

src/Core.Clean.OpenTelemetry

  • Core.Clean.OpenTelemetry

tests/Core.Clean.OpenTelemetry.Tests

  • Core.Clean.OpenTelemetry.Tests

Purpose

  • Centralizes OpenTelemetry tracing, logging, and export configuration across ECS and Lambda hosting models.
  • Provides a TracerProvider builder pipeline for ECS workloads via AddOpenTelemetryTracingForECS.
  • Provides base classes for tracing Lambda function handlers, with and without Clean Architecture DI wiring.
  • Provides a custom FirehoseLogExporter for shipping logs/traces to Dynatrace via Firehose.
  • Provides processors such as HttpRequestPathEnricherProcessor to enrich spans with request path metadata.
  • Standardizes observability behavior for all microservices while avoiding duplication.

Features

  • ECS Tracing: AddOpenTelemetryTracingForECS(serviceName) extension on TracerProviderBuilder for configuring a TracerProvider in long-lived ECS/Fargate containers.
  • ECS Logging + Tracing Bootstrap: AddLoggingAndTracing(serviceName) extension on WebApplicationBuilder for wiring logging and tracing together during host startup.
  • Lambda Tracing (non-Clean): BaseTracingLambda base class for tracing plain Lambda function handlers.
  • Lambda Tracing (Clean Architecture): BaseTracingCleanLambda base class for tracing Lambda handlers that use Clean Architecture DI (configureServices callback, _serviceProvider, _logger), with ExecuteWithTracingAsync wrapping handler execution in a trace span.
  • Dynatrace Export: FirehoseLogExporter for exporting logs and traces to Dynatrace, supporting the OpenPipeline ingestion model.
  • Span Enrichment: HttpRequestPathEnricherProcessor for enriching spans with HTTP request path data.
  • DI Registration: ServiceCollectionExtensions for registering OpenTelemetry-related services into the DI container.

Getting Started

  1. Clone the repo
  2. Navigate to the root directory
  3. Run:
dotnet build
dotnet test

Usage — ECS project

Configure a static TracerProvider in Program.cs, then wire logging and tracing into the host builder:

using Aurionpro.PaymentFramework.Core.Clean.OpenTelemetry.Extensions;
using Aurionpro.PaymentFramework.Core.Clean.Aws.Extensions;
using OpenTelemetry;
using OpenTelemetry.Trace;
using TracerProvider = OpenTelemetry.Trace.TracerProvider;

namespace DummyPaymentLinkECS.API;

public sealed class Program
{
    private static readonly string EnvironmentName;
    private static readonly string Service;
    private static readonly TracerProvider? TracerProvider;

    static Program()
    {
        EnvironmentName = Environment.GetEnvironmentVariable("CORE_ENVIRONMENT")
            ?? throw new InvalidOperationException("CORE_ENVIRONMENT environment variable is not set.");

        string assemblyName = AppDomain.CurrentDomain.FriendlyName;
        Service = $"{EnvironmentName}-{assemblyName}".ToLowerInvariant();

        TracerProvider = Sdk.CreateTracerProviderBuilder()
            .AddOpenTelemetryTracingForECS(Service)
            .Build();
    }

    public static void Main(string[] args)
    {
        WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

        builder.AddInfrastructure();
        builder.AddLoggingAndTracing(Service);

        var app = builder.Build();

        // Ensure spans are flushed on shutdown
        app.Lifetime.ApplicationStopping.Register(() => TracerProvider?.Dispose());

        app.Run();
    }
}

Service should be a stable, lowercase {environment}-{assembly-name} identifier — it's used as the OpenTelemetry service name and Dynatrace source name.

Usage — Lambda API project (Clean Architecture)

Register OpenTelemetry-aware logging alongside the rest of Clean Architecture DI in Startup.ConfigureServices:

using Aurionpro.PaymentFramework.Core.Clean.OpenTelemetry.Configurations;
using Aurionpro.PaymentFramework.Core.Clean.OpenTelemetry.Extensions;

public class Startup
{
    private const string ExecutingAssemblyName = "CleanArchitecture.Lambda.Web.Api";

    public void ConfigureServices(IServiceCollection services)
    {
        // ... other Core.Clean registrations ...
        AddLogging(services, Configuration);
    }

    private static void AddLogging(IServiceCollection serviceCollection, IConfiguration configuration)
    {
        var sourceName = Environment.GetEnvironmentVariable("CORE_ENVIRONMENT")
            + "-" + ExecutingAssemblyName.ToLower();

        LoggerSettings loggerSettings = serviceCollection.AddLoggerSettings(configuration, sourceName);
        serviceCollection.AddLogger(loggerSettings);
    }
}

Usage — Lambda function handler

Two base classes are available depending on whether the Lambda uses Clean Architecture DI:

  • BaseTracingLambda — for plain Lambda handlers with no Clean Architecture service provider wiring.
  • BaseTracingCleanLambda — for handlers that need a configureServices callback and access to _serviceProvider / _logger, as used across the Lambda functions.
using Amazon.Lambda.Core;
using Amazon.Lambda.SNSEvents;
using Aurionpro.PaymentFramework.Core.Clean.OpenTelemetry.Infrastructure.Clean.Lambda;

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]

namespace SnsHandler;

public class Function : BaseTracingCleanLambda
{
    public Function() : base(
        configureServices: (services) => { services.ConfigureServices(); })
    {
    }

    public async Task FunctionHandler(SNSEvent snsEvent, ILambdaContext context)
    {
        await ExecuteWithTracingAsync(snsEvent, context, async (ev, ctx) =>
        {
            using var scope = _serviceProvider!.CreateScope();
            _logger?.LogInformation("Handler - Start");

            var handler = scope.ServiceProvider.GetRequiredService<IPaymentEventHandler>();
            var result = await handler.HandleEvent(ev, ctx);

            _logger?.LogInformation("Handler - End");
        });
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
10.0.0.1 40 8/14/2026
10.0.0-Beta-05 74 8/13/2026
10.0.0-Beta-04 142 8/6/2026
10.0.0-Beta-03 352 8/5/2026
10.0.0-Beta-02 87 8/5/2026
10.0.0-Beta-01 387 6/22/2026
8.0.0.13-Beta-02 293 7/16/2026
8.0.0.13-Beta-01 92 7/16/2026
8.0.0.12 2,312 5/22/2026
8.0.0.12-Beta-02 300 5/21/2026
8.0.0.12-Beta-01 587 5/19/2026
8.0.0.11 124 5/19/2026
8.0.0.11-Beta-01 698 5/18/2026
8.0.0.10 492 5/13/2026
8.0.0.10-Beta-01 496 5/13/2026
8.0.0.9 190 5/6/2026
8.0.0.9-Beta-03 518 4/17/2026
8.0.0.9-Beta-02 109 4/17/2026
8.0.0.9-Beta-01 146 4/14/2026
8.0.0.8 3,831 4/8/2026
Loading failed

# Changelog

## 2026-08-14 - 10.0.0.1

-  Published the Stable .net 10 compatible version

## 2026-08-13 - 10.0.0.0-Beta-05

- Updated Readme.md file

## 2026-08-05 - 10.0.0.0-Beta-04

- log object fields to lower case