@@ -9,32 +9,24 @@ tracing-cloudwatch is a custom tracing-subscriber layer that sends your applicat
9
9
feature ` rusoto ` required
10
10
11
11
``` rust
12
- use rusoto_core :: Region ;
13
12
use tracing_subscriber :: {layer :: SubscriberExt , util :: SubscriberInitExt };
14
13
15
14
#[tokio:: main]
16
15
async fn main () {
17
- let cw_client = rusoto_logs :: CloudWatchLogsClient :: new (Region :: ApNortheast1 );
16
+ let cw_client = rusoto_logs :: CloudWatchLogsClient :: new (rusoto_core :: Region :: ApNortheast1 );
18
17
19
18
tracing_subscriber :: registry :: Registry :: default ()
20
19
. with (
21
20
tracing_cloudwatch :: layer (). with_client (
22
21
cw_client ,
23
22
tracing_cloudwatch :: ExportConfig :: default ()
24
- . with_batch_size (1 )
23
+ . with_batch_size (5 )
25
24
. with_interval (Duration :: from_secs (1 ))
26
25
. with_log_group_name (" tracing-cloudwatch" )
27
26
. with_log_stream_name (" stream-1" ),
28
27
),
29
28
)
30
29
. init ();
31
-
32
- start (). await ;
33
- }
34
-
35
- #[tracing:: instrument()]
36
- async fn start () {
37
- tracing :: info! (" Starting..." );
38
30
}
39
31
```
40
32
@@ -43,9 +35,10 @@ async fn start() {
43
35
feature ` awssdk ` required
44
36
45
37
``` rust
38
+ use tracing_subscriber :: {layer :: SubscriberExt , util :: SubscriberInitExt };
39
+
46
40
#[tokio:: main]
47
41
async fn main () {
48
- use tracing_subscriber :: {filter, fmt, layer :: SubscriberExt , util :: SubscriberInitExt };
49
42
let config = aws_config :: load_from_env (). await ;
50
43
let cw_client = aws_sdk_cloudwatchlogs :: Client :: new (& config );
51
44
@@ -54,20 +47,13 @@ async fn main() {
54
47
tracing_cloudwatch :: layer (). with_client (
55
48
cw_client ,
56
49
tracing_cloudwatch :: ExportConfig :: default ()
57
- . with_batch_size (1 )
50
+ . with_batch_size (5 )
58
51
. with_interval (Duration :: from_secs (1 ))
59
52
. with_log_group_name (" tracing-cloudwatch" )
60
53
. with_log_stream_name (" stream-1" ),
61
54
),
62
55
)
63
56
. init ();
64
-
65
- start (). await ;
66
- }
67
-
68
- #[tracing:: instrument()]
69
- async fn start () {
70
- tracing :: info! (" Starting..." );
71
57
}
72
58
```
73
59
0 commit comments