-
Notifications
You must be signed in to change notification settings - Fork 30
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
Added support for Kinesis #33
Conversation
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.
Great work 🎉 👏🏻 Thanks a lot for your contribution, much appreciated 🙇🏻
I've left some comments regarding how the implementation has been approached. Nothing major, but I would still like to address it before we merge it. Let me know if you have any questions, if I can support you in any ways 👍🏻
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.
Great work with the last batch of changes. Thanks a lot for putting the work into it 🙇🏻
Here's another batch of comments and ideas I'd like to see addressed. That could come across as a lot, but as maintainers, we'll have to own, document, and maintain this code long-term, and I want to ensure we get everything right. I hope you understand 🙏🏻
In general, most of my comments are either questions, cosmetic change requests, or questions. Let me know if you have any questions or feedback 👀
A more general comment:
I haven't decided on it yet, but I find the whole *Request
, *Response
interfaces a bit much to process, document, and maintain.
Furthermore, it's pretty low-level, and relatively close to the actual underlying request/responses format, whereas, at k6, we deeply care about delivering the most friendly-user interfaces possible. In the context of the jslib-aws, we prefer to provide fewer but higher-level abstractions.
I will provide comments directly on the code by the beginning of next week. But my shallow and overarching comment, as of right now, is that I would prefer to have some types/classes that align more with the data types described by the AWS Kinesis Data Types Documentation, and less with the underlying bodies of the requests and response. I would like to see them returned directly by the methods exposed to the user rather than the current *Response
type. That means that instead of a ListShardsResponse
, for instance, I'd prefer a method that returns an Array<Shard>
.
I have weaker opinions on this, but the same goes for the *Request
types. I see their value and convenience to us, the developers. Still, they also obfuscate the actual API and don't align with our goal for the project to make understanding and using the APIs straightforward. In many cases, those interfaces also contain just a couple of members. They could easily be replaced by single arguments (which are also much easier to document when I update the document website).
I hope these comments make sense. Let me know if you need any clarification or support with it, I would be happy to help 🙇🏻
@@ -14,6 +14,8 @@ At the moment, this library provides the following: | |||
* `KMS`: allows to list KMS keys and generate a unique symmetric data key for use outside of AWS KMS | |||
* `SSM`: allows to retrieve a parameter from AWS Systems Manager | |||
* `V4 signature`: allows to sign requests to amazon AWS services | |||
* `KinesisClient`: allows all APIs for Kinesis available by AWS. |
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.
* `KinesisClient`: allows all APIs for Kinesis available by AWS. | |
* `KinesisClient`: use it to interact with the AWS Kinesis service. |
'Content-Type': 'application/x-amz-json-1.1', | ||
} | ||
|
||
return new Proxy(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.
My understanding is that we don't need this function anymore. Can we please drop 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.
This is growing lib, and would not like to limit the functions until all are implemented, specially when its already available easily. I hope this would be fine, what do you suggest ?
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 appreciate where you come from @autometa101. However, as mentioned in a previous iteration, we would like to avoid having "magic" code (as we need to document the available API to users in k6's documentation), and we would also like to avoid code meant for a future use case.
Let's, please, drop that call for now 🙇🏻
* @param {CreateStreamRequest} request - CreateStreamRequest - The request object that will be | ||
* sent to the server. | ||
*/ | ||
createStream(request: CreateStreamRequest): void { |
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'd prefer to see this method and the rest of the following high-level and public methods appear right after the constructor 👍🏻
|
||
|
||
/** | ||
* It makes a request to the AWS API. |
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 makes a request to the AWS API. | |
* Sends a signed request to AWS Kinesis API. |
* @param {JSONObject} options - JSONObject = {} | ||
* @returns A RefinedResponse<ResponseType | undefined> | ||
*/ | ||
RequestOperation(target: string, |
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.
RequestOperation(target: string, | |
_request(action: KinesisAction, |
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.
As hinted in ☝🏻 I would like a dedicated type describing and delimiting the supported Kinesis actions: type KinesisAction = 'CreateStream' | 'etc...'
.
Like we did in https://github.com/grafana/k6-jslib-aws/blob/main/src/internal/s3.ts#L376. We named them "operation" in the S3Client
too, but we regret that terminology as it is not aligned with AWS, which refers to them as "actions".
} | ||
|
||
/** | ||
* It returns a list of streams. |
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 returns a list of streams. | |
* Lists your Kinesis data streams. | |
* |
} | ||
|
||
/** | ||
* It takes a request object and returns a response object. |
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 takes a request object and returns a response object. | |
* Writes multiple data records into a Kinesis data stream in a single call. | |
* | |
* Use this operation to send data into the stream for data ingestion and processing. | |
* |
} | ||
|
||
/** | ||
* It gets the records from the database. |
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 gets the records from the database. | |
* Gets data records from a Kinesis data stream's shard. | |
* |
} | ||
|
||
/** | ||
* It lists the shards in a stream. |
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 lists the shards in a stream. | |
* Lists the shards in a stream and provides information about each shard. | |
* |
|
||
|
||
/** | ||
* |
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.
* | |
* Gets an Amazon Kinesis shard iterator. A shard iterator expires 5 minutes after it is returned to the requester. | |
* |
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'm not familiar with Kinesis: this returns an "iterator", which seems to be some id by the looks of it. Do we have any methods of making any use of it, though? Otherwise, we'd drop this method altogether. Once again I'm not familiar with Kinesis, so, looking forward to your 💡 here 🙏🏻
Hey @autometa101, thanks for the further work you've put into this 🤝 and sorry for coming back to this so late, we had a company event in the meantime. We truly value your contribution and have been thinking about how to approach merging it in the main branch in the best conditions. The conclusion was that we would like to merge this PR soonish and incorporate the changes and documentation we think are necessary ourselves. The feature will therefore land in the next upcoming version of the library which has no release date set just yet 👍🏻 Let me know if you have any opposition to this plan, questions, or feedback. Otherwise, we'll just proceed. Cheers! 🚀 |
Hi @oleiade, I was extensively using this library (branch) to publish few million messages in last days,
However, I was not able to continue working on the requested changes to remove all methods and allow only limited with details. If there is no changes in direction, I am planning to continue development in next week. |
Hey @autometa101 Thanks for the heads-up 🙇🏻 Can you open GitHub issues about those specific issues you've encountered? If anything, they will make them visible to users using the Kinesis client once it's merged. We already have users asking about this feature, which will help us all keep track of limitations and potential issues users would run into. My rationale was that the client is already in a usable state, and most of the blocking points are about how the code is structured, etcetera. We figured we would go faster doing those ourselves. Here's how we're going to proceed then:
|
Adding API Support for Kinesis.
It will support all APIs from https://docs.aws.amazon.com/kinesis/latest/APIReference/API_Operations.html