File tree Expand file tree Collapse file tree 8 files changed +365
-91
lines changed
json/command-monitoring/unified Expand file tree Collapse file tree 8 files changed +365
-91
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ use crate::{
31
31
} ;
32
32
33
33
lazy_static ! {
34
- static ref REDACTED_COMMANDS : HashSet <& ' static str > = {
34
+ pub ( crate ) static ref REDACTED_COMMANDS : HashSet <& ' static str > = {
35
35
let mut hash_set = HashSet :: new( ) ;
36
36
hash_set. insert( "authenticate" ) ;
37
37
hash_set. insert( "saslstart" ) ;
@@ -356,12 +356,14 @@ impl Client {
356
356
cmd. set_server_api ( server_api) ;
357
357
}
358
358
359
- self . emit_command_event ( |handler| {
359
+ let should_redact = {
360
360
let name = cmd. name . to_lowercase ( ) ;
361
- let should_redact = REDACTED_COMMANDS . contains ( name. as_str ( ) )
361
+ REDACTED_COMMANDS . contains ( name. as_str ( ) )
362
362
|| HELLO_COMMAND_NAMES . contains ( name. as_str ( ) )
363
- && cmd. body . contains_key ( "speculativeAuthenticate" ) ;
363
+ && cmd. body . contains_key ( "speculativeAuthenticate" )
364
+ } ;
364
365
366
+ self . emit_command_event ( |handler| {
365
367
let command_body = if should_redact {
366
368
Document :: new ( )
367
369
} else {
@@ -471,8 +473,6 @@ impl Client {
471
473
}
472
474
Ok ( response) => {
473
475
self . emit_command_event ( |handler| {
474
- let should_redact =
475
- REDACTED_COMMANDS . contains ( cmd_name. to_lowercase ( ) . as_str ( ) ) ;
476
476
let reply = if should_redact {
477
477
Document :: new ( )
478
478
} else {
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ use bson::Bson;
9
9
use derivative:: Derivative ;
10
10
use std:: time:: Instant ;
11
11
12
+ #[ cfg( test) ]
13
+ pub ( crate ) use self :: executor:: REDACTED_COMMANDS ;
12
14
#[ cfg( test) ]
13
15
use crate :: options:: ServerAddress ;
14
16
use crate :: {
You can’t perform that action at this time.
0 commit comments