@@ -206,6 +206,30 @@ fn generate_config() {
206206 test_util:: test_generate_config :: < OpentelemetryConfig > ( ) ;
207207}
208208
209+ #[ test]
210+ fn config_grpc_keepalive ( ) {
211+ let config: OpentelemetryConfig = toml:: from_str (
212+ r#"
213+ [grpc]
214+ address = "0.0.0.0:4317"
215+
216+ [grpc.keepalive]
217+ max_connection_age_secs = 300
218+ max_connection_age_grace_secs = 30
219+
220+ [http]
221+ address = "0.0.0.0:4318"
222+ "# ,
223+ )
224+ . unwrap ( ) ;
225+
226+ assert_eq ! ( config. grpc. keepalive. max_connection_age_secs, Some ( 300 ) ) ;
227+ assert_eq ! (
228+ config. grpc. keepalive. max_connection_age_grace_secs,
229+ Some ( 30 )
230+ ) ;
231+ }
232+
209233#[ tokio:: test]
210234async fn receive_grpc_logs_vector_namespace ( ) {
211235 assert_source_compliance ( & SOURCE_TAGS , async {
@@ -1175,6 +1199,7 @@ fn get_source_config_with_headers(
11751199 grpc : GrpcConfig {
11761200 address : grpc_addr,
11771201 tls : Default :: default ( ) ,
1202+ keepalive : Default :: default ( ) ,
11781203 } ,
11791204 http : HttpConfig {
11801205 address : http_addr,
@@ -1510,6 +1535,7 @@ pub async fn build_otlp_test_env(
15101535 grpc : GrpcConfig {
15111536 address : grpc_addr,
15121537 tls : Default :: default ( ) ,
1538+ keepalive : Default :: default ( ) ,
15131539 } ,
15141540 http : HttpConfig {
15151541 address : http_addr,
@@ -1589,6 +1615,7 @@ async fn http_logs_use_otlp_decoding_emits_metric() {
15891615 grpc : GrpcConfig {
15901616 address : grpc_addr,
15911617 tls : Default :: default ( ) ,
1618+ keepalive : Default :: default ( ) ,
15921619 } ,
15931620 http : HttpConfig {
15941621 address : http_addr,
@@ -1816,6 +1843,7 @@ mod otlp_decoding_config_tests {
18161843 grpc : GrpcConfig {
18171844 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
18181845 tls : None ,
1846+ keepalive : Default :: default ( ) ,
18191847 } ,
18201848 http : HttpConfig {
18211849 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
@@ -1856,6 +1884,7 @@ mod otlp_decoding_config_tests {
18561884 grpc : GrpcConfig {
18571885 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
18581886 tls : None ,
1887+ keepalive : Default :: default ( ) ,
18591888 } ,
18601889 http : HttpConfig {
18611890 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
@@ -1899,6 +1928,7 @@ mod otlp_decoding_config_tests {
18991928 grpc : GrpcConfig {
19001929 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
19011930 tls : None ,
1931+ keepalive : Default :: default ( ) ,
19021932 } ,
19031933 http : HttpConfig {
19041934 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
0 commit comments