Adding detailed request information in Google Cloud Trace

195 views Asked by At

I'm building a Spring Boot application that's deployed on Google App Engine. To find out the cause of some weird latency issues, I figured I'd enable Google Cloud Trace to view detailed latency reports.

Adding basic tracing was simple enough since this is supported natively by GAE. However, I am having a hard time adding details to any individual trace.

For example; the following code:

public MediaContent getMediaContent(long contentId) {
    Optional<MediaContent> found;

    try (Scope ss = tracer.spanBuilder("databaseSubSpan").setSampler(Samplers.alwaysSample()).startScopedSpan()) {
        tracer.getCurrentSpan().addAnnotation("Retrieving MediaContent " + contentId + " from repository");
        found = mediaContentRepository.findById(contentId);
    }

    if (found.isEmpty()) {
        tracer.getCurrentSpan().setStatus(Status.NOT_FOUND);
        throw new NoSuchContentException(contentId);
    }

    return found.get();
}

I figured that in the Cloud Trace UI, this would display a separate little latency line so I could see which part of the total request time is spent on database communication. However, no such information is visible to me:

Google Cloud Trace screenshot

I have made sure that this exact method is invoked by adding a few log entries around it. All the log entries (even the one inside the try block) show up in my logs.

I set the sampling rate to 100% by adding the following to my application.yml: spring.sleuth.sampler.probability: 1.0

Basically, what I expected to see on the Cloud Trace UI is a second bar underneath the primary request. As such:

Expected result

Is this even possible in Cloud Trace? I expect that it would be since the chart is so tall which seems to me like it has space left for extra bars. If it is, what am I doing wrong?

Thanks.

1

There are 1 answers

0
Ahmad P On

It needs to be investigated by the Google product team.

Then I would suggest forwarding this through a Public Issue Tracker for further support. or you can open a ticket with Google Cloud support (For free users this link) so that we may investigate this issue further.