[.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");

Hello @bembree1 !

So if those transactions are reporting but not consistently, that at least tells me that the agent is reporting some data from your app. My next thought is to ask if you’re getting consistent traffic through the app. If there’s no traffic the agent won’t report that to the New Relic UI.

@jchiu Hi Jeff, thanks for you reply. I figured this out. The problem was there is a “while loop” checking hasPublishMessages every second. Once I removed the transaction on the method hasPublishMessages, all the transactions reporting to new relic as expected.

On another problem, I’m trying to view the parameters in the Slow query with setting

<slowSql enabled="true"/>
  <transactionTracer enabled="true" transactionThreshold="apdex_f" 
                     stackTraceThreshold="80" recordSql="raw" explainEnabled="true" 
                     explainThreshold="70" >
    <queryParameters enabled="true" />
    <attributes enabled="true">
      <include>request.parameters.*</include>
    </attributes>
  </transactionTracer>
  <datastoreTracer>
    <instanceReporting enabled="true"  />
    <databaseNameReporting enabled="true" />
    <queryParameters enabled="true" />
  </datastoreTracer>

Any ideas I only get query like
select tenant_agg0_.TenantId as tenantid1_36_, tenant_agg0_.Name as name2_36_, tenant_agg0_.S3FolderName as s3_36_, tenant_agg0_.IsActive as isactive4_36_, tenant_agg0_.TENANT_CODE as tenant5_36_, tenant_agg0_.TenantType as tenanttyp6_36_, tenant_agg0_.IsAdvancedEncryption as isadvance7_36_, tenant_agg0_.kafkauser_username as kafkauser8_36_, tenant_agg0_.Kafkauser_Password as kafkauser9_36_, tenant_agg0_.CreatedByUser as createdb10_36_, tenant_agg0_.CreatedUtcDateTime as createdu11_36_, tenant_agg0_.ModifiedByUser as modified12_36_, tenant_agg0_.ModifiedUtcDateTime as modified13_36_ from receiving.Tenant tenant_agg0_ where tenant_agg0_.TenantId=:p0 limit 1
Or
select id as ConsignmentId, consignmentkey, code, description, isactive, tenantid, createdbyuser, createdutcdatetime, modifiedbyuser, modifiedutcdatetime FROM receiving.consignmentcode where consignmentkey = ANY(@consignmentkeylist) and tenantid = ANY(@tenantidlist)order by id
what am I missing?

Hi there, sorry for the delay! I was wondering if you’re still not seeing query parameters and if so, can you please provide a permalink to an example SQL query in New Relic so we can take a closer look?

Thanks!