-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat: Transfer Manager Metrics #2305
Conversation
First commit is feature-only (no tests) to show it works w/o breaking anything. Working on tests next. |
@@ -537,7 +539,9 @@ export class Util { | |||
body: writeStream, | |||
}, | |||
], | |||
} as {} as r.OptionsWithUri & GCCL_GCS_CMD; | |||
} as {} as r.OptionsWithUri & { |
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 is clever!
src/nodejs-common/util.ts
Outdated
* | ||
* E.g the `V` in `X-Goog-API-Client: gccl-gcs-cmd/V` | ||
**/ | ||
export const GCCL_GCS_CMD_KEY = Symbol('GCCL_GCS_CMD'); |
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.
Had to go look this up, didn't know Symbol
was a thing.
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.
Approach LGTM
transferManager.bucket.storage.authClient = new GoogleAuth({ | ||
authClient: new TestAuthClient(), | ||
}); |
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.
Makes it more of an integration test.
directory = await fsp.mkdtemp( | ||
path.join(tmpdir(), 'tm-uploadFileInChunks-') | ||
); | ||
|
||
filePath = path.join(directory, 't.txt'); | ||
|
||
await fsp.writeFile(filePath, 'hello'); |
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.
Sharing a real, temp file to make it more robust. We can refactor the other tests if we want to use the real XML tool w/o exporting 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.
Yea this looks better than the hacky way I had it.
}, | ||
idempotencyStrategy: IdempotencyStrategy.RetryConditional, | ||
}; | ||
const STORAGE = sinon.stub( |
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.
Thanks, couldn't figure out the correct way to do this.
} | ||
|
||
// If the header isn't present, add it | ||
if (!headerFound) { |
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'd have to remember to update this line every time we add something new to headers. Is there a better way to do this?
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 can have a centralized place for this, however it would be cleaner to first complete the gaxios migration.
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 is also already matching the pattern in resumable uploads.
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.
here's an example in #2296.
Yeah, thats fine. Please create a TODO & ticket to follow up
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.
PR's ready for review |
🦕