question

Felipe N. avatar image
Felipe N. asked ·

Instrument Redis calls using the OneAgent SDK

Hello,

In our .NET application, we are trying to instrument calls to Redis using the OneAgent SDK. More specifically, we are using the TraceOutgoingRemoteCall method in all our Redis calls.

Even doing this, the service doesn't show up in the Dynatrace portal, so I'm supposing we've missed something. Is there any other necessary step to enable this kind of tracing in Dynatrace? Also, would it be better to use the TraceSQLDatabaseRequest for these Redis calls?

Thanks,

oneagent sdk
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Armin R. avatar image
Armin R. answered ·

Hi Felipe,

your snippet looks good so far. You could also just use "Redis" as databaseVendor - you are not required to use one of the pre-defined constants (those are just well-known vendors for which we would show the respective logo in the UI if available).

If the Redis calls you want to trace are within an execution path which is already traced (e.g., "HandleWebRequest --> GetUsers --> GetUsersCached --> KeyExists" with HandleWebRequest being detected as a web service) you're fine. The calls you instrument using SDK tracers will be added to your existing service.

If Redis is called from an unmonitored method (i.e., no PurePath is active on that thread), however, you'll have to define a custom service either on KeyExists or anywhere up your call tree. This currently only applies to the database tracer as this one is defined not to create a new service itself (i.e., it's not a service entrypoint). The other tracers (incoming/outgoing remote calls, web requests, message sending/processing), however, always declare a new service unless they are called from an existing service in which case they'll be added to the existing PurePath.
Custom services are explained here: https://www.dynatrace.com/support/help/how-to-use-dynatrace/services-and-transactions/configuration/define-custom-services/

Best,
Armin

2 comments Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Hi Armin,

Thank you for all the support. Now we are able to see the redis requests in the database section!

Best regards,

Felipe

0 Likes 0 · ·

Great, glad I could help!

0 Likes 0 · ·
Felipe N. avatar image
Felipe N. answered ·

Hi Armin,

Thank you for your answer. We will change the tracing to TraceSQLDatabaseRequest, execute the SDK-specific troubleshooting steps and check the results.

I didn't understand exactly about the creation of the custom service. Will I need to create this service with same database name to see it traced? Also, do I need to use the traced methods as entry points to this service?

This is an example of one of the traced request implementation.

public bool KeyExists(RedisKey key, CommandFlags flags = CommandFlags.None)
{
	var databaseInfo = _oneAgentSdk.CreateDatabaseInfo(
                Endpoint, DatabaseVendor.CACHE, 
                ChannelType.TCP_IP,
                _config.ChannelEndpoint);
	var tracer = _oneAgentSdk.TraceSQLDatabaseRequest(databaseInfo, nameof(KeyExists))
	return tracer.Trace(() => _database.KeyExists(key, flags));
}
Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Armin R. avatar image
Armin R. answered ·

Hi Felipe!

Unfortunately I cannot access your environment unless you open a ticket with our support team but I'll try my best to assist you.

I assume that general out-of-the-box .NET monitoring is working for the process you're trying to instrument. If so, please make sure to follow the SDK-specific troubleshooting steps described here: https://github.com/Dynatrace/OneAgent-SDK-for-dotnet#troubleshooting.
Please also check that the SDK features are not disabled in Dynatrace (Settings > Server-side service monitoring > Deep monitoring > Troubleshooting > "OneAgent SDK outgoing remote call / .NET" and others).

Apart from that, I would suggest using TraceSQLDatabaseRequest as you can provide metadata regarding your Redis instance and query this way. This will also have your Redis instance show up as database in Dynatrace whereas with TraceOutgoingRemoteCall it would just be a generic "black box" service being called. As your Redis command will not be a valid SQL statement, however, I suppose that you will just see the plain query string you provide showing up in Dynatrace without further processing/analysis.
Please note that database calls do not start PurePaths themselves - they are only traced as part of an active service call so if you call Redis from outside your service methods you will have to define a custom service.

Best,
Armin

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Space Topics

mobile monitoring dotnet synthetic monitoring reports iis chat kubernetes servicenow amazon web services mysql mainframe rest api errors cassandra dashboard oneagent sdk cmc application monitoring openkit smartscape request attributes monitoring developer community user tagging log monitoring services ufo syntheticadvisory activegate ip addresses auto-detection high five award oracle hyperion webserver uem usql iib test automation license web performance monitoring ios news migration management zones index ibm mq web services custom event alerts notifications sso host monitoring knowledge sharing reports browser monitors java hybris sap vmware maintenance window user action naming javascript appmon ai synthetic classic availability tipstricks automation extensions session replay diagnostic tools permissions davis assistant faq documentation problem detection http monitors server easytravel apdex aws-quickstart network docker tags and metadata cloud foundry google cloud platform synthetic monitoring process groups account usability dynatrace saas gui paas openshift key user actions administration user actions postgresql synthetic locations oneagent security Dynatrace Managed user management custom python technologies mongodb openstack user session monitoring continuous delivery citrix configuration alerting NGINX action naming linux nam installation masking error reporting database mission control jmeter recorder apache mobileapp RUM php threshold azure purepath davis scripting agent aix nodejs android