turbot/mastodon
steampipe plugin install mastodon

Table: mastodon_rate - Query Mastodon Rate Limits using SQL

Mastodon is a decentralized social network that allows users to maintain full control over their online presence and data. The Mastodon API is a way for developers to interact with Mastodon instances and retrieve information such as user data, statuses, and more. Rate limits in Mastodon determine the number of requests that can be made to the Mastodon API within a certain time period to prevent abuse and ensure fair usage.

Table Usage Guide

The mastodon_rate table provides insights into the rate limits set for the Mastodon API. As a developer or system administrator, you can use this table to monitor the number of API requests made and ensure they are within the set limits. This table is useful for managing API usage, preventing potential abuse, and maintaining the performance and integrity of your Mastodon instance.

Examples

Query current calls remaining and next reset time for the default connection

This query allows you to monitor your usage of the default Mastodon connection. It provides insights into the remaining calls available and the time for the next reset, helping to manage resource allocation effectively.

select
max_limit,
remaining,
reset
from
mastodon_rate;
select
max_limit,
remaining,
reset
from
mastodon_rate;

Query current calls remaining for a specified connection

Explore the remaining calls for a specific connection, helping to manage and monitor usage limits and reset times to prevent unexpected disruptions. This is particularly useful in ensuring efficient resource allocation and avoiding overuse penalties.

select
max_limit,
remaining,
reset
from
mastodon_rate
where
_ctx ->> 'connection_name' = 'fosstodon';
select
max_limit,
remaining,
reset
from
mastodon_rate
where
json_extract(_ctx, '$.connection_name') = 'fosstodon';

Schema for mastodon_rate

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
max_limitbigintLimit of API calls per 5-minute interval.
remainingbigintNumber of API calls remaining until next reset.
resettimestamp with time zoneWhen the next rate limit reset will occur.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- mastodon

You can pass the configuration to the command with the --config argument:

steampipe_export_mastodon --config '<your_config>' mastodon_rate