Skip to content
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

Allow users to specify partition keys #6

Open
mfischer-zd opened this issue Dec 22, 2015 · 7 comments
Open

Allow users to specify partition keys #6

mfischer-zd opened this issue Dec 22, 2015 · 7 comments

Comments

@mfischer-zd
Copy link

Currently one can only select between random partition keys, or partition keys derived from the data. It should also be possible to specify a partition key associated with each file to be published.

@chaochenq
Copy link
Contributor

Hello,

Are you saying that you want the partition key of each record coming from the same file to be the same? Like when you configure the Agent, you define a constant string as the partition key for each filePattern?

@mfischer-zd
Copy link
Author

That is correct.

@chaochenq
Copy link
Contributor

That sounds reasonable. I've created a task in our backlog. If we don't get time around it, you can also go modify the logic here:

https://github.com/awslabs/amazon-kinesis-agent/blob/master/src/com/amazon/kinesis/streaming/agent/tailing/KinesisRecord.java#L60

Would also love to merge the PR

@bohnman
Copy link

bohnman commented May 23, 2016

@chaochenq It would also be great if you could apply a regex to the data to extract a partition key.

For example, consider the following payload:

{ "deviceId": "1234-5678", "weight": 52 }

To use deviceId as the partition key, you would specify something like the following in the agent.json:

"flows": [ { "filePattern": "/path/to/log/file", "kinesisStream": "data", "partitionKeyPattern" : "\"deviceId\"\s*:\s*\"([a-zA-Z0-9-]+)\"" } ]

The parentheses would create a matching group that would be the partition key.

@yang-wei
Copy link

@chaochenq Is anyone working on this ?
Would like to support this feature

#6 (comment)

This seems like a good API

@phspies
Copy link

phspies commented Feb 7, 2023

Anyone still working on this? I have a customer that could really use this feature. I see you have a branch that already supports this, will that ever be merged into the main branch?

@aoflanna
Copy link

@phspies or anyone were you able to successfully use these forked feature branches? I dont think either solution was ever merged back into awslabs. thank you

https://github.com/yang-wei/amazon-kinesis-agent/tree/add-partition-key-support
https://github.com/Kryptoncloud/amazon-kinesis-agent/tree/feature/support-partition-key-pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants