Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 541e575

Browse files
authored
Merge pull request #2305 from splunk/pwilliams-o11ydocs-6467
Add advanced config options for IIS apps
2 parents aa5f52e + 7ea4f85 commit 541e575

File tree

3 files changed

+68
-9
lines changed

3 files changed

+68
-9
lines changed

gdi/get-data-in/application/otel-dotnet/get-started.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Instrument .NET applications for Splunk Observability Cloud (OpenTelemetry)
1313
Requirements <dotnet-requirements>
1414
Pre-checks <instrumentation/dotnet-pre-checks>
1515
Instrument your .NET application <instrumentation/instrument-dotnet-application>
16+
Advanced configuration for IIS applications <instrumentation/advanced-config-iis-apps>
1617
Instrument Azure Web Apps <instrumentation/azure-webapps>
1718
Instrument Azure Web Jobs <instrumentation/azure-webjobs>
1819
Configure the .NET instrumentation <configuration/advanced-dotnet-configuration>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. _advanced-config-iis-apps:
2+
3+
*******************************************
4+
Advanced configuration for IIS applications
5+
*******************************************
6+
7+
Follow these advanced configuration steps to make changes to specific application pools.
8+
9+
Set environment variables
10+
=========================
11+
12+
You can set environment variables for specific application pools in the ``environmentVariables`` block of the :new-page:`applicationHost.config file <https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/environmentvariables/#configuration-sample>`.
13+
14+
For example:
15+
16+
.. code-block:: xml
17+
18+
<environmentVariables>
19+
<add name="OTEL_RESOURCE_ATTRIBUTES" value="deployment.environment=test,service.version=1.0.0" />
20+
</environmentVariables>
21+
22+
For all IIS applications, consider setting common environment variables for W3SVC and WAS Windows Services. For more information, see :new-page:`Instrument a Windows Service running a .NET application <https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/windows-service-instrumentation.md>` in the OpenTelemetry documentation.
23+
24+
.. note::
25+
26+
If the same environment variables are set in the ``environmentVariable`` block and in the web.config ``appSettings`` block, the value in the ``environmentVariables`` block takes precedence.
27+
28+
Activate or deactivate instrumentation
29+
======================================
30+
31+
For .NET Framework applications, use the PowerShell module to activate or deactivate the instrumentation for specific application pools.
32+
33+
#. Import the PowerShell module:
34+
35+
.. code-block:: powershell
36+
37+
Import-Module "OpenTelemetry.DotNet.Auto.psm1"
38+
39+
.. note::
40+
41+
The application pool name is case sensitive.
42+
43+
#. Activate or deactivate the application pool.
44+
45+
* Activate instrumentation for the application pool:
46+
47+
.. code-block:: powershell
48+
49+
Enable-OpenTelemetryForIISAppPool -AppPoolName <app-pool>
50+
51+
* Deactivate instrumentation for the application pool:
52+
53+
.. code-block:: powershell
54+
55+
Disable-OpenTelemetryForIISAppPool -AppPoolName <app-pool>
56+
57+
#. Restart the application pool:
58+
59+
.. code-block:: powershell
60+
61+
Restart-WebAppPool -Name <app-pool>

gdi/get-data-in/application/otel-dotnet/instrumentation/instrument-dotnet-application.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,9 @@ Windows
238238
239239
Start-Process "iisreset.exe" -NoNewWindow -Wait
240240
241-
You can also set the resource attributes for specific application pools in the ``environmentVariables`` block of the :new-page:`applicationHost.config file <https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/environmentvariables/#configuration-sample>`. For example:
242-
243-
.. code-block:: xml
244-
245-
<environmentVariables>
246-
<add name="OTEL_RESOURCE_ATTRIBUTES" value="deployment.environment=test,service.version=1.0.0" />
247-
</environmentVariables>
248-
249241
.. note::
250-
If the ``OTEL_SERVICE_NAME`` or ``OTEL_RESOURCE_ATTRIBUTES`` environment variables are set for a process, settings with the same names from ``appSettings`` block of web.config are ignored.
242+
243+
For advanced IIS application configuration options, see :ref:`advanced-config-iis-apps`.
251244

252245
.. tab:: IIS (ASP.NET Core)
253246

@@ -266,6 +259,10 @@ Windows
266259
267260
Start-Process "iisreset.exe" -NoNewWindow -Wait
268261
262+
.. note::
263+
264+
For advanced IIS application configuration options, see :ref:`advanced-config-iis-apps`.
265+
269266
.. tab:: Windows service
270267

271268
For .NET Framework applications, you can configure resource attributes in the ``appSettings`` block of the app.config file.

0 commit comments

Comments
 (0)