You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: gdi/get-data-in/application/otel-dotnet/instrumentation/instrument-dotnet-application.rst
+89-65Lines changed: 89 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,92 @@ Instrument your .NET application for Splunk Observability Cloud (OpenTelemetry)
9
9
10
10
The Splunk Distribution of OpenTelemetry .NET automatically instruments .NET applications, Windows services running .NET applications, and ASP.NET applications deployed on IIS.
11
11
12
-
To get started, use the guided setup, follow the instructions manually, or automatically instrument your application. See :ref:`discovery_mode` for more information.
12
+
You can install the .NET instrumentation using the NuGet packages, a guided setup, or manual instructions. The NuGet packages are the best method for avoiding dependency version conflicts, but are not well-suited for instrumenting multiple applications running on the same machine. Review the various installation methods on this page to identify the best method for your application environment.
13
+
14
+
To learn about automatic discovery, see :ref:`discovery_mode`.
15
+
16
+
.. _otel-dotnet-nuget-pkg:
17
+
18
+
Install the OpenTelemetry .NET instrumentation using the NuGet packages
You can deploy the Splunk Distribution of OpenTelemetry .NET instrumentation automatically through the official NuGet packages. Your instrumented application project must support NuGet packages.
22
+
23
+
The following scenarios are ideal for using the NuGet packages:
24
+
25
+
* You control the application build but not the machine or container where the application is running.
26
+
* You're instrumenting a self-contained application. See :new-page:`Publish self-contained <https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained>` in the .NET documentation.
27
+
* You want to facilitate developer experimentation with automatic instrumentation through NuGet packages.
28
+
* You need to solve version conflicts between the dependencies used by the application and the automatic instrumentation.
29
+
30
+
However, you shouldn't use the NuGet packages if any of the following apply to your scenario:
31
+
32
+
* You're unable to add the NuGet packages to the application project. This can be the case when instrumenting a third-party application.
33
+
* You can't accommodate the increased disk use required by installing the NuGet packages separately for each instrumented application running on the same machine.
34
+
* You need to instrument a legacy application that can't be migrated to the SDK-style project. To verify whether your project is SDK style, see `Identify the project format <https://learn.microsoft.com/en-us/nuget/resources/check-project-format>`__ in the NuGet documentation.
35
+
36
+
.. note::
37
+
38
+
For advanced configuration of the .NET automatic instrumentation, such as changing trace propagation formats or changing the endpoint URLs, see :ref:`advanced-dotnet-otel-configuration`.
39
+
40
+
Instrument your application using the NuGet packages
If the build fails and prompts you to add missing instrumentation packages, add the instrumentation package or skip the instrumentation of the listed package by adding it to the ``SkippedInstrumentation`` property. For example:
To distribute the appropriate native runtime components with your .NET application, specify a Runtime Identifier (RID) to build the application using ``dotnet build`` or ``dotnet publish``.
68
+
69
+
Both self-contained and framework-dependent applications are compatible with automatic instrumentation. See :new-page:`.NET application publishing overview <https://learn.microsoft.com/en-us/dotnet/core/deploying/>` in the .NET documentation for more information.
70
+
71
+
Run the instrumented application
72
+
--------------------------------
73
+
74
+
The instrumentation procedure in the previous section produces launch scripts in the output folder of the build. The Windows script is ``splunk-launch.cmd`` and the Linux script is ``splunk-launch.sh``. The script passes all the command-line parameters that you provide to the application. Use the following steps to run your instrumented application:
75
+
76
+
#. Identify the launch script in your build output.
77
+
78
+
#. Optional. If you want to verify that the instrumentation is working by viewing the telemetry data output in your console, set the following environment variables to ``true``:
To generate all the basic installation commands for your environment and application, use the .NET OpenTelemetry guided setup. To access the .NET OpenTelemetry guided setup, follow these steps:
18
100
@@ -26,7 +108,7 @@ To generate all the basic installation commands for your environment and applica
26
108
#. Select the :guilabel:`.NET (OpenTelemetry)` tile to open the .NET OpenTelemetry guided setup.
27
109
28
110
Install the Splunk Distribution of OpenTelemetry .NET manually
If you don't use the guided setup, follow these instructions to manually install the Splunk Distribution of OpenTelemetry .NET:
32
114
@@ -38,7 +120,7 @@ To install the distribution using the official NuGet packages, see :ref:`otel-do
38
120
.. _install-dotnet-otel-instrumentation:
39
121
40
122
Instrument your .NET application
41
-
---------------------------------------------
123
+
--------------------------------
42
124
43
125
Use the following steps to automatically instrument your application.
44
126
@@ -52,7 +134,7 @@ Use the following steps to automatically instrument your application.
52
134
* ``DOTNET_EnableDiagnostics_Debugger=0``
53
135
54
136
Windows
55
-
^^^^^^^^^^^^
137
+
^^^^^^^
56
138
57
139
#. Check that you meet the requirements. See :ref:`dotnet-otel-requirements`.
58
140
@@ -180,7 +262,7 @@ If no data appears in APM, see :ref:`common-dotnet-otel-troubleshooting`.
180
262
.. note:: If you need to add custom attributes to spans or want to manually generate spans and metrics, instrument your .NET application or service manually. See :ref:`dotnet-otel-manual-instrumentation`.
181
263
182
264
Linux
183
-
^^^^^^^^^^^^^^^^^
265
+
^^^^^
184
266
185
267
#. Check that you meet the requirements. See :ref:`dotnet-otel-requirements`.
186
268
@@ -216,7 +298,7 @@ If no data appears in APM, see :ref:`common-dotnet-otel-troubleshooting`.
216
298
.. _activate-profiling-dotnet-otel:
217
299
218
300
Activate AlwaysOn Profiling
219
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
301
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
220
302
221
303
To activate AlwaysOn Profiling, set the ``SPLUNK_PROFILER_ENABLED`` environment variable to ``true``.
222
304
@@ -238,64 +320,6 @@ Starting from version 1.4.0, the .NET OTel instrumentation collects database que
238
320
239
321
SQL statements might contain sensitive information. To configure this behavior, see ``OTEL_DOTNET_AUTO_SQLCLIENT_SET_DBSTATEMENT_FOR_TEXT`` and ``OTEL_DOTNET_AUTO_ENTITYFRAMEWORKCORE_SET_DBSTATEMENT_FOR_TEXT`` in :ref:`dotnet-otel-instrumentation-settings`.
240
322
241
-
242
-
.. _otel-dotnet-nuget-pkg:
243
-
244
-
Install the OpenTelemetry .NET instrumentation using the NuGet packages
You can deploy the Splunk Distribution of OpenTelemetry .NET instrumentation automatically through the official NuGet packages. The project of your instrumented application must support NuGet packages.
248
-
249
-
Use the NuGet package in the following scenarios:
250
-
251
-
1. You control the application build but not the machine or container where the application is running.
252
-
2. You're instrumenting a self-contained application. See :new-page:`Publish self-contained <https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained>` in the .NET documentation.
253
-
3. You want to facilitate developer experimentation with automatic instrumentation through NuGet packages.
254
-
4. You need to solve version conflicts between the dependencies used by the application and the automatic instrumentation.
255
-
256
-
Instrument your application using the NuGet packages
To automatically instrument your application using the NuGet packages, add the ``Splunk.OpenTelemetry.AutoInstrumentation`` package to your project. For example:
If the build fails and prompts you to add missing instrumentation packages, add the instrumentation package or skip the instrumentation of the listed package by adding it to the ``SkippedInstrumentation`` property. For example:
To distribute the appropriate native runtime components with your .NET application, specify a Runtime Identifier (RID) to build the application using ``dotnet build`` or ``dotnet publish``.
280
-
281
-
Both self-contained and framework-dependent applications are compatible with automatic instrumentation. See :new-page:`.NET application publishing overview <https://learn.microsoft.com/en-us/dotnet/core/deploying/>` in the .NET documentation for more information.
0 commit comments