Commit graph

266 commits

Author SHA1 Message Date
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
82cc605b5f
reflow macro 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
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
85e77832e9
follow xdg base dirs spec by default 2024-06-12 19:57:00 -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
a6087e97e1
remove config deprecation functionality
This is a hard fork, we don't need to inherit this cruft. Really, I
should've noticed and removed this closer to the beginning of our
history.
2024-06-12 19:56:59 -07:00
Charles Hall
9a92a8047e
drop support for environment variables
The configuration file is now the canonical way to, well, configure.
This change is desirable because it gives us much more flexibility with
how configuration is structured. Environment variables are insufficient
because, for example, they're a flat namespace and have no built-in way
to represent lists.
2024-06-12 19:56:59 -07:00
Charles Hall
9b115b4110
require config path via cli, remove env var 2024-06-12 19:56:59 -07:00
Charles Hall
3650fde0ac
rename src/{clap -> args}.rs 2024-06-12 19:56:59 -07:00
Charles Hall
0643a3f081
remove pointless pub(crate) and use self::
And also fix the ordering of things in state_compressor.
2024-06-12 19:56:56 -07:00
Lambda
dd6cda4519
Useful span names for incoming HTTP requests
Usually it's not possible to make span names dynamic, but the magic
otel.name attribute changes the span name in the OpenTelemetry tracing
backend.
2024-06-04 13:32:32 -07:00
Lambda
0b9e43cbdd
Record authentication info in incoming requests 2024-06-04 13:32:32 -07:00
Lambda
3365608101
tracing: record HTTP request method 2024-06-04 13:32:31 -07:00
Charles Hall
c1ec1111ae
improve route-not-found tracing event 2024-06-03 18:18:44 -07:00
Charles Hall
04ecf4972e
record histogram of http requests 2024-06-03 18:18:44 -07:00
Charles Hall
a0b92c82e8
set up opentelemetry for metrics
Also adds an `allow_prometheus` option (disabled by default) to expose
a `/metrics` endpoint that returns Prometheus data.
2024-06-03 18:18:44 -07:00
Charles Hall
c17ab5328d
factor observability things into its own module
And also create a new error for the observability initialization.
2024-05-27 10:01:00 -07:00
Charles Hall
8f0fdfb2f2
upgrade all cargo dependencies
Unfortunately we need to pull tracing-opentelemetry from git because
there hasn't been a release including the dependency bump on the other
opentelemetry crates.
2024-05-26 19:47:00 -07:00
Charles Hall
793d809ac6
enable unused_qualifications lint 2024-05-26 19:47:00 -07:00
Charles Hall
49660b9e39
return a concrete error type from try_main
Also adds a utility for formatting an error message in addition to all
of its sources, i.e. errors that came before it that led to the current
error.

This helps us to provide better error messages to users by including
more information: both our own error message and all of the underlying
error messages, if any, instead of only one or the other.
2024-05-20 14:51:30 -07:00
Charles Hall
4407e15d78
reword error message about GRAPEVINE_CONFIG
The new message more accurately reflects the purpose and behaviors of
the environment variable.
2024-05-20 14:47:38 -07:00
Charles Hall
23f99015df
return ExitCode instead of using panic or exit
`panic!()` (and things that invoke it, such as `expect` and `unwrap`)
produces terrible looking error messages and `std::process::exit()`
doesn't run destructors. Instead, we'll make a `try_main` that can
return a `Result` with a structured error type, but for now I'm going to
be lazy and just use `Box<dyn Error>`. Then, `main` will call it and
return the appropriate `ExitCode` value based on `try_main`'s `Result`.
This gives us the opportunity to produce good error messages and doesn't
violently terminate the program.
2024-05-20 14:47:34 -07:00
Lambda
5a178ba393 Add comment to task spawner middleware 2024-05-20 16:49:40 +00:00
Charles Hall
f8961d5578
rename Ruma to Ar
This follows the pattern of the previous commit.
2024-05-19 19:04:20 -07:00
Charles Hall
7ea98dac72
rename RumaResponse to Ra
It's very commonly used so having a short name is worthwhile, I think.
2024-05-19 19:03:45 -07:00
Charles Hall
230ebd3884
don't automatically wrap in RumaResponse
This allows us to use the `ruma_route` convenience function even when we
need to add our own hacks into the responses, thus making us less
reliant on Ruma.
2024-05-18 18:31:36 -07:00
Charles Hall
5cb2551422
enable error_on_line_overflow and fix errors
These required some manual intervention.
2024-05-16 19:11:40 -07:00
Charles Hall
0afc1d2f50
change rustfmt configuration
This change is fully automated, except the `rustfmt.toml` changes and
a few clippy directives to allow specific functions with too many lines
because they are longer now.
2024-05-16 19:11:40 -07:00
Charles Hall
dc096d7ad7
abbreviate api categories
This reduces the amount of characters on each line.
2024-05-16 16:55:33 -07:00
Charles Hall
592dee368d
replace comment on services with a doc comment
The previous comment is pretty self-evident and also misunderstands
async closures.
2024-05-16 16:55:06 -07:00
Charles Hall
05be778fbb
stop putting comments in the middle of call chains
`rustfmt` doesn't handle this very well.
2024-05-16 16:17:40 -07:00
Charles Hall
0915aba44c
remove commented-out code 2024-05-16 15:20:56 -07:00
Charles Hall
509b70bd82
use the version function for s2s API too
This way the extra version information can appear there as well. Mainly
useful for showing off :P
2024-05-14 20:21:51 -07:00
Charles Hall
baab928281
enable too_many_lines lint
And just disable it everywhere it fires, I know.
2024-05-14 20:01:24 -07:00
Charles Hall
db4951c5fd
enable semicolon_if_nothing_returned lint 2024-05-14 20:01:24 -07:00
Charles Hall
b0f65913f3
enable ignored_unit_patterns lint 2024-05-14 19:59:43 -07:00
Charles Hall
052f3088e9
enable let_underscore_must_use lint 2024-05-12 18:51:26 -07:00
Charles Hall
d748544f0e
enable unreachable_pub lint
This causes some other lints to start firing too (which is good), but
I'm going to fix them in follow-up commits to keep things organized.
2024-05-12 18:51:26 -07:00
Charles Hall
360e020b64
rename conduit to grapevine 2024-04-30 21:54:56 -07:00
Charles Hall
d41f0fbf72
remove documentation, metadata, etc
This drastically reduces the maintenance burden.

You may notice the `CODE_OF_CONDUCT.md` is deleted here. This is because
I don't feel like updating the relevant parts and I don't think this
will ever actually have a community build around it. If that changes for
some reason, I'm not opposed to adding a code of conduct again.
2024-04-30 21:54:55 -07:00
Charles Hall
c097e79e52
remove src/lib.rs 2024-04-30 21:54:55 -07:00
Charles Hall
f27941d510
remove half-baked presence implementation
But I'm leaving behind the database state for now in case we want it
back later, so we won't need to do a migration or whatever.
2024-04-30 21:54:55 -07:00
Matthias Ahouansou
475a68cbb9
refactor: disable federation at the router level 2024-04-13 10:39:32 +01:00
Charles Hall
ab98b52b21 Merge branch 'remove-log-modification' into 'next'
Remove log config modification

See merge request famedly/conduit!553
2024-03-12 22:06:32 +00:00
Max Cohen
9a81a49c6a
Add argument parser for the conduit executable
Allow fetching the version with `conduit --version`. Fixes #285.
2024-03-11 09:43:02 -07:00