Troubleshooting .NET tracing on z/OS
If tracing is not working as expected, start with general troubleshooting steps before you move to case-specific scenarios.
General troubleshooting
Complete the following steps:
-
Verify prerequisites:
- Check .NET version compatibility: Ensure that your application runs on .NET Core Runtime 5.0 or later.
- Verify that the Instana agent is running on the z/OS system.
- Check agent status in the Instana UI.
-
Verify environment variables: If tracing is not working, check that the environment variables are:
- Set correctly.
- Spelled accurately.
- Set for the z/OS environment.
- Valid, accessible by the process or application, and correct.
-
Verify that the Instana agent endpoint is reachable from the z/OS environment:
- Use
telnet agent_host agent_port(for example,telnet localhost 42699) to test connectivity.
- Use
-
Verify SDK integration:
-
For Instana SDK:
- Make sure the
Instana.Tracing.Core.Sdkpackage is properly installed. - Ensure that custom spans are being created in your code by using
CustomSpan.Create().
- Make sure the
-
For OpenTelemetry SDK:
- Make sure all the required OpenTelemetry packages are installed (
OpenTelemetry.Extensions.Hosting,OpenTelemetry.Exporter.OpenTelemetryProtocol). - Verify that
AddOpenTelemetry()is called in your service configuration. - Ensure that the OTLP exporter is properly configured to point to the Instana agent (default:
http://localhost:4317for gRPC orhttp://localhost:4318for HTTP). - Verify that OpenTelemetry plug-ins are enabled in the agent
configuration.yamlfile. - Ensure that custom spans are being created by using
ActivitySource.
- Make sure all the required OpenTelemetry packages are installed (
Important: Do not use both SDKs simultaneously in the same application as it might lead to duplicate spans, increased overhead, and potential conflicts in trace context propagation. -
Case-specific troubleshooting
If general troubleshooting doesn't resolve your issue, check out the following troubleshooting scenarios:
Scenario 1: Missing traces or spans
Symptom: No traces are being generated, or some services report traces, but others don't.
Troubleshooting steps:
-
Verify that the .NET version of the application is supported:
- .NET Core Runtime 5.0 or later
- Verify that manual instrumentation is properly implemented by using either Instana SDK or OpenTelemetry SDK.
-
Check whether the SDK packages are correctly installed:
- For Instana SDK:
Instana.Tracing.Core.Sdk - For OpenTelemetry SDK:
OpenTelemetry.Extensions.Hosting,OpenTelemetry.Exporter.OpenTelemetryProtocol
- For Instana SDK:
- Verify that custom spans are being created in the application code.
- Check Instana agent logs for any connection issues.
- If you are using OpenTelemetry SDK, verify that the OTLP exporter endpoint is configured correctly (default:
http://localhost:4317for gRPC). - Check whether the Instana agent has OpenTelemetry plug-ins (
com.instana.plugin.opentelemetry) enabled inconfiguration.yaml. - Collect Instana tracing logs.
-
Check Instana tracing logs:
- If logs are empty or no traces are visible in them, spans are not being created properly in the application code.
- If traces are present in the logs and they contain information that was missing in the UI, the problem occurred either in the backend or agent.
Scenario 2: Application fails to start
Symptom: The application fails on startup when Instana SDK or OpenTelemetry SDK is integrated.
Troubleshooting steps:
-
Verify that the .NET version of the application is supported:
- .NET Core Runtime 5.0 or later
- Verify that the SDK packages are compatible with the .NET runtime version.
- Check application logs for any SDK initialization errors.
- Verify that the Instana agent endpoint is accessible from the z/OS environment by using
telnet agent_host agent_port(for example,telnet localhost 42699). - Collect a crash dump for the application in question if available.
Scenario 3: Agent not detecting .NET application
Symptom: The .NET application is not being monitored by the Instana agent and is not present in the UI.
Troubleshooting steps:
- Verify that the Instana agent is running on z/OS.
- Confirm that the Instana agent has permissions to access the application.
-
Ensure that .NET Core tracing is enabled in the agent configuration file (
*instanaAgentDir*/etc/instana/configuration.yaml):com.instana.plugin.netcore: tracing: enabled: trueNote: You must restart the Instana agent after changing the configuration file. -
If you are using OpenTelemetry SDK, verify that OpenTelemetry plug-ins are enabled:
com.instana.plugin.opentelemetry: grpc: enabled: true http: enabled: trueNote: You must restart the Instana agent after changing the configuration file. - Verify that the application is creating spans by using the SDK.
- Check whether the service name is properly configured in the SDK initialization.
Scenario 4: High CPU or memory usage after enabling SDK-based tracing
Symptom: The application shows unusually high CPU or memory usage after SDK-based tracing is enabled.
Troubleshooting steps:
-
Identify the source:
- Determine whether the issue is related to the application by checking z/OS system monitoring tools.
-
If an application memory or CPU spike is present:
- Check application logs for memory-related exceptions or performance issues.
- Verify whether the issue is caused by excessive span creation in the application code.
- Check whether spans are being properly closed or disposed by using
usingstatements or explicit disposal. - Review the frequency and volume of custom spans being created.
- Request application logs and memory dumps for further analysis.
Scenario 5: SDK configuration issues
Symptom: Traces are not appearing in Instana UI despite the SDK being integrated.
Troubleshooting steps:
-
Verify that the SDK is properly initialized in the application startup code.
-
For Instana SDK:
- Verify that spans are created with proper
SpanType(ENTRY,INTERMEDIATE, andEXIT). - Ensure that spans are properly disposed by using
usingstatements.
- Verify that spans are created with proper
-
For OpenTelemetry SDK:
- Verify that
AddOpenTelemetry()is called in the service configuration. - Check whether the OTLP exporter endpoint is correctly configured (default:
http://localhost:4317). - Verify that
ActivitySourceis properly registered and used. - Ensure that the service name is configured in the resource builder.
- Verify that
-
-
Check network connectivity between the application and the Instana agent:
- Test connectivity by using
telnet agent_host agent_port(for example,telnet localhost 42699for Instana SDK ortelnet localhost 4317for OpenTelemetry SDK with gRPC). - Check Instana agent logs for any connection attempts or errors.
- Review z/OS network configuration and security policies.
- Test connectivity by using
-
Verify whether firewall rules allow communication on the required ports:
- 42699: Default Instana agent port (for Instana SDK)
- 4317: gRPC OTLP endpoint (for OpenTelemetry SDK)
- 4318: HTTP OTLP endpoint (for OpenTelemetry SDK, if you are using HTTP instead of gRPC)
Collecting logs
z/OS does not support automatic log collection. Therefore, you must collect logs manually.
To collect logs manually, complete the following steps:
-
Enable debug logs:
Set the following environment variables manually at the system level and ensure that paths are valid, accessible by the process or application, and correct:
INSTANA_NET_LOG_PATH=log_path INSTANA_NET_LOG_LEVEL=DEBUG - Restart the application.
-
To collect Instana agent logs, complete the following steps:
-
Stop the agent:
instana_install_dir/bin/stop.sh -
Remove the logs: Delete all files in the logs directory to start fresh:
rm -rf instana_install_dir/data/logs/* - Set the log level to Debug: Change the log level severity in the configuration file. For more information, see Setting up the agent configuration file.
-
Start the agent:
instana_install_dir/bin/start.sh - Reproduce the issue: Allow the issue to occur and run the agent for approximately 15 minutes.
-
Collect the logs: Compress the logs directory for submission:
cd instana_install_dir/data/logs/ zip -r instana_agent_debug_logs.zip *
-
-
To collect Instana trace logs, complete the following steps:
- Go to
agent_dir/etc/instana/com.instana.agent.main.sender.File.cfg. -
Add the following lines in the file:
prefix=instanaTraces type=tracesThis configuration provides a log file that contains all the traces in
agent_dir/data/logwith the prefix ofinstanaTraces. - Restart the Instana agent.
- Restart the application.
- Allow it to run for approximately 15 minutes.
-
Verify that traces are being captured:
- Check the Instana UI by going to Applications > Services and look for your service name.
- Verify that traces and spans appear with the expected service and endpoint names.
-
Obtain the logs from the following paths:
- Path specified by the variable
INSTANA_NET_LOG_PATH instana-agent-installation-folder/data/log
- Path specified by the variable
- Go to
Opening a support ticket
If the problem persists after you complete these troubleshooting steps, collect MustGather data before you open a support ticket. MustGather data helps IBM Support diagnose your issue more efficiently.
For information, see MustGather: Instana .NET Tracer - z/OS.