Is there something limitation for Cloud Trace on Cloud Run?

409 views Asked by At

I'm building microservices on Cloud Run with Java. So, I want to use CloudTrace for these services. But it doesn't work as I expected. A DeadlineExceededException is raised.

I can run same services on my local PC. And in that time, it's no problem. I can confirm tracing on CloudTrace. But when I deployed them on Cloud Run, Tracing doesn't work... Do you have any idea?

Code is below. I use OpenCensus library.

var spanContext = TEXT_FORMAT.extract(request, GETTER);
var builder = Tracing.getTracer()
        .spanBuilderWithRemoteParent(name, spanContext);

builder.setRecordEvents(true)
        .setSampler(Samplers.alwaysSample())
        .startScopedSpan();

try ( var ss = builder.setRecordEvents(true)
        .setSampler(Samplers.alwaysSample())
        .startScopedSpan()) {
    var span = Tracing.getTracer().getCurrentSpan();
    span.putAttribute(HttpTraceAttributeConstants.HTTP_HOST, AttributeValue.stringAttributeValue(host));
    span.putAttribute(HttpTraceAttributeConstants.HTTP_METHOD, AttributeValue.stringAttributeValue(method));
    span.putAttribute(HttpTraceAttributeConstants.HTTP_PATH, AttributeValue.stringAttributeValue(path));

    // Something logic
}

Error is below.

2020-08-31 15:28:23.065 PDT2020-08-31 22:28:22,462 WARNING [io.ope.tra.exp.ExportComponent] (ExportComponent.ServiceExporterThread-0) Exception thrown by the service export io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter: com.google.api.gax.rpc.DeadlineExceededException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: ClientCall started after deadline exceeded: -2.199245981s from now
2020-08-31 15:28:23.065 PDT at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:51)
2020-08-31 15:28:23.065 PDT at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
2020-08-31 15:28:23.065 PDT at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
2020-08-31 15:28:23.065 PDT at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
2020-08-31 15:28:23.065 PDT at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1056)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:707)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.ForwardingListenableFuture.addListener(ForwardingListenableFuture.java:45)
2020-08-31 15:28:23.065 PDT at com.google.api.core.ApiFutureToListenableFuture.addListener(ApiFutureToListenableFuture.java:52)
2020-08-31 15:28:23.065 PDT at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1037)
2020-08-31 15:28:23.065 PDT at com.google.api.core.ApiFutures.addCallback(ApiFutures.java:63)
2020-08-31 15:28:23.065 PDT at com.google.api.gax.grpc.GrpcExceptionCallable.futureCall(GrpcExceptionCallable.java:67)

I tried Extensible Service Proxy. It works. But I want to make the tracing as a part of application.

0

There are 0 answers