I am trying to integrate New Relic APM with an Azure Function (in-process model), but I am not seeing any telemetry data in the New Relic APM. I am using serilog to inject logs into the new relic, I am getting all the logs data successfully, but APM service is not working and not getting created.
Environment:
Azure Function Runtime: In-Process
Function App Runtime Version: .NET Core 8, v4
Packages installed
<PackageReference Include="NewRelic Agent" Version="10.33.1" />
<PackageReference Include="NewRelic LogEnrichers Serilog" Version="1.2.0" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog Extensions Logging" Version="8.0.0" />
<PackageReference Include="Serilog Formatting Compact" Version="3.0.0" />
<PackageReference Include="Serilog Settings Configuration" Version="8.0.4" />
<PackageReference Include="Serilog Sinks NewRelic Logs" Version="1.3.0" />
Startup file
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
FunctionsHostBuilderContext context = builder.GetContext();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Is(Enum.Parse<LogEventLevel>("Information", true))
.Enrich.FromLogContext()
.Enrich.WithNewRelicLogsInContext()
.WriteTo.NewRelicLogs(
endpointUrl: "",
applicationName: "Events.Function(DevOne)",
licenseKey: "xxxxxxxxxxxxxxxxxx")
.CreateLogger();
builder.Services.AddLogging(lb =>
{
lb.AddSerilog(Log.Logger, true);
});
builder.Services.RegisterApplicationServices(context.ApplicationRootPath);
}
}
Settings inserted into the environment variable
"CORECLR_ENABLE_PROFILING": 1,
"CORECLR_PROFILER": "{36032161-FFC0-4B61-B559-F6C5D41BAE5A}",
"CORECLR_PROFILER_PATH": "",
"CORECLR_NEWRELIC_HOME": "",
"NEW_RELIC_LICENSE_KEY": "",
"NEW_RELIC_APP_NAME": "Events.Function(DevOne)",
"NEW_RELIC_APPLICATION_LOGGING_ENABLED": "false",
I have tried multiple solutions but every time I got only logs but not the application traces in APM service. Any help will be appreciated. Thanks