@@ -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,
@@ -1823,6 +1850,7 @@ mod otlp_decoding_config_tests {
18231850 grpc : GrpcConfig {
18241851 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
18251852 tls : None ,
1853+ keepalive : Default :: default ( ) ,
18261854 } ,
18271855 http : HttpConfig {
18281856 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
@@ -1863,6 +1891,7 @@ mod otlp_decoding_config_tests {
18631891 grpc : GrpcConfig {
18641892 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
18651893 tls : None ,
1894+ keepalive : Default :: default ( ) ,
18661895 } ,
18671896 http : HttpConfig {
18681897 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
@@ -1906,6 +1935,7 @@ mod otlp_decoding_config_tests {
19061935 grpc : GrpcConfig {
19071936 address : "0.0.0.0:4317" . parse ( ) . unwrap ( ) ,
19081937 tls : None ,
1938+ keepalive : Default :: default ( ) ,
19091939 } ,
19101940 http : HttpConfig {
19111941 address : "0.0.0.0:4318" . parse ( ) . unwrap ( ) ,
0 commit comments