Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/reference/configuration-for-windows-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ applies_to:
apm_agent_dotnet: ga
---

# Configuration for Windows Services [configuration-for-windows-services]
# Configuration for Windows services [configuration-for-windows-services]

::::{important}
While the APM agent supports transaction auto-creation for web frameworks such as ASP.NET and ASP.NET Core, it
doesn't know where the "unit of work" starts for bespoke services. Therefore, it cannot start a transaction
automatically. As a result, spans, such as those for outbound HTTP requests, are also not captured, as they expect
a running transaction. Therefore, no trace data will be generated or exported out of the box.

You will need to manually instrument the code for the service to manually create a transaction around the appropriate
unit of work for your scenario. A custom transaction can be started via the [Public API](/reference/public-api.md).

Alternatively, consider using the [Elastic Distribution of OpenTelemetry for .NET](https://www.elastic.co/docs/reference/opentelemetry/edot-sdks/dotnet)
where any spans, including those for outbound HTTP requests, are automatically captured. The first span without a
parent will be considered a transaction when ingested into Elastic Observability.
::::

Configuration for Windows services can be provided by setting environment variables for the specific Windows service in the Windows registry. With PowerShell

Expand All @@ -26,10 +40,8 @@ Set-ItemProperty HKLM:SYSTEM\CurrentControlSet\Services\<service-name> -Name Env
1. define the environment variables to use for the Windows service
2. `<service-name>` is the name of the Windows service.


The service must then be restarted for the change to take effect

```powershell
Restart-Service <service-name>
```