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
@@ -17,18 +18,14 @@ existing one, you can follow https://learn.microsoft.com/en-us/azure/azure-funct
17
18
to create one.
18
19
19
20
You can also take a look at and use this
20
-
https://github.com/elastic/apm-agent-dotnet/tree/main/sample/Elastic.AzureFunctionApp.Isolated[Azure Functions example app with Elastic APM already integrated].
21
+
https://github.com/elastic/apm-agent-dotnet/tree/main/test/azure/applications/Elastic.AzureFunctionApp.Isolated[Azure Functions example app with Elastic APM already integrated].
For the APM agent to trace Azure Functions invocations, the `Elastic.Apm.Azure.Functions.ApmMiddleware`
44
41
must be used in your Azure Functions app.
@@ -49,30 +46,59 @@ using Elastic.Apm.Azure.Functions;
49
46
using Microsoft.Extensions.Hosting;
50
47
51
48
var host = new HostBuilder()
52
-
.ConfigureFunctionsWorkerDefaults(builder =>
53
-
{
54
-
builder.UseMiddleware<ApmMiddleware>();
55
-
})
56
-
.Build();
49
+
.ConfigureFunctionsWebApplication(builder =>
50
+
{
51
+
builder.UseMiddleware<ApmMiddleware>();
52
+
})
53
+
.Build();
57
54
58
55
host.Run();
59
56
----
60
57
61
58
[float]
62
-
==== Step 3: Configure the APM agent
63
-
64
-
The APM agent can be configured with environment variables. Using environment variables
65
-
allows you to use https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings?tabs=portal#settings[application settings in the Azure Portal], enabling you to hide values and update settings
66
-
without needing to re-deploy code.
59
+
===== Step 3: Configure the APM agent
67
60
68
-
Open _Configuration > Application settings_ for your Function App in the Azure Portal
69
-
and set:
61
+
The APM agent can be configured with environment variables.
70
62
71
63
[source,yaml]
72
64
----
73
65
ELASTIC_APM_SERVER_URL: <your APM server URL from the prerequisites step>
74
66
ELASTIC_APM_SECRET_TOKEN: <your APM secret token from the prerequisites step>
67
+
ELASTIC_APM_ENVIRONMENT: "<your environment>"
68
+
ELASTIC_APM_SERVICE_NAME: "<your service name>" (optional)
69
+
----
70
+
71
+
*Local development*
72
+
73
+
While developing your Function locally, you can configure the agent by providing the environment variables
https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings?tabs=portal#settings[application settings in the Azure Portal],
97
+
enabling you to update settings
98
+
without needing to re-deploy code.
99
+
100
+
Open _Settings > Environment variables_ for your Function App in the Azure Portal
101
+
and configure the ELASTIC_APM_* variables as required.
0 commit comments