Search code examples
c#asp.net-coreelastic-apm

Elastic-APM TransactionIgnoreUrls


To lower the load of the apm logging we would like to exclude our monitoring urls. I've tried to make that happen with TransactionIgnoreUrls in de config but for some reason, I can't get it to work. According to the docs I should provide a list of string. Below is the configuration I used (one of my attempts). What I would like to do is exclude the ping endpoint for starters but eventually end up with all endpoints containing /status/ in the url

"ElasticApm__TransactionSampleRate": "1.0",
"ElasticApm__Enabled": "true",
"ElasticApm__Environment": "Development",
"ElasticApm__SecretToken": "some token",
"ElasticApm__ServerUrls": "serverurl",
"ElasticApm__VerifyServerCert": "FALSE",
"ElasticApm__ServiceName": "MyApi"
"ElasticApm__TransactionIgnoreUrls": [
  "*pin*"
],

Startup.cs

app.UseAllElasticApm(Configuration);

The above does not filter out our endpoint (also tried with "ping", "/ping", "status", "/status" and lots of other possibilities) as it is still visible in the apm dashboard.

enter image description here

I'm probably doing something wrong, but I have no idea what it could be.


Solution

    1. The configs should be a comma separated string. I just looked at the docs and indeed it's a bit confusing. So it must be "UrlToIgnore1, UrlToIgnore2" (the agent will parse this internally) and not an array like ["UrlToIgnore1", "UrlToIgnore2"]. So in your case it should be just "*pin*" and if you want to attach another value to ignore, just add it to the string after a comma (,).
    2. Where do you put the configs you pasted here? This double underscore format is an environment variable which you set, right? If so, just put "*pin*" to ElasticApm__TransactionIgnoreUrls, In case you use appsettings.json here is how it should look:
    "ElasticApm": {
      "TransactionIgnoreUrls": "*pin*"
    }