-
Notifications
You must be signed in to change notification settings - Fork 231
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
Add support for operation tracing #1075
Add support for operation tracing #1075
Conversation
/gcbrun |
/gcbrun |
/gcbrun |
/gcbrun |
1 similar comment
/gcbrun |
@@ -0,0 +1,21 @@ | |||
/* | |||
* Copyright 2013 Google Inc. |
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: 2023
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.
Done
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystem.java
Show resolved
Hide resolved
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystem.java
Show resolved
Hide resolved
gcs/src/test/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemIntegrationTest.java
Show resolved
Hide resolved
throws IOException { | ||
try { | ||
String traceName = this.traceContext + "(size=1)"; |
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 is the significance of (size=1)
is it the batchSize?
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.
If the control reaches here, the batchsize will be 1. Hence adding that context.
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.
Can we follow the same format then as in L-245
i.e. batchSize=
instead of size=1
?
Or if it is intentionally different?
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.
Done
storageOptions.getMaxRequestsPerBatch(), | ||
resourceIds.size(), | ||
storageOptions.getBatchThreads(), | ||
"batchGetItemInfo"); |
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.
shouldn't this be traceContext
which we prepared above ?
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.
Done
@@ -227,7 +242,10 @@ private void flushPendingRequests() throws IOException { | |||
responseFutures.add( | |||
requestsExecutor.submit( | |||
() -> { | |||
batch.execute(); | |||
String tc = String.format("%s(batchSize=%s)", this.traceContext, batch.size()); |
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:shouldn't this be traceName
instead of tc
?
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.
Done
util/src/main/java/com/google/cloud/hadoop/util/interceptors/InvocationIdInterceptor.java
Show resolved
Hide resolved
|
||
ThreadTraceEvent endEvent() { | ||
ThreadTraceEvent result = new ThreadTraceEvent(EventType.END, name); | ||
result.setTimeTaken(result.timeStamp - timeStamp); |
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 even capturing anything? result
will be created in L163 and time taken is getting updated just immediately which will be tending to 0
.
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.
It is finding the difference of result with the timestamp of "this" event, which might have happened in past.
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.
mind using this
for timestamp
?
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.
why we need a separate event(i.e. END) for it? why can't we maintain a state of an operation to be either Started
Completed
, Merged
?
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 sure if I understood the comment. Start indicate when the operation started and End indicates when the operation has ended. Merged is a special kind of event which merges two consecutive start-end event pairs to one.
|
||
ThreadTraceEvent endEvent() { | ||
ThreadTraceEvent result = new ThreadTraceEvent(EventType.END, name); | ||
result.setTimeTaken(result.timeStamp - timeStamp); |
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.
mind using this
for timestamp
?
} | ||
} | ||
|
||
public void markEnd() { |
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.
via this function we are updating the type
of the event which gives a feeling that EventType
defined above is not actually the type but the state of an event. Which is very confusing.
also function says markEnd
and inside we are updating the type to MERGED
which is also adding to the confusion.
What are your thoughts?
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.
We are merging the events to reduce the number of events. Added a comment.
|
||
ThreadTraceEvent endEvent() { | ||
ThreadTraceEvent result = new ThreadTraceEvent(EventType.END, name); | ||
result.setTimeTaken(result.timeStamp - timeStamp); |
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.
why we need a separate event(i.e. END) for it? why can't we maintain a state of an operation to be either Started
Completed
, Merged
?
throws IOException { | ||
try { | ||
String traceName = this.traceContext + "(size=1)"; |
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.
Can we follow the same format then as in L-245
i.e. batchSize=
instead of size=1
?
Or if it is intentionally different?
} | ||
} | ||
|
||
public void markEnd() { |
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.
- shouldn't we verify that
this
is of typeSTART
before updating the type toMERGED
? - Shouldn't we capture the
endtime
as well just for completeness purposes and maybe pass theendTime
as an argument to this function.
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 will always be start since it is created in the constructor.
- If we use endtime, we still need to subtract to find the time taken. We are more interested in the time taken by the operation. endTime can be derived from startTime and timeTaken. There is no value in duplicating the same information.
|
||
int eventsSize = events.size(); | ||
if (eventsSize != 0) { | ||
ThreadTraceEvent lastEvent = events.get(eventsSize - 1); |
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.
One doubt: why we need to match it with the most recent event(or last) in array? We have reference to the startEvent and now an End is been invoked on it. Why not just go ahead and update the type of START
event to be of type MERGED
instead off creating an END type event?
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.
For eg. op1.start -> op2.start -> op2.end ->op1.end It is good to know the tree structure of the operations.
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.
Can we have these intensions captured somewhere. It's will be hard to follow later on.
} | ||
|
||
ThreadTraceEvent endEvent() { | ||
ThreadTraceEvent result = new ThreadTraceEvent(EventType.END, name); |
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: this.name
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.
We usually add "this" in the construction.
return new ThreadTraceEvent(EventType.START, name); | ||
} | ||
|
||
private ThreadTraceEvent(EventType type, String name) { |
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.
would name
suffice or do we need a unique id too?
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.
The name already has some uniqueness. Basically it will be the context followed by current milliseconds.
|
||
int eventsSize = events.size(); | ||
if (eventsSize != 0) { | ||
ThreadTraceEvent lastEvent = events.get(eventsSize - 1); |
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.
Can we have these intensions captured somewhere. It's will be hard to follow later on.
/gcbrun |
3 similar comments
/gcbrun |
/gcbrun |
/gcbrun |
/gcbrun |
3 similar comments
/gcbrun |
/gcbrun |
/gcbrun |
831bc38
into
GoogleCloudDataproc:master
No description provided.