18th February 2024 at 9:07am
When configured for StatsD, Mastodon sends a massive amount of data to New Relic. This can quickly overwhelm New Relic's 100GB free tier, even for small servers. Server admin can mitigate this using drop data rules.
- Open the NerdGraph API Explorer
- Execute a query to create the appropriate drop rule
Example drop rule
My drop rules discards everything but the Sidekick data.
Note that this will result in dropping data, so run it at your own risk. Your account ID is available in the URL bar.
mutation {
nrqlDropRulesCreate(
accountId: YOUR_ACCOUNT_ID
rules: [
{
action: DROP_DATA
nrql: "SELECT * FROM Metric WHERE metricName LIKE 'Mastodon.production.%' AND metricName NOT LIKE 'Mastodon.production.sidekiq.queues.%'"
description: "Drops most Mastodon stats"
}
]
) {
successes {
id
}
failures {
submitted {
nrql
}
error {
reason
description
}
}
}
}View existing drop rules
Query your existing drop rules using the Query Builder (your account ID is available in the URL bar):
{
actor {
account(id: YOUR_ACCOUNT_ID) {
nrqlDropRules {
list {
rules {
id
nrql
accountId
action
createdBy
createdAt
description
}
error {
reason
description
}
}
}
}
}
}Code change alternative
As an alternative, you can remove specific stat collectors from config/initializers/statsd.rb.