1
0
Fork 0
forked from mirror/grapevine
Commit graph

2620 commits

Author SHA1 Message Date
Matthias Ahouansou
da99b0706e
fix(edus): ensure sender server is the same as the user in the content
Original patch by Matthias. Benjamin modified the logic to include
logging when an event was rejected, for consistency with the existing
check on device key updates.

Co-authored-by: Benjamin Lee <benjamin@computer.surgery>
2024-06-12 10:36:41 -07:00
Benjamin Lee
83cdc9c708
drop redacted events from search results 2024-06-12 10:32:36 -07:00
Matthias Ahouansou
f74043df9a
fix: de-index pdus when redacted 2024-06-12 10:27:39 -07:00
Benjamin Lee
cc5a9d3440
factor search tokenization out into a function
This ensures that the tokenization algorithm will remain in sync between
querying, indexing, and deindexing. The existing code had slightly
different behavior for querying, because it did not discard words with
>50 bytes. This was inconsequential, because >50 byte tokens are never
present in the index.
2024-06-12 10:26:14 -07:00
Charles Hall
0c2094a56f
record FoundIn with metrics instead of traces
This is much more efficient in terms of network use and data storage,
and also easier to visualize.
2024-06-06 20:56:36 -07:00
Charles Hall
9364d44ce2
use strum instead 2024-06-05 17:41:39 -07:00
Charles Hall
792300d220
derive Copy on FoundIn 2024-06-05 17:41:39 -07:00
Charles Hall
784b86a1f6
make stringified names mirror variant names 2024-06-05 17:41:39 -07:00
Charles Hall
38382128ac
rename FoundIn::{value -> as_str} 2024-06-05 17:41:39 -07:00
Charles Hall
22dd7f1a54
move FoundIn to observability.rs 2024-06-05 17:41:36 -07:00
Charles Hall
0bd2c43dab
don't strip binary for dev builds 2024-06-05 16:42:40 -07:00
Charles Hall
972c25beca
remove unnecessary whitespace 2024-06-05 16:42:16 -07:00
Charles Hall
71f3d84115
rename password-related utils functions 2024-06-04 19:35:25 -07:00
Charles Hall
aa4cd8b1e1
switch to RustCrypto's argon2 crate 2024-06-04 19:35:21 -07:00
Lambda
60d32ddf48
Fix tracing in fetch_signing_keys() 2024-06-04 13:32:32 -07:00
Lambda
7dbae9ac2b
Fix tracing in send_request() 2024-06-04 13:32:32 -07:00
Lambda
c6f75a1b93
Add tracing span for Ar::from_request()
The fact that this is called for every request is somewhat obscured, it
should be obvious in tracing at least.
2024-06-04 13:32:32 -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
f7a0e3012b
server_server: log ignored signing key updates 2024-06-04 13:32:32 -07:00
Lambda
88bb2ea600
Remove redundant span attributes
There's no need to record attributes that are already present in all
callers.
2024-06-04 13:32:31 -07:00
Lambda
f35cbfd89e
More tracing spans 2024-06-04 13:32:31 -07:00
Lambda
2e34241465
tracing: add span for globals.watch()
This spawns a ton of futures which are otherwise all flat in the parent.
2024-06-04 13:32:31 -07:00
Lambda
3365608101
tracing: record HTTP request method 2024-06-04 13:32:31 -07:00
Lambda
148df18989
Stop debug-logging every incoming request 2024-06-04 13:32:31 -07:00
Benjamin Lee
3551a6ef7a
fix dropped events in search
The previous code would drop some events entirely if any events between
`skip` and `skip + limit` were not visible to the user. This would cause
the set of events skipped by the `skip(skip)` method to extend past
`skip` in the raw result set, because `skip(skip)` was being called
*after* filtering out invisible events.

This bug will become much more severe with a full filtering
implementation, because it will be more likely for events to be filtered
out. Currently, it is only possible to trigger with rooms that have
history visibility set to "invited" or "joined".
2024-06-04 01:12:53 -07:00
Benjamin Lee
0cdf03288a
fix missing next_batch for search
The previous code would fail to return next_batch if any of the events
in the window were not visible to the user. It would also return an
unnecessary next_batch when no more results are available if the total
number of results is exactly `skip + limit`.

This bug will become much more severe with a full filtering
implementation, because we will be more likely to trigger it by
filtering out events in a search call. Currently, it is only possible to
trigger with rooms that have history visibility set to "invited" or
"joined".
2024-06-04 01:12:53 -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
94fda7c875
improve usage of Resource
* Extract into reusable function (we'll need this later)
* Merge the values we want to override over the defaults, instead of
  dropping the defaults completely
* Don't unnecessarily allocate (the `vec![]` usage is gone)
2024-06-03 18:18:44 -07:00
Benjamin Lee
c64a474954
workaround to fix search in element
We inherited a similar workaround from conduit, but removed it in
71c48f66c4. At the time, it was not clear
that this had broken search.

Fixes: !26
2024-06-03 18:02:41 -07:00
Lambda
5c39c7c5ff Use destination field in X-Matrix Authorization header
Both validating and sending it is a MUST since Matrix v1.3.
2024-06-03 20:50:49 +00:00
Lambda
62dd097f49 Use Ruma XMatrix type instead of rolling our own
Both the hand-rolled parser and serialization were wrong in countless
ways. The current Ruma parser is much better, and the Ruma serialization
will be fixed by https://github.com/ruma/ruma/pull/1830.
2024-06-03 20:50:49 +00:00
Charles Hall
aec314ce85
get tracing-opentelemetry from crates.io
They made a release with the changes we needed; we can stop pulling it
from git now.
2024-06-02 17:27:54 -07:00
Lambda
bf1d54defc axum: factor out non-generic parts of request conversion
This saves ~10% in binary size!
2024-05-31 10:42:47 +00:00
Benjamin Lee
624ff57414
test all-features in CI
This should catch if jemalloc linking is broken, which wouldn't be
caught by the `lints::cargo-clippy/all` task.
2024-05-30 21:19:09 -07:00
Benjamin Lee
3a71b8e5d1
optionally use nom to build devshell dependencies
This is nice when messing around with the nix configuration, since
you'll often end up building rocksdb *many* times.

We shouldn't need to do anything to get the logs in CI because we're
calling `nix-build-and-cache ci` at the beginning
2024-05-30 21:19:09 -07:00
Benjamin Lee
823515b475
load .env file before initializing flake
This allows specifying DIRENV_DEVSHELL in .env
2024-05-30 21:19:09 -07:00
Benjamin Lee
467417c32a
use all-features devshell for clippy/all in CI
Without this, we're building a static rocksdb inside the rust-rocksdb
build script every time. As far as I know this doesn't change clippy's
behavior, but it does take a *long* time.
2024-05-30 21:19:08 -07:00
Benjamin Lee
fa48c48d52
add all-features devshell
Because the nix rocksdb build depends on the jemalloc feature, you need
to use a different devshell when passing --all-features to cargo than
the default.
2024-05-30 21:19:08 -07:00
Benjamin Lee
8f24ac1f27
do default-feature unification in nix
Some of the features affect nix dependencies, so we need to have a
full feature list available when constructing the nix derivation. This
incidentally fixes the bug where we weren't enabling jemalloc on rocksdb
in CI/devshells, because jemalloc is now a default feature. It does not
fix the more general class of that issue, where CI is performing an
`--all-features` build in a nix devshell built for default-features.

I am now passing `--no-default-features` to cargo, and having it use our
unified feature list rather than duplicating the unification inside cargo.
2024-05-30 21:19:08 -07:00
Benjamin Lee
ee43c2ff4c
only link to one jemalloc build
Without setting JEMALLOC_OVERRIDE, we end up linking to two different
jemalloc builds. Once dynamically, as a transitive dependency through
rocksdb, and a second time to the static jemalloc that tikv-jemalloc-sys
builds.

This fixes dynamically-linked jemalloc builds, for the reasons described
in <https://github.com/girlbossceo/conduwuit/pull/400#issue-2316700200>.
2024-05-30 21:19:08 -07:00
Lambda
b6fc9b0feb
service/media: add some tracing 2024-05-30 15:40:28 -07:00
Lambda
0a92c72566
Put thumbnail creation inside spawn_blocking()
This can take milliseconds or even several seconds for huge inputs,
while the rule of thumb is <100us between await points.
2024-05-30 15:40:28 -07:00
Lambda
c973485c73
service/media: refactor to reduce indentation 2024-05-30 15:40:24 -07:00
Benjamin Lee
ec1b086a35
very minor cleanup in the sync endpoint
I meant to do this in 146465693e, but
looks like I forgot.
2024-05-30 10:19:24 -07:00
Benjamin Lee
72962c6402
enable allow_federation config by default
We inherited the disabled-by-default setting from conduit. Conduwuit
change it to enabled-by-default in [1]. This can make things confusing
for users migrating from conduwuit to grapevine, especially since we
currently do not log a warning when federation is disabled.

[1]: 24605e151d
2024-05-30 09:30:13 -07:00
Lambda
12e7f525aa Clean up and deduplicate parse_servercurrentevent() 2024-05-29 20:42:59 +00:00
Lambda
25353da8b8 sending.rs: record handler errors using Display 2024-05-29 20:42:46 +00:00