1 package dev.sympho.modular_commands.execute;
2
3 import org.checkerframework.dataflow.qual.Pure;
4 import org.checkerframework.dataflow.qual.SideEffectFree;
5
6 import dev.sympho.modular_commands.api.command.context.CommandContext;
7 import reactor.core.publisher.Mono;
8
9
10
11
12
13
14
15
16
17 public interface InstrumentedContext extends CommandContext {
18
19
20
21
22
23
24 @Pure
25 String getCommandId();
26
27
28
29
30
31
32 @Pure
33 Metrics.Tag.Type tagType();
34
35
36
37
38
39
40
41
42 @SideEffectFree
43 default <T> Mono<T> addTags( final Mono<T> mono ) {
44
45 return mono
46 .transform( tagType()::apply )
47 .transform( Metrics.Tag.CommandId.from( getCommandId() )::apply );
48
49 }
50
51 }