@@ -136,6 +136,16 @@ fn infer_protocol_and_endpoint(
136
136
maybe_protocol : Option < & str > ,
137
137
maybe_endpoint : Option < & str > ,
138
138
) -> ( String , String ) {
139
+ let maybe_protocol = match maybe_protocol {
140
+ Some ( "grpc" ) => Some ( "grpc" ) ,
141
+ Some ( "http" ) | Some ( "http/protobuf" ) => Some ( "http/protobuf" ) ,
142
+ Some ( other) => {
143
+ tracing:: warn!( target: "otel::setup" , "unsupported protocol {other:?}" ) ;
144
+ None
145
+ }
146
+ None => None ,
147
+ } ;
148
+
139
149
let protocol = maybe_protocol. unwrap_or_else ( || {
140
150
if maybe_endpoint. map_or ( false , |e| e. contains ( ":4317" ) ) {
141
151
"grpc"
@@ -162,6 +172,7 @@ mod tests {
162
172
#[ rstest]
163
173
#[ case( None , None , "http/protobuf" , "http://localhost:4318" ) ] //Devskim: ignore DS137138
164
174
#[ case( Some ( "http/protobuf" ) , None , "http/protobuf" , "http://localhost:4318" ) ] //Devskim: ignore DS137138
175
+ #[ case( Some ( "http" ) , None , "http/protobuf" , "http://localhost:4318" ) ] //Devskim: ignore DS137138
165
176
#[ case( Some ( "grpc" ) , None , "grpc" , "http://localhost:4317" ) ] //Devskim: ignore DS137138
166
177
#[ case( None , Some ( "http://localhost:4317" ) , "grpc" , "http://localhost:4317" ) ]
167
178
#[ case(
0 commit comments