Commit graph

2531 commits

Author SHA1 Message Date
Lambda
b05c91b13e
Update changelog for config organization changes
Charles wrote item 12 in the "Added" section.

Co-authored-by: Charles Hall <charles@computer.surgery>
2024-06-27 16:18:21 -07:00
Lambda
f89e1c7dfc
Allow tracing filters to be changed at runtime
ReloadHandle is taken from conduwuit commit
8a5599adf9eafe9111f3d1597f8fb333b8b76849, authored by Benjamin.

Co-authored-by: Benjamin Lee <benjamin@computer.surgery>
2024-06-27 16:04:23 -07:00
Lambda
f576aff7eb
Don't accidentally ignore observability errors 2024-06-27 16:04:23 -07:00
Lambda
5a6e4fac73
Move federation config to separate config section
This renames:

allow_federation -> federation.enable
trusted_servers -> federation.trusted_servers
max_fetch_prev_events -> federation.max_fetch_prev_events
max_concurrent_requests -> federation.max_concurrent_requests
2024-06-27 16:04:23 -07:00
Lambda
e0e7d8fd91
Make observability more configurable
The following are now configurable:

- the OpenTelemetry endpoint,
- the tracing-flame filename, and
- whether the log output should include timestamps (useful to disable if
  it goes straight into journald).
2024-06-27 16:04:23 -07:00
Lambda
df571818f1
Make tracing filters configurable per backend 2024-06-27 16:04:23 -07:00
Lambda
98d49554ce
Move observability config to separate config section
This renames:

allow_prometheus -> observability.metrics.enable
allow_jaeger -> observability.traces.enable
tracing_flame -> observability.flame.enable
log -> observability.logs.filter
log_colors -> observability.logs.colors
log_format -> observability.logs.format

New config values in these sections will follow.
2024-06-27 16:04:23 -07:00
Lambda
8a30817930
config: convert database backend to enum
This reports a nice error when the config is loaded, rather than later
when the database is initialized.
2024-06-27 16:04:23 -07:00
Lambda
d26b87a2f2
Move database config to separate section
This renames:

database_backend -> database.backend
database_path -> database.path
db_cache_capacity_mb -> database.cache_capacity_mb
rocksdb_max_open_files -> database.rocksdb_max_open_files

Charles updated the NixOS module.

Co-authored-by: Charles Hall <charles@computer.surgery>
2024-06-27 16:03:43 -07:00
Lambda
79d5d306cc Move TURN config to separate config section
This renames:

turn_username -> turn.username
turn_password -> turn.password
turn_uris -> turn.uris
turn_secret -> turn.secret
turn_ttl -> turn.ttl
2024-06-27 18:16:37 +00:00
Lambda
e911518aac config: make db_cache_capacity_mb field unconditional
This is also used by sqlite, causing builds with `--no-default-features
--features sqlite` to fail.
2024-06-27 18:16:37 +00:00
Lambda
b171f7c123 config: fix order of items 2024-06-27 18:16:37 +00:00
Benjamin Lee
9c44aa877c
changelog entry for auth chain room id mismatch logging 2024-06-26 09:11:14 -07:00
Benjamin Lee
3ca6d7776b
better log message for auth chain room id mismatch
The previous "Evil event in db" message does not indicate what's going
on, and does not help identify *which* events are causing the problem.
2024-06-26 09:10:58 -07:00
Lambda
b11cbb6991 Instrument rocksdb functions at TRACE level
This allows e.g. aggregate time statistics if you really care about it
by adding grapevine::database::abstraction::rocksdb=trace to the tracing
filter.
2024-06-26 06:11:59 +00:00
Charles Hall
6fb9abed62
update changelog 2024-06-24 12:43:28 -07:00
Charles Hall
027ff907db
fix changelog indentation
Whoops.
2024-06-24 12:43:28 -07:00
Charles Hall
cb036593ea
refactor send_request in api/server_server
Seriously, what is going on with the control flow in this codebase?
2024-06-24 12:43:28 -07:00
Charles Hall
e13db834ed
refactor handle_response in service/sending
Early returns good.
2024-06-24 12:43:28 -07:00
Charles Hall
f2e5b281c9
include method in otel.name for incoming requests
Also change the name of the field from path to endpoint since it's not
the exact request path, and swap the order of method and endpoint.
2024-06-24 12:43:28 -07:00
Charles Hall
1b51e0beec
increase the default log level
The vast majority of spans are at the info level, so increasing the log
level to info will greatly increase the amount of (useful!) inforamtion
included in the logs.

However, `ruma_state_res` generates a substantial amount of logs, so
that one gets to stay fixed at `warn` for now.
2024-06-24 12:43:28 -07:00
Charles Hall
32e6b3b039
don't log twice, make event structured 2024-06-24 12:43:28 -07:00
Charles Hall
e83a30af4b
reduce duplicate events
I hate `log_error`. A better way to do this would be to not reuse the
same error type literally everywhere, so you could distinguish, in
`crate::service::sending::Service::handle_response`, whether to emit an
event based on which function created the error. Fixing that is a lot
more work, though.
2024-06-24 12:40:59 -07:00
Charles Hall
82cc605b5f
reflow macro 2024-06-24 12:40:59 -07:00
Charles Hall
573fac553c
promote request error event from info to warn
And also make it structured.
2024-06-24 12:40:59 -07:00
Charles Hall
230172718f
demote event from info to debug
And also make it structured instead of stringified.
2024-06-24 12:40:59 -07:00
Charles Hall
601c2ed3e5
clean up shutdown events
The shutdown function is called in exactly one place, and that place
has a better log message, so we'll just delete the extra one.
2024-06-24 12:40:59 -07:00
Charles Hall
12b0fb7f91
don't write KBs of html to the logs
Handing this to tracing as a String makes it automatically escape
newlines and such.
2024-06-24 12:40:57 -07:00
Charles Hall
6aca128547
generalize documentation, make the name shorter
It's more useful than just *debug* logs, but yes, should not be relied
upon for logic reasons.
2024-06-24 12:38:34 -07:00
Charles Hall
08cd8f19e3
add and backfill changelog 2024-06-17 16:39:22 -07:00
Charles Hall
d07394a840
add a page about contributing in general
I think it'd also be good to have a document explaining how to set up
and work with the development environment for contributing code, but I
think that should probably live on a separate, dedicated page.
2024-06-17 16:39:22 -07:00
Charles Hall
9517cdc483
add a code of conduct 2024-06-17 16:39:22 -07:00
Charles Hall
cfd3ca0d33
fill in the introduction section 2024-06-17 16:39:22 -07:00
Charles Hall
9a5e552ca0
set up mdbook
This adds some new tools in CI for lint the book and also sets up
automated deployment to GitLab Pages. Also adds a readme that suggests
reading the book, since that's where all the information will be.
2024-06-16 20:23:18 -07:00
Charles Hall
e318dfcb3d
drop oci image outputs
We don't support this anyway. OCI images will be needed for testing with
Complement, but there are a bunch of other special requirements that has
so these oci image outputs won't be very useful for that anyway.
2024-06-14 14:04:46 -07:00
Benjamin Lee
0b5a07d192
add alternate !admin prefix for admin commands
This is supported on conduwuit, and I liked it because it's faster for
me to type than tab-completing the bot user, and because it makes it a
little easier to copy-paste admin commands.
2024-06-14 11:32:52 -07:00
Benjamin Lee
a909e2079b
config options for log format and color usage
We want to be able to disable colors for complement logs (since they
are likely to be opened in a text editor). There's no pressing need for
alternative log formats, but I'm interested in whether the 'pretty'
format will be easier for debugging.

I chose to add 'log_*' options rather than making a separate 'log'
section for now. There's been some discussion about trying to separate
the tracing/logging stuff into more structured sections, but that can
happen later.
2024-06-13 21:21:14 -07:00
Benjamin Lee
4f041f9153
specify listener in error messages and logs
The "listening for incoming traffic on ..." log line is new, but
something I've wanted even when we only supported one listener.

I considered getting rid of `clippy::too_many_lines` by factoring out
the construction of `app` to a separate function, but found that
specifying it's type (or relevant traits) got quite hairy.
2024-06-13 15:49:21 -07:00
Benjamin Lee
f7d7952f9b
allow listening on multiple ports in config
This is a config compatibility break.

The ability to listen on multiple ports, including both TLS and non-TLS,
is necessary for running complement against grapevine.
2024-06-13 13:33:50 -07:00
Benjamin Lee
b7ad00ef6e
distinct error types for running server
This is in preparation for the config change to allow specifying
multiple listeners, which will add several other possible error
conditions.
2024-06-13 13:30:29 -07:00
Charles Hall
76b060aa84
only process admin commands if bot is in room
This isn't exploitable in any way, it just meant that the bot could
receive and run commands from users who were already in the admin room
despite the bot not being in the room, which also means the bot would be
unable to send response messages.

Now, the bot will simply ignore admin room messages if the bot isn't in
the admin room.
2024-06-12 20:48:06 -07:00
Charles Hall
b0d85bb575
use admin_bot_user_id more
Also change some terminology to be less weird.
2024-06-12 20:42:13 -07:00
Charles Hall
d4b5f62bfe
simplify is_admin 2024-06-12 20:42:13 -07:00
Charles Hall
70fa17dde0
enable clap's wrap_help feature
This makes the output easier to read.
2024-06-12 19:57:00 -07:00
Charles Hall
85e77832e9
follow xdg base dirs spec by default 2024-06-12 19:57:00 -07:00
Charles Hall
c46eaed0e0
parse configured EnvFilter once
This allows the error handling to be done upfront instead of for each
use. In particular, the `toml` error now points to the span of text in
the config file where the misconfigured EnvFilter value is. This is much
better than the previous error that did not indicate what was actually
causing it to happen.
2024-06-12 19:56:59 -07:00
Charles Hall
6b819d6f2d
move config loading to config module
This separates concerns a bit more. We will probably want to extend the
logic for config loading in the future, and that stuff should all live
in the relevant place. This change points us in the right direction.
2024-06-12 19:56:59 -07:00
Charles Hall
2b0bc140cf
drop figment
Just deserialize directly via the `toml` crate.
2024-06-12 19:56:59 -07:00
Charles Hall
003c0a4928
drop nested config
This functionality was never actually used AFAICT, as no way to provide
alternate profiles was ever provided.

This changes the configuration format to remove the `[global]` section,
everything that was previously under that namespace is now at the top
level.
2024-06-12 19:56:59 -07:00
Charles Hall
44088852cf
remove show-config admin room command
Just `cat` the config file. Also this code would be very annoying to
maintain. Getting rid of this also revealed that another config option
is specific to RocksDB, so `cfg`s for that have been added.
2024-06-12 19:56:59 -07:00