Fix formatting and add test.
This commit is contained in:
parent
13b84416b9
commit
25397fd128
|
@ -14,7 +14,7 @@ public final class GrpcExtractAdapter implements AgentPropagation.Getter<Metadat
|
|||
List<String> keys = new ArrayList<>();
|
||||
|
||||
for (String key : carrier.keys()) {
|
||||
if (!key.endsWith(Metadata.BINARY_HEADER_SUFFIX)){
|
||||
if (!key.endsWith(Metadata.BINARY_HEADER_SUFFIX)) {
|
||||
keys.add(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import datadog.trace.agent.test.AgentTestRunner
|
||||
import datadog.trace.api.DDSpanTypes
|
||||
import datadog.trace.instrumentation.api.Tags
|
||||
import datadog.trace.instrumentation.grpc.server.GrpcExtractAdapter
|
||||
import example.GreeterGrpc
|
||||
import example.Helloworld
|
||||
import io.grpc.BindableService
|
||||
import io.grpc.ManagedChannel
|
||||
import io.grpc.Metadata
|
||||
import io.grpc.Server
|
||||
import io.grpc.Status
|
||||
import io.grpc.StatusRuntimeException
|
||||
|
@ -284,4 +286,17 @@ class GrpcTest extends AgentTestRunner {
|
|||
"Status - description" | Status.PERMISSION_DENIED.withDescription("some description")
|
||||
"StatusRuntime - description" | Status.UNIMPLEMENTED.withDescription("some description")
|
||||
}
|
||||
|
||||
def "skip binary headers"() {
|
||||
setup:
|
||||
def meta = new Metadata()
|
||||
meta.put(Metadata.Key.<String> of("test", Metadata.ASCII_STRING_MARSHALLER), "val")
|
||||
meta.put(Metadata.Key.<byte[]> of("test-bin", Metadata.BINARY_BYTE_MARSHALLER), "bin-val".bytes)
|
||||
|
||||
when:
|
||||
def keys = GrpcExtractAdapter.GETTER.keys(meta)
|
||||
|
||||
then:
|
||||
keys == ["test"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue