-
Notifications
You must be signed in to change notification settings - Fork 60
[PECOBLR-1384] Complete telemetry implementation: Phases 8-10 #322
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
Open
samikshya-db
wants to merge
6
commits into
main
Choose a base branch
from
stack/PECOBLR-1384-telemetry-phase8-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8c8fef0
Implement Phases 8-10: Testing, Launch Prep & Documentation
samikshya-db a1f8b0c
Rebase onto updated PR #320; remove ForceEnableTelemetry; fix test al…
samikshya-db 434114d
Fix gofmt formatting in telemetry files
samikshya-db fb91627
Remove LAUNCH.md and TROUBLESHOOTING.md
samikshya-db aa1f4ba
Fix rows.NewRows calls to include telemetry parameters
samikshya-db e23c725
Fix runQuery test calls to match updated function signature
samikshya-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,12 @@ type rows struct { | |
| logger_ *dbsqllog.DBSQLLogger | ||
|
|
||
| ctx context.Context | ||
|
|
||
| // Telemetry tracking | ||
| telemetryCtx context.Context | ||
| telemetryUpdate func(chunkCount int, bytesDownloaded int64) | ||
| chunkCount int | ||
| bytesDownloaded int64 | ||
| } | ||
|
|
||
| var _ driver.Rows = (*rows)(nil) | ||
|
|
@@ -72,6 +78,8 @@ func NewRows( | |
| client cli_service.TCLIService, | ||
| config *config.Config, | ||
| directResults *cli_service.TSparkDirectResults, | ||
| telemetryCtx context.Context, | ||
| telemetryUpdate func(chunkCount int, bytesDownloaded int64), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a public function, are we sure this is ok to change? |
||
| ) (driver.Rows, dbsqlerr.DBError) { | ||
|
|
||
| connId := driverctx.ConnIdFromContext(ctx) | ||
|
|
@@ -103,14 +111,18 @@ func NewRows( | |
| logger.Debug().Msgf("databricks: creating Rows, pageSize: %d, location: %v", pageSize, location) | ||
|
|
||
| r := &rows{ | ||
| client: client, | ||
| opHandle: opHandle, | ||
| connId: connId, | ||
| correlationId: correlationId, | ||
| location: location, | ||
| config: config, | ||
| logger_: logger, | ||
| ctx: ctx, | ||
| client: client, | ||
| opHandle: opHandle, | ||
| connId: connId, | ||
| correlationId: correlationId, | ||
| location: location, | ||
| config: config, | ||
| logger_: logger, | ||
| ctx: ctx, | ||
| telemetryCtx: telemetryCtx, | ||
| telemetryUpdate: telemetryUpdate, | ||
| chunkCount: 0, | ||
| bytesDownloaded: 0, | ||
| } | ||
|
|
||
| // if we already have results for the query do some additional initialization | ||
|
|
@@ -127,6 +139,17 @@ func NewRows( | |
| if err != nil { | ||
| return r, err | ||
| } | ||
|
|
||
| r.chunkCount++ | ||
| if directResults.ResultSet != nil && directResults.ResultSet.Results != nil && directResults.ResultSet.Results.ArrowBatches != nil { | ||
| for _, batch := range directResults.ResultSet.Results.ArrowBatches { | ||
| r.bytesDownloaded += int64(len(batch.Batch)) | ||
| } | ||
| } | ||
|
|
||
| if r.telemetryUpdate != nil { | ||
| r.telemetryUpdate(r.chunkCount, r.bytesDownloaded) | ||
| } | ||
| } | ||
|
|
||
| var d rowscanner.Delimiter | ||
|
|
@@ -458,6 +481,19 @@ func (r *rows) fetchResultPage() error { | |
| return err1 | ||
| } | ||
|
|
||
| r.chunkCount++ | ||
| if fetchResult != nil && fetchResult.Results != nil { | ||
| if fetchResult.Results.ArrowBatches != nil { | ||
| for _, batch := range fetchResult.Results.ArrowBatches { | ||
| r.bytesDownloaded += int64(len(batch.Batch)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if r.telemetryUpdate != nil { | ||
| r.telemetryUpdate(r.chunkCount, r.bytesDownloaded) | ||
| } | ||
|
|
||
| err1 = r.makeRowScanner(fetchResult) | ||
| if err1 != nil { | ||
| return err1 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
don't think we have forceEnableTelemetry?