mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 13:52:20 +00:00
Add remaining metrics
This commit is contained in:
parent
4e9199bf3e
commit
adb0caf7b2
3 changed files with 82 additions and 16 deletions
28
README.md
28
README.md
|
@ -2,22 +2,36 @@ Create readonly account with access to stats DB
|
|||
|
||||
|
||||
```
|
||||
CREATE ROLE readonly;
|
||||
GRANT USAGE ON SCHEMA public TO readonly;
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly;
|
||||
CREATE USER gomastodonstats WITH PASSWORD 'superrandompassword';
|
||||
GRANT readonly TO gomastodonstats;
|
||||
|
||||
\c pixelfed
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
|
||||
\c mtrx
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
|
||||
\c mastodon_production
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
|
||||
\c peertube_prod
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
|
||||
\c mobilizon_prod
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
|
||||
CREATE DATABASE gomastodonstats WITH OWNER gomastodonstats;
|
||||
|
||||
\c gomastodonstats
|
||||
CREATE TABLE IF NOT EXISTS statsdb (
|
||||
id INT NOT NULL,
|
||||
id SERIAL,
|
||||
service VARCHAR(50) NOT NULL,
|
||||
metric_name VARCHAR(50) NOT NULL,
|
||||
metric_time INT NOT NULL,
|
||||
metric_time TIMESTAMP NOT NULL,
|
||||
metric_value INT NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX service_lookup ON statsdb USING btree (service,metric_name, metric_time);
|
||||
|
||||
GRANT ALL ON ALL TABLES IN SCHEMA public TO gomastodonstats;
|
||||
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO gomastodonstats;
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue