Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
c914a4fd
Commit
c914a4fd
authored
10 months ago
by
Jason Volk
Browse files
Options
Downloads
Patches
Plain Diff
capture logs for resolve-true-destination admin cmd
Signed-off-by:
Jason Volk
<
jason@zemos.net
>
parent
aa34021b
No related branches found
No related tags found
1 merge request
!439
Tracing Capture
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/admin/debug/debug_commands.rs
+26
-8
26 additions, 8 deletions
src/admin/debug/debug_commands.rs
src/service/sending/resolve.rs
+1
-0
1 addition, 0 deletions
src/service/sending/resolve.rs
with
27 additions
and
8 deletions
src/admin/debug/debug_commands.rs
+
26
−
8
View file @
c914a4fd
use
std
::{
collections
::{
BTreeMap
,
HashMap
},
sync
::
Arc
,
sync
::
{
Arc
,
Mutex
},
time
::
Instant
,
};
use
api
::
client
::
validate_and_add_event_id
;
use
conduit
::{
utils
::
HtmlEscape
,
Error
,
Result
};
use
conduit
::{
debug
,
info
,
log
,
log
::{
capture
,
Capture
},
utils
::
HtmlEscape
,
warn
,
Error
,
Result
,
};
use
ruma
::{
api
::{
client
::
error
::
ErrorKind
,
federation
::
event
::
get_room_state
},
events
::
room
::
message
::
RoomMessageEventContent
,
...
...
@@ -13,9 +17,10 @@
};
use
service
::{
rooms
::
event_handler
::
parse_incoming_pdu
,
sending
::
resolve
::
resolve_actual_dest
,
services
,
PduEvent
};
use
tokio
::
sync
::
RwLock
;
use
tracing
::{
debug
,
info
,
warn
};
use
tracing_subscriber
::
EnvFilter
;
use
crate
::
api
::
client
::
validate_and_add_event_id
;
pub
(
crate
)
async
fn
get_auth_chain
(
_body
:
Vec
<&
str
>
,
event_id
:
Box
<
EventId
>
)
->
Result
<
RoomMessageEventContent
>
{
let
event_id
=
Arc
::
<
EventId
>
::
from
(
event_id
);
if
let
Some
(
event
)
=
services
()
.rooms.timeline
.get_pdu_json
(
&
event_id
)
?
{
...
...
@@ -635,11 +640,24 @@ pub(crate) async fn resolve_true_destination(
));
}
let
(
actual_dest
,
hostname_uri
)
=
resolve_actual_dest
(
&
server_name
,
!
no_cache
)
.await
?
;
let
filter
:
&
capture
::
Filter
=
&
|
data
|
{
data
.level
()
<=
log
::
Level
::
DEBUG
&&
data
.mod_name
()
.starts_with
(
"conduit"
)
&&
matches!
(
data
.span_name
(),
"actual"
|
"well-known"
|
"srv"
)
};
let
state
=
&
services
()
.server.log.capture
;
let
logs
=
Arc
::
new
(
Mutex
::
new
(
String
::
new
()));
let
capture
=
Capture
::
new
(
state
,
Some
(
filter
),
capture
::
to_html
(
&
logs
));
let
(
actual_dest
,
hostname_uri
);
{
let
_capture_scope
=
capture
.start
();
(
actual_dest
,
hostname_uri
)
=
resolve_actual_dest
(
&
server_name
,
!
no_cache
)
.await
?
;
};
Ok
(
RoomMessageEventContent
::
text_plain
(
format!
(
"Actual destination: {actual_dest} | Hostname URI: {hostname_uri}"
)
))
let
plain
=
format!
(
"Actual destination: {actual_dest} | Hostname URI: {hostname_uri}"
);
let
html
=
format!
(
"{}<br>{plain}"
,
logs
.lock
()
.expect
(
"locked"
));
Ok
(
RoomMessageEventContent
::
text_html
(
plain
,
html
))
}
#[must_use]
...
...
This diff is collapsed.
Click to expand it.
src/service/sending/resolve.rs
+
1
−
0
View file @
c914a4fd
...
...
@@ -75,6 +75,7 @@ pub(crate) async fn get_actual_dest(server_name: &ServerName) -> Result<ActualDe
/// Implemented according to the specification at <https://matrix.org/docs/spec/server_server/r0.1.4#resolving-server-names>
/// Numbers in comments below refer to bullet points in linked section of
/// specification
#[tracing::instrument(skip_all,
name
=
"actual"
)]
pub
async
fn
resolve_actual_dest
(
dest
:
&
ServerName
,
cache
:
bool
)
->
Result
<
(
FedDest
,
String
)
>
{
trace!
(
"Finding actual destination for {dest}"
);
let
mut
host
=
dest
.as_str
()
.to_owned
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment