<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Andrea Ficarra</title>
    <description>The latest articles on DEV Community by Andrea Ficarra (@adiakys).</description>
    <link>https://dev.to/adiakys</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3948175%2F9d586cf0-acfc-4c05-a54e-12458ab55822.jpeg</url>
      <title>DEV Community: Andrea Ficarra</title>
      <link>https://dev.to/adiakys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adiakys"/>
    <language>en</language>
    <item>
      <title>AnyMediator: the MediatR programming model, with tracing and notification sinks built in</title>
      <dc:creator>Andrea Ficarra</dc:creator>
      <pubDate>Sun, 01 Nov 2026 16:02:46 +0000</pubDate>
      <link>https://dev.to/adiakys/anymediator-the-mediatr-programming-model-with-tracing-and-notification-sinks-built-in-3dn5</link>
      <guid>https://dev.to/adiakys/anymediator-the-mediatr-programming-model-with-tracing-and-notification-sinks-built-in-3dn5</guid>
      <description>&lt;p&gt;Requests, handlers, pipeline behaviors, notifications: the mediator pattern as MediatR popularized it is a comfortable way to structure a .NET application. After using it on several projects, I kept adding the same things around it: tracing, a way to send some notifications to a message broker, a check that no request had two handlers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AnyMediator&lt;/strong&gt; is the result: an in-process mediator with the same type names and configuration API as MediatR, and those things built in. This post shows what it looks like and what it adds.&lt;/p&gt;

&lt;p&gt;Disclosure: I am the author.&lt;/p&gt;

&lt;h2&gt;
  
  
  The basics look familiar
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package AnyMediator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddAnyMediator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegisterServicesFromAssemblyContaining&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Program&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOpenBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ValidationBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;,&amp;gt;));&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;GetUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequest&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;UserDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GetUserHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AppDbContext&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequestHandler&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;GetUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;UserDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;UserDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GetUser&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;cancellationToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Users&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;UserDto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SingleAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cancellationToken&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MapGet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users/{id}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ISender&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;GetUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;IRequest&lt;/code&gt;, &lt;code&gt;IRequestHandler&lt;/code&gt;, &lt;code&gt;INotification&lt;/code&gt;, &lt;code&gt;INotificationHandler&lt;/code&gt;, &lt;code&gt;IPipelineBehavior&lt;/code&gt;, &lt;code&gt;ISender&lt;/code&gt;, &lt;code&gt;IPublisher&lt;/code&gt;, &lt;code&gt;IMediator&lt;/code&gt;, stream requests, pre/post-processors, exception handlers and actions: if you know MediatR, you already know the API. It targets .NET 8 and .NET 10.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tracing without writing a behavior
&lt;/h2&gt;

&lt;p&gt;Every &lt;code&gt;Send&lt;/code&gt;, &lt;code&gt;CreateStream&lt;/code&gt; and &lt;code&gt;Publish&lt;/code&gt; is a span, and every notification handler is a child span, through .NET's own &lt;code&gt;ActivitySource&lt;/code&gt;. Add the source to OpenTelemetry and they appear in your traces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOpenTelemetry&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithTracing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddSource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AnyMediatorDiagnostics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ActivitySourceName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddAspNetCoreInstrumentation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOtlpExporter&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithMetrics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddMeter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AnyMediatorDiagnostics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MeterName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOtlpExporter&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A request to &lt;code&gt;GET /users/42&lt;/code&gt; then shows the ASP.NET Core span, &lt;code&gt;send GetUser&lt;/code&gt; under it, and the database spans under that. A failure sets the span status to &lt;code&gt;Error&lt;/code&gt; with the exception, following the OpenTelemetry conventions. The &lt;code&gt;anymediator.operation.duration&lt;/code&gt; histogram gives the duration, count and failures per message type.&lt;/p&gt;

&lt;p&gt;There is nothing to install and no option to turn on. With nobody listening, the cost is a couple of flag checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notifications that leave the process
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Publish&lt;/code&gt; hands each notification to every registered &lt;code&gt;INotificationSink&lt;/code&gt;. The default sink runs your in-process handlers; add another one and the same &lt;code&gt;Publish&lt;/code&gt; also reaches a message broker, a webhook or an outbox:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ServiceBusSink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ServiceBusSender&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;INotificationSink&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="n"&gt;Dispatch&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;TNotification&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;TNotification&lt;/span&gt; &lt;span class="n"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;cancellationToken&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;TNotification&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;INotification&lt;/span&gt;
        &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SendMessageAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ServiceBusMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BinaryData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromObjectAsJson&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;Subject&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TNotification&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="n"&gt;cancellationToken&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddSingleton&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;INotificationSink&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ServiceBusSink&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Handlers do not know or care where else the notification goes. Every sink runs even if an earlier one fails, and the failures reach the caller afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes caught at startup
&lt;/h2&gt;

&lt;p&gt;If assembly scanning finds two classes handling the same request, &lt;code&gt;AddAnyMediator&lt;/code&gt; throws and names both of them, instead of picking one silently. The usual culprit is a test double left in a scanned assembly, and it is much nicer to find out when the app starts than when a request returns the wrong result.&lt;/p&gt;

&lt;p&gt;When a request has no handler at all, the error message says which interface to implement and which assembly to scan.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fast where it counts
&lt;/h2&gt;

&lt;p&gt;BenchmarkDotNet on .NET 10, one handler, no behaviors, each library with its default registration:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;&lt;code&gt;Send&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;Allocated&lt;/th&gt;
&lt;th&gt;&lt;code&gt;Publish&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;Allocated&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MediatR 12.5.0&lt;/td&gt;
&lt;td&gt;92 ns&lt;/td&gt;
&lt;td&gt;200 B&lt;/td&gt;
&lt;td&gt;145 ns&lt;/td&gt;
&lt;td&gt;288 B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AnyMediator&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;86 ns&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;96 B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;90 ns&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;80 B&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mediator 3.0.2 (source generated)&lt;/td&gt;
&lt;td&gt;11 ns&lt;/td&gt;
&lt;td&gt;0 B&lt;/td&gt;
&lt;td&gt;18 ns&lt;/td&gt;
&lt;td&gt;0 B&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Dispatch goes through small generic wrappers built once per message type, so there is no reflection after the first call. Martin Othamar's &lt;a href="https://github.com/martinothamar/Mediator" rel="noopener noreferrer"&gt;Mediator&lt;/a&gt; is in another class thanks to its source generator; for a request that touches a database or the network, none of these differences is measurable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coming from MediatR
&lt;/h2&gt;

&lt;p&gt;Handlers and behaviors compile unchanged. The migration is the package, the namespaces and the registration call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;- using MediatR;
&lt;/span&gt;&lt;span class="gi"&gt;+ using AnyMediator;
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="gd"&gt;- services.AddMediatR(cfg =&amp;gt;
&lt;/span&gt;&lt;span class="gi"&gt;+ services.AddAnyMediator(cfg =&amp;gt;
&lt;/span&gt;  {
&lt;span class="gd"&gt;-     cfg.LicenseKey = "...";
&lt;/span&gt;      cfg.RegisterServicesFromAssemblyContaining&amp;lt;Program&amp;gt;();
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://adiakys.github.io/AnyMediator/guide/migrating-from-mediatr" rel="noopener noreferrer"&gt;migration guide&lt;/a&gt; lists the few differences, and the &lt;a href="https://adiakys.github.io/AnyMediator/#migrate" rel="noopener noreferrer"&gt;docs home page&lt;/a&gt; has a converter you can paste your &lt;code&gt;Program.cs&lt;/code&gt; into. AnyMediator is Apache-2.0, with no license key.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to pick something else
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Native AOT, or every nanosecond counts:&lt;/strong&gt; &lt;a href="https://github.com/martinothamar/Mediator" rel="noopener noreferrer"&gt;Mediator&lt;/a&gt; and its source generator.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Queues, retries and durable messaging as a framework:&lt;/strong&gt; &lt;a href="https://wolverinefx.net/" rel="noopener noreferrer"&gt;Wolverine&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Happy with MediatR as it is:&lt;/strong&gt; no reason to move.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The docs have a &lt;a href="https://adiakys.github.io/AnyMediator/guide/mediatr-alternatives" rel="noopener noreferrer"&gt;side-by-side comparison&lt;/a&gt; of AnyMediator, FreeMediator, MediatR, Mediator, LiteBus and Wolverine, with sources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Documentation: &lt;a href="https://adiakys.github.io/AnyMediator/" rel="noopener noreferrer"&gt;https://adiakys.github.io/AnyMediator/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NuGet: &lt;a href="https://www.nuget.org/packages/AnyMediator" rel="noopener noreferrer"&gt;https://www.nuget.org/packages/AnyMediator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/Adiakys/AnyMediator" rel="noopener noreferrer"&gt;https://github.com/Adiakys/AnyMediator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feedback, issues and pull requests are welcome, especially from anyone who tries it on a real codebase.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>opensource</category>
      <category>architecture</category>
    </item>
    <item>
      <title>One container to replace Grafana + Loki + Tempo + Prometheus</title>
      <dc:creator>Andrea Ficarra</dc:creator>
      <pubDate>Mon, 25 May 2026 20:25:26 +0000</pubDate>
      <link>https://dev.to/adiakys/one-container-to-replace-grafana-loki-tempo-prometheus-1kki</link>
      <guid>https://dev.to/adiakys/one-container-to-replace-grafana-loki-tempo-prometheus-1kki</guid>
      <description>&lt;p&gt;&lt;strong&gt;The standard observability stack:&lt;/strong&gt;&lt;br&gt;
Grafana + Loki + Tempo + Prometheus. Four services to deploy, four configs to learn, dashboards to set up before you see a single trace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I actually needed:&lt;/strong&gt;&lt;br&gt;
One place to see traces, logs, and metrics from my services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I built:&lt;/strong&gt;&lt;br&gt;
One container. &lt;code&gt;docker compose up&lt;/code&gt;. Done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawtklcqp2tqobs8d4t1w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawtklcqp2tqobs8d4t1w.png" alt="Dasboard Overview" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;I work with .NET microservices and at some point I went through the full Grafana setup. And look, it works fine, it's a solid stack. But for what I needed it was way too much. I spent more time configuring things than actually looking at my data. The .NET Aspire dashboard is on the other end: you get a nice UI, but nothing is persisted. Close the browser and everything's gone. No customization either.&lt;/p&gt;

&lt;p&gt;So I built something in between.&lt;/p&gt;
&lt;h2&gt;
  
  
  What it is
&lt;/h2&gt;

&lt;p&gt;OtlpDashboard is a single container that receives OpenTelemetry data and stores it. It speaks standard OTLP on port 4317 (gRPC) and 4318 (HTTP/Protobuf). If your app already exports telemetry, you just point it here. No collector needed (works behind one too if you already have it).&lt;/p&gt;

&lt;p&gt;Storage is SQLite by default, so zero config, just a file. You can switch to PostgreSQL or SQL Server if you want.&lt;/p&gt;

&lt;p&gt;The frontend is a Vue 3 / Nuxt 4 SPA served on the same port. You get a grid of widgets you can customize: stat cards, line charts, sparklines, gauges, heatmaps, log streams, trace viewers, and a few more. Auth is on by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbohqrnn79xxeh1u52x65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbohqrnn79xxeh1u52x65.png" alt="Trace details" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How AI helped me ship this in under a month
&lt;/h2&gt;

&lt;p&gt;I want to be upfront about this. I used Claude Code a lot, especially for the frontend. I'm a backend dev. I know .NET, EF Core, gRPC. But Vue and Nuxt? Not really my thing. Without Claude Code I would have spent days stuck on CSS and component wiring. Instead I could focus on what I actually care about: the OTLP ingestion, the storage layer, how widgets work.&lt;/p&gt;

&lt;p&gt;All the architecture and decisions are mine. The AI did the typing.&lt;/p&gt;

&lt;p&gt;And honestly, I think that's the best use of these tools right now if you're a solo dev. They don't replace you. They cover the parts where you're slow, so you can ship something that would normally need a small team.&lt;/p&gt;
&lt;h2&gt;
  
  
  Some stuff I like about how it turned out
&lt;/h2&gt;

&lt;p&gt;You can install widget packs from Git repos. There's a &lt;code&gt;pack.json&lt;/code&gt; that bundles widgets and dashboards together, so if you have a team you can share a curated setup.&lt;/p&gt;

&lt;p&gt;There's also a &lt;code&gt;spec&lt;/code&gt; engine for building custom widgets with Mustache templates. It's sandboxed with DOMPurify, no JS eval. I wanted people to be able to build their own cards without opening security holes.&lt;/p&gt;

&lt;p&gt;Retention is configurable per signal. Set 7 days for traces, 30 for metrics, whatever you want. Old data gets cleaned up on its own.&lt;/p&gt;

&lt;p&gt;And there's an MCP server at &lt;code&gt;/mcp&lt;/code&gt; if you use Claude Code or similar tools. You can query your telemetry from the LLM directly. I didn't expect to use this much but it's actually pretty handy when debugging.&lt;/p&gt;
&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Quickest way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This starts everything including a sample workload that generates real data, so you're not staring at an empty dashboard.&lt;/p&gt;

&lt;p&gt;Or just check the live demo. It's a static build with mock data, login accepts any password: &lt;a href="https://adiakys.github.io/OtlpDashboard/" rel="noopener noreferrer"&gt;Live demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repo is here: &lt;a href="https://github.com/Adiakys/OtlpDashboard" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's GPLv3. If you try it out let me know what you think, I'm curious what's missing or broken.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>dotnet</category>
      <category>docker</category>
      <category>monitoring</category>
    </item>
  </channel>
</rss>
