-
Notifications
You must be signed in to change notification settings - Fork 171
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
SNOW-1271301 add telemetry fields and use the metrics ExecTimeTelemet… #1762
Conversation
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
d317a7f
to
f58477c
Compare
This PR is still WIP. Feedback is needed for the general logic of the enhanced telemetry. |
d405797
to
ffea8b2
Compare
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 left some comments - please also think about tests for your changes
src/main/java/net/snowflake/client/core/ExecTimeTelemetryData.java
Outdated
Show resolved
Hide resolved
src/main/java/net/snowflake/client/core/ExecTimeTelemetryData.java
Outdated
Show resolved
Hide resolved
private String requestId; | ||
|
||
public ExecTimeTelemetryData(String queryFunction, String batchId) { | ||
if (TelemetryService.getInstance().isHTAPEnabled()) { | ||
if (TelemetryService.getInstance().isHTAPEnabled() | ||
|| TelemetryService.getInstance().isClientTelemetryEnabled()) { |
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.
let's create a single method in TelemetryService to decide if the telemetry is turned on here
@@ -24,4 +24,9 @@ public static Optional<QueryResultFormat> lookupByName(String n) { | |||
|
|||
return Optional.empty(); | |||
} | |||
|
|||
@Override | |||
public String toString() { |
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 don't think it should be toString but more getName()
or better getParameterValue()
@@ -160,6 +160,9 @@ public SFArrowResultSet( | |||
// update the driver/session with common parameters from GS | |||
SessionUtil.updateSfDriverParamValues(this.parameters, statement.getSFBaseSession()); | |||
|
|||
// send a metric to tell the result format is arrow |
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 don't think we should keep such comments - the method name is quite expressive
* @param value the value to log for the field | ||
* @return TelemetryData instance constructed from parameters | ||
*/ | ||
public static TelemetryData buildJobData(String queryId, TelemetryField field, String value) { |
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 create a method where the value is Object and make the method above using the new one and make the old method deprecated?
@@ -179,6 +190,26 @@ public void addRetryLocation(String location) { | |||
|
|||
public String generateTelemetry() { | |||
if (this.sendData) { | |||
if (this.telemetryClient != 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.
it means that we are using this method to generate one event and by the way create 3 other events? I don't think it should happen in one method
also do we want to generate separate events to the batch? cannot we add them to the ExecutionTimeRecord created below?
@@ -142,6 +164,10 @@ public boolean isHTAPEnabled() { | |||
} | |||
} | |||
|
|||
public boolean isTelemetryEnabled() { |
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.
should it be isInBoundTelemetryEnabled
?
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 method is called by the ExecTimeTelemetryData. it is true when isHTAPEnabled or isClientTelemetryEnabled. It can haooen that isClientTelemetryEnabled is false and thus InBoundTelemetry is false, but isHTAPEnabled is true.
The ExecTimeTelemetryData will collect data when either of oob or ib telemetries is enabled.
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.
But it does not seems to be right that on the session parameter we are changing the global state - but it's already merged for a long time
Nevertheless. For sending the new telemetry events you are adding we should be do this via inbound telemetry?
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.
Yes, it should go to to client_telemetry_v with the session and query_id. There are already some fields that are sent, we are trying to add more.
} | ||
} | ||
|
||
public boolean isClientTelemetryEnabled() { |
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.
could this method be private?
@@ -656,6 +656,11 @@ public synchronized void open() throws SFException, SnowflakeSQLException { | |||
} else { | |||
TelemetryService.disableHTAP(); | |||
} | |||
if (isClientTelemetryEnabled()) { |
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.
inbound telemetry is enabled per session - but here we set it on the static level - do we need it at all? can we just use the flag from the session wherever it's necessary?
SNOW-1271301 entcouple the TelemetryClinet and the TelemetryService SNOW-1271301 entcouple the ExecTimeTelemetryData and the TelemetryClinet SNOW-1271301 add client_time_response_from_server SNOW-1271301 add telemetry fields and use the metrics ExecTimeTelemetryData to send telemetry.
2453b50
to
9eafabf
Compare
…job data using a value of type Object
Overview
This PR is still WIP. Feedback is needed for the general logic of the enhanced telemetry.
Tests are to be added.
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX:
External contributors - please answer these questions before submitting a pull request. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes #NNNN
Fill out the following pre-review checklist:
@SnowflakeJdbcInternalApi
(note that public/protected methods/fields in classes marked with this annotation are already internal)Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.