This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
listShards
KinesisClient.listShards(streamName, [options]) lists the shards in a Kinesis stream.
📢 Registration + agenda now live Explore the latest Grafana Cloud and AI solutions, learn tips & tricks from demos and hands-on workshops, and get actionable advice to advance your observability strategy. Register now and get 50% off - limited tickets available (while they last!).
Register nowProducts
Grafana Cloud
Monitor, analyze, and act faster with AI-powered observability.
LGTM+ Stack
Key Capabilities
Observability Solutions
Open Source
Community resources
Dashboard templates
Try out and share prebuilt visualizations
Prometheus exporters
Get your metrics into Prometheus quickly
end-to-end solutions
Opinionated solutions that help you get there easier and faster
monitor infrastructure
Out-of-the-box KPIs, dashboards, and alerts for observability
visualize any data
Instantly connect all your data sources to Grafana
Learn
Community and events
Resources
Help build the future of open source observability software Open positions
Check out the open source projects we support Downloads
Grafana Cloud
Monitor, analyze, and act faster with AI-powered observability.
Observability Solutions
The actually useful free plan
10k series Prometheus metrics
50GB logs, 50GB traces, 50GB profiles
500VUk k6 testing
20+ Enterprise data source plugins
100+ pre-built solutions
end-to-end solutions
Opinionated solutions that help you get there easier and faster
visualize any data
Instantly connect all your data sources to Grafana
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
KinesisClient.listShards(streamName, [options]) lists the shards in a Kinesis stream.
| Parameter | Type | Description |
|---|---|---|
| streamName | string | The name of the Kinesis stream. |
| options | object | Optional configuration for the list shards operation. |
| Parameter | Type | Description |
|---|---|---|
| nextToken | string | The token to use for pagination. |
| exclusiveStartShardId | string | The shard ID to start listing from (exclusive). |
| maxResults | number | The maximum number of shards to return. |
| Type | Description |
|---|---|
Promise<Object> | A Promise that fulfills with the list of shards. |
| Property | Type | Description |
|---|---|---|
| shards | Array | An array of shard objects. |
| nextToken | string | The token to use for the next page of results. |
| Property | Type | Description |
|---|---|---|
| shardId | string | The unique identifier of the shard. |
| parentShardId | string (optional) | The shard ID of the parent shard (if any). |
| adjacentParentShardId | string (optional) | The shard ID of the adjacent parent shard (if any). |
| hashKeyRange | Object | The hash key range for the shard. |
| sequenceNumberRange | Object | The sequence number range for the shard. |
import {
AWSConfig,
KinesisClient,
} from 'https://jslib.k6.io/aws/0.14.0/kinesis.js';
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
});
const kinesis = new KinesisClient(awsConfig);
export default async function () {
const streamName = 'my-test-stream';
// List all shards in the stream
const shardsResponse = await kinesis.listShards(streamName);
console.log('Number of shards:', shardsResponse.shards.length);
// Display information about each shard
shardsResponse.shards.forEach((shard, index) => {
console.log(`Shard ${index}:`);
console.log(' Shard ID:', shard.shardId);
console.log(' Parent Shard ID:', shard.parentShardId || 'None');
console.log(' Adjacent Parent Shard ID:', shard.adjacentParentShardId || 'None');
console.log(' Hash Key Range:', shard.hashKeyRange);
console.log(' Sequence Number Range:', shard.sequenceNumberRange);
});
// List shards with pagination
const limitedShards = await kinesis.listShards(streamName, { maxResults: 2 });
console.log('Limited shards:', limitedShards.shards.length);
// Continue pagination if there are more shards
if (limitedShards.nextToken) {
const nextPage = await kinesis.listShards(streamName, {
nextToken: limitedShards.nextToken,
});
console.log('Next page shards:', nextPage.shards.length);
}
}