syncromatics / Akka.Logger.NewRelic

Logger implementation in New Relic for Akka.NET actor systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Akka.Logger.NewRelic

Logger implementation in New Relic for Akka.NET actor systems.

Quickstart

Add the Akka.Logger.NewRelic package to your project:

dotnet add package Akka.Logger.NewRelic

Ensure the New Relic agent is installed.

Also make sure the agent is running in order to collect and report transactions from your program.

Enable the program to be monitored by the New Relic agent and name the app

From app.config:

<appSettings>
    <add key="NewRelic.AgentEnabled" value="true" />
    <add key="NewRelic.AppName" value="Akka.Logger.NewRelic.Demo" />
</appSettings>

Reference the New Relic logger in the Akka configuration

Example New Relic logger configuration inside your app.config or web.config:

akka {
    loggers = ["Akka.Logger.NewRelic.NewRelicLogger, Akka.Logger.NewRelic"]
}

(See Program.cs for an example of logger configuration directly in code.)

Build an IoC container with proxied actors

Using Autofac, from Program.cs:

// Build an Autofac container with the AroundReceiveInterceptor registered for all actors to be instrumented
var builder = new ContainerBuilder();
builder.RegisterType<AroundReceiveInterceptor>();
builder.RegisterAssemblyTypes(typeof(QuickResponder).Assembly)
    .Where(t => t.IsSubclassOf(typeof(ActorBase)))
    .EnableClassInterceptors()
    .InterceptedBy(typeof(AroundReceiveInterceptor));

// Register the TransactionWrapper to enable the New Relic agent to instrument the intercepted actors
builder.RegisterInstance<TransactionWrapper>(TransactionWrapper);

// Register the Autofac DI resolver
var container = builder.Build();
new Akka.DI.AutoFac.AutoFacDependencyResolver(container, system);

Building

Travis NuGet NuGet Pre Release

The package targets .NET Standard 2.0 and can be built via .NET Core:

dotnet build

Because the standard New Relic agent (as of verion 6.18.139.0) does not (yet) support instrumenting .NET Core apps, the demo program targets .NET Framework 4.6.2.

Code of Conduct

We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.

Contributing

We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.

License and Authors

GMV Syncromatics Engineering logo GMV Syncromatics Engineering

license GitHub contributors

This software is made available by GMV Syncromatics Engineering under the MIT license.

About

Logger implementation in New Relic for Akka.NET actor systems.

License:MIT License


Languages

Language:C# 100.0%