Comments (13)
@unflxw thanks for the quick feedback. I will try that out and see if this works, thank you!
from appsignal-elixir.
Perfect! Closing this for now, but feel free to re-open this (or reach out at [email protected]) if this doesn't work for you.
Also, as a public transit and open data aficionado, I am really thankful for the project that you're working on. 🎉
from appsignal-elixir.
My latest integration is a bit better. I must say it was a bit too involved for that type of things. Maybe having a more flexible way to achieve things (maybe a module name & function name in the config) could be nice, although the existing settings help already.
I think I have nailed it so far, thank you for your help.
from appsignal-elixir.
Hi @thbar!
You can denylist specific routes that you're not interesting in monitoring using the ignore_actions
config option. Use the name by which those actions show up in the AppSignal "Performance > Actions" view.
Let us know whether this answers your question!
from appsignal-elixir.
Hi @unflxw!
It will work but only for a limited set of cases, because we have many of them. Is there a way to use regular expressions, or maybe a code block instead of a fixed list?
from appsignal-elixir.
(also, one action name is reported as GET /gbfs/*_
, I am unsure if the filtering will actually work for this or not!)
from appsignal-elixir.
Is there a way to use regular expressions, or maybe a code block instead of a fixed list?
This does not currently exist out of the box, but I'm checking in with my colleagues for alternative solutions.
@thbar
GET /gbfs/*_
That should be fine, but do let us know if it doesn't work!
from appsignal-elixir.
@thbar Here's a suggestion: in the code that handles those endpoints that you wish to ignore, set the root span's namespace to a fixed value (for example, "ignored"
), and then configure the ignore_namespaces
config option to ignore the "ignored"
namespace.
Would that work for your use case?
from appsignal-elixir.
@unflxw I have tried adding a Plug to change the namespace, but the queries still pop up as "web" on the other side. I believe the namespace is probably re-written by the AppSignal integration itself (but I could not dig into that further).
For reference, my plug (which I didn't add to our app for now since it does not work) is:
defmodule TransportWeb.Plugs.AppSignalFilter do
@moduledoc """
An attempt to reduce the volume of events sent to AppSignal in order to keep a lower bill.
This sets the namespace to a well-known "ignore" value, which must be added to the
AppSignal `ignore_namespaces` config value.
See: https://github.com/etalab/transport-site/issues/3274
"""
def init(options), do: options
require Logger
def call(conn, _opts) do
if function_exported?(Appsignal.Tracer, :root_span, 0) do
if must_ignore?(conn) do
Logger.info("Marking as ignore for AppSignal")
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_namespace("ignore")
end
end
conn
end
# this method allows us to filter programmatically as needed
defp must_ignore?(conn) do
conn.host =~ ~r/proxy/i or conn.request_path =~ ~r/\/gbfs/i
end
end
I will try to move it further in the Plug pipeline, but I'm unsure if it will work or not.
from appsignal-elixir.
(I cannot re-open although I would like to!)
from appsignal-elixir.
Hi again @thbar! Sorry to hear that didn't work. As you said, it might be that this is taking place before the integration has created the root span, and it needs to be moved further up the pipeline.
I have consulted with a colleague who might have more information on how to proceed. In the meantime, could you check the value of Appsignal.Tracer.root_span()
at that point in the code? For example:
def call(conn, _opts) do
IO.puts(inspect(Appsignal.Tracer.root_span()))
# ...
If it is nil
, then the root span has not been created yet, and this code will do nothing -- it will need to be moved further up the pipeline, for example, to a Phoenix controller.
from appsignal-elixir.
It is indeed nil
, so this explains that. I will try to move the code further down the line.
from appsignal-elixir.
I'm glad that worked! I agree that it can be a bit too complicated to fine-tune. I will share your feedback with the team.
from appsignal-elixir.
Related Issues (20)
- Custom params and session data is overwritten by Plug integration HOT 3
- Implement a way to set span name and attributes without overriding
- AppSignal doesn't build with the new linker in Xcode 15 HOT 8
- Drop support for unmaintained Elixir/Erlang versions
- Provide logging feature through a logger handler HOT 1
- Collect Ecto stacktraces HOT 9
- Are calls to `add_distribution_value` synchronous or asynchronous? Can they raise errors? HOT 2
- Neon startup causes errors to be sent to AppSignal HOT 2
- (Mox) testing guidelines? HOT 3
- Oban "Insert job" should not be a root span HOT 1
- AppSignal causes Phoenix to seg fault when a request is received on MacOS 13.6 HOT 12
- Expose a way to clone the Tracer stack for a process HOT 2
- Allow for additional context to be added to Tesla calls
- Memory leak when running long, work intensive Oban background job HOT 10
- Jobs cancelled via Oban Web are not properly closed
- `Logger.error` does not log AppSignal Error HOT 2
- Clickable stack traces to directly jump into the source HOT 1
- Allow setting per-process metadata to unhandled exceptions HOT 3
- Consider sharing exception "blame" information to aid debugging HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appsignal-elixir.