[.Net] agent transaction not reporting sometime

I have a .net core app being monitored by new relic.

There are multiple Transactions in this app. The Transactions are not reporting to new relic consistently. Below is the code. I can see the logs in my app’s log file with the correct values, but nothing is reported to new relic sometimes. What could cause this issue?

IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent();
ITransaction transaction = agent.CurrentTransaction;

        transaction.AddCustomAttribute(MonitorAttribute.TenantId, consumerResult?.TenantId);
        transaction.AddCustomAttribute(MonitorAttribute.EventType, consumerResult?.Message?.Header?.EventType);
        transaction.AddCustomAttribute(MonitorAttribute.MessageDirection, MonitorMessageDirection.Subscribe);

        logger.LogInformation($"TenantId: {consumerResult?.TenantId}; " +
            $"EventType: {consumerResult?.Message?.Header?.EventType};" +
            $"MessageDirection: {MonitorMessageDirection.Subscribe} " +
            "should be reported to Monitor");