opencensus-experiments icon indicating copy to clipboard operation
opencensus-experiments copied to clipboard

[grpc] java-client -> go-server interop test fail

Open HailongWen opened this issue 7 years ago • 6 comments

The response by go-server does not contain tag "method".

SEVERE: Client received wrong TagContext. Got [Tag{key=TagKey{name=operation}, value=TagValue{asString=interop-test}}, Tag{key=TagKey{name=project}, value=TagValue{asString=open-census}}], want [Tag{key=TagKey{name=method}, value=TagValue{asString=interop.EchoService/echo}}, Tag{key=TagKey{name=operation}, value=TagValue{asString=interop-test}}, Tag{key=TagKey{name=project}, value=TagValue{asString=open-census}}].

With @songy23 's help, I found the behavior change is due to https://github.com/census-instrumentation/opencensus-go/pull/566. Which behavior is correct? Should the "method" be propagated or not? If not, we should probably change the java code.

HailongWen avatar Mar 27 '18 00:03 HailongWen

FYI the method tag will be automatically propagated in gRPC Java: https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/CensusStatsModule.java#L332. While in Go, it's no longer propagated after https://github.com/census-instrumentation/opencensus-go/pull/566.

/cc @dinooliva @sebright @rakyll @ramonza @bogdandrutu

songy23 avatar Mar 27 '18 00:03 songy23

IIUC C++ also propagates method tag: https://github.com/census-instrumentation/opencensus-cpp/blob/master/opencensus/plugins/grpc/internal/server_filter.cc#L114.

songy23 avatar Mar 27 '18 03:03 songy23

I think gRPC should record stats with the method tag but not propagate it, since the server already knows what method was called and can add the tag back.

sebright2 avatar Mar 27 '18 21:03 sebright2

We deliberately stopped propagating it because it doesn't really make sense outside the scope of the original request.

semistrict avatar Mar 27 '18 21:03 semistrict

Make sense. I think we need to specify this in gRPC propagation spec (https://github.com/census-instrumentation/opencensus-specs/issues/66) if not propagating method tag is the desired bebavior.

songy23 avatar Mar 27 '18 21:03 songy23

The grpc client doesn't need to propagate the method tag but the grpc server does need to add it to the context where the rpc is being processed so there should be a method tag in scope on the server side.

Also, if the grpc server subsequently makes a call as a grpc client, then the method tag will be propagated since it is in scope (I don't believe gRPC has any logic for explicitly removing the method tag).

dinooliva avatar Mar 28 '18 01:03 dinooliva