Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Question: Folding the spans #58

Open
aclowkey opened this issue Apr 1, 2019 · 4 comments
Open

Question: Folding the spans #58

aclowkey opened this issue Apr 1, 2019 · 4 comments

Comments

@aclowkey
Copy link

aclowkey commented Apr 1, 2019

First of all, thanks for the great library.
I'm having a hard time reading my traces because the JDBC has a lot lot lot of spans. I wish I could somehow fold it in StackDriver, but I don't see the option there.

I'm not enitrely sure what allows spans to be folded in StackDrvier, but perhaps they should be linked somehow as a single span with child spans?

Thanks for any help.

@odeke-em
Copy link
Contributor

odeke-em commented Apr 1, 2019

Hello @aclowkey, thank you for filing this issue and thank you for the kind words!

So I have a few preliminary questions:
a) What version of this library are you using?
b) What does your source code import path look like?

I ask because we gutted out the spans that weren't making RPCs, and also published updates as per https://opencensus.io/integrations/sql/java_sql/

@aclowkey
Copy link
Author

aclowkey commented Apr 1, 2019

I'm using 0.0.3,

import io.orijtech.integrations.ocjdbc.Observability;
import io.orijtech.integrations.ocjdbc.OcWrapConnection;

Here is an example of a trace I get
trace

@odeke-em
Copy link
Contributor

odeke-em commented Apr 1, 2019

Thank you for answering those questions @aclowkey!

So in regards to your question:

I'm not enitrely sure what allows spans to be folded in StackDrvier, but perhaps they should be linked somehow as a single span with child spans?

Yes, you can create a parent span before that SQL execute by

      try (Scope ss = tracer.spanBuilder(nameOfYourSpan).startScopedSpan()) {
        java.sql.Statement stmt = conn.createStatement();
        java.sql.ResultSet rs = stmt.executeQuery(SQL_STATEMENT);
        rs.close();
     }

as per https://opencensus.io/integrations/sql/java_sql/#source-code

and that should create the parent span in which those will be child spans and thus collapsable on Stackdriver

For example, using the example in the website guides and viewed on Jaeger

Hope that answers your question!

@aclowkey
Copy link
Author

aclowkey commented Apr 2, 2019

Thanks for the answer.
I do have these scopes around the HTTP, however, I'm using jOOQ and HikariCP, and there are a LOT of database calls in my codebase, so adding scope wrappers around each one would be too much.

Why aren't the spans linked in my example in the screenshot?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants