-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHOENIX-5215 opentelemetry changes replacing htrace #1282
base: master
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Progress!
I left some comments to fix in the next commit.
phoenix-core/pom.xml
Outdated
<groupId>org.apache.htrace</groupId> | ||
<artifactId>htrace-core</artifactId> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-api</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already defined in line 404
phoenix-core/pom.xml
Outdated
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-context</artifactId> | ||
<version>${opentelemetry.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version should be in the dependencyManagement
@@ -84,8 +83,8 @@ public void writeMetrics() throws Exception { | |||
Span span = createNewSpan(traceid, parentid, spanid, description, startTime, endTime, | |||
processid, annotation); | |||
|
|||
Tracer.getInstance().deliver(span); | |||
assertTrue("Span never committed to table", latch.await(30, TimeUnit.SECONDS)); | |||
//Tracer.getInstance().deliver(span); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines should be deleted
|
||
Span span = TraceUtil.getGlobalTracer().spanBuilder("Creating basic query for " + getPlanSteps(iterator)).startSpan(); | ||
|
||
if (span.isRecording()) return new TracingIterator(span, iterator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it going to be true anytime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardantal default implementation shows it as false. I will take a look at it in depth and see how we can enable TracingIterator
@@ -60,7 +60,7 @@ | |||
* | |||
* @since 0.1 | |||
*/ | |||
public final class PhoenixDriver extends PhoenixEmbeddedDriver { | |||
public final class PhoenixDriver extends PhoenixEmbeddedDriver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra space
@@ -201,6 +201,7 @@ | |||
import org.apache.phoenix.schema.types.PDataType; | |||
import org.apache.phoenix.schema.types.PLong; | |||
import org.apache.phoenix.schema.types.PVarchar; | |||
import org.apache.phoenix.trace.TraceUtil; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not used
@@ -264,7 +256,7 @@ protected Connection getConnection(String tableName) { | |||
try { | |||
// create the phoenix connection | |||
Properties props = new Properties(); | |||
props.setProperty(QueryServices.TRACING_FREQ_ATTRIB, Tracing.Frequency.NEVER.getKey()); | |||
//props.setProperty(QueryServices.TRACING_FREQ_ATTRIB, Tracing.Frequency.NEVER.getKey()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardantal I will remove this once I have made changes to handle tracing at connection
import org.apache.phoenix.iterate.DelegateResultIterator; | ||
import org.apache.phoenix.iterate.ResultIterator; | ||
import org.apache.phoenix.schema.tuple.Tuple; | ||
import org.apache.htrace.TraceScope; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra line
import org.apache.htrace.HTraceConfiguration; | ||
import io.opentelemetry.api.trace.Span; | ||
import io.opentelemetry.api.trace.Tracer; | ||
import io.opentelemetry.context.Scope; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it can be deleted, as it is not used.
import org.apache.phoenix.call.CallRunner; | ||
import org.apache.phoenix.call.CallWrapper; | ||
import org.apache.phoenix.jdbc.PhoenixConnection; | ||
import org.apache.phoenix.parse.TraceStatement; | ||
import org.apache.phoenix.query.QueryServices; | ||
import org.apache.phoenix.job.JobManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used
import io.opentelemetry.context.Scope; | ||
import org.apache.phoenix.trace.TraceUtil; | ||
|
||
import java.sql.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Phoenix style guidelines does not want to use import *
|
||
import java.sql.*; | ||
|
||
public class LocalConnectionTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this class assuming a local instance is running? Can this be made an actual IT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong this test was written for local testing i have removed it.
import java.nio.file.Paths; | ||
import java.util.List; | ||
|
||
public class TestFSShellCluster { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this class on testing and IT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong this was also written as part of local testing. have removed it
if (child != null) { | ||
child.stop(); | ||
} | ||
child.end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did we change here that insure child is non-null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong In general opentelemetry default implementation would return an invalid span (when telemetry is not enabled) or a valid span same goes for startSpan as well. some other implementation might return null. I will add the check again
@@ -108,6 +108,7 @@ protected void submitWork(final List<List<Scan>> nestedScans, List<List<Pair<Sca | |||
context.getOverallQueryMetrics().updateNumParallelScans(numScans); | |||
GLOBAL_NUM_PARALLEL_SCANS.update(numScans); | |||
final long renewLeaseThreshold = context.getConnection().getQueryServices().getRenewLeaseThresholdMilliSeconds(); | |||
//TODO: Parent Span creation using Span.current() and create children with description "Parallel scanner for table: " + tableRef.getTable().getPhysicalName().getString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this being handled in this JIRA or a followup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong I am planning to handle this in this JIRA.
|
||
@Override | ||
public PeekingResultIterator call() throws Exception { | ||
//TODO: create child span for each call using parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one we use to handle with Tracing.wrap right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong yes i had updated the implementation. was seeing issues so had to disable it. Will take a look at it again
@@ -47,6 +46,7 @@ | |||
public class TraceReader { | |||
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(TraceReader.class); | |||
public static final long ROOT_SPAN_ID = 0x74ace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the recommended approach for a top level span?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwong I am not sure if we need TraceReader anymore, considering we can view the traces on exporter ui (like zipking or jaeger). I wanted to discuss about TracingWebApplication as well in the JIRA will comment there
@virajjasani @richardantal can you please review |
@kiran-maturi - I'm curious what the status of this PR is (needs a rebase at the least), and if we're trying to get it into the upcoming Phoenix 5.2 release? |
@gjacoby126 sorry for the late response. I have rebased it working on fixing other issues as well. Will keep you posted |
No description provided.