Skip to content

Commit 638d934

Browse files
authored
Update script and add demo (#10)
1 parent d70b40b commit 638d934

File tree

10 files changed

+508
-652
lines changed

10 files changed

+508
-652
lines changed

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Pop-up store demo using RedisTimeSeries, RedisGears and Redis plugins for Grafana</h1>
22

3-
![Pop-up](https://github.com/RedisTimeSeries/redis-pop-up-store/blob/master/images/pop-up.gif)
3+
![Pop-up](https://github.com/RedisTimeSeries/redis-pop-up-store/blob/master/images/pop-up-dashboard.png)
44

55
[![Grafana 8](https://img.shields.io/badge/Grafana-8-orange)](https://www.grafana.com)
66
[![Redis Data Source](https://img.shields.io/badge/dynamic/json?color=blue&label=Redis%20Data%20Source&query=%24.version&url=https%3A%2F%2Fgrafana.com%2Fapi%2Fplugins%2Fredis-datasource)](https://grafana.com/grafana/plugins/redis-datasource) [![Redis Application](https://img.shields.io/badge/dynamic/json?color=blue&label=Redis%20Application&query=%24.version&url=https%3A%2F%2Fgrafana.com%2Fapi%2Fplugins%2Fredis-app)](https://grafana.com/grafana/plugins/redis-app)
77

8-
The Pop-up store demo is using [Redis Streams](https://redis.io/topics/streams-intro), [RedisTimeSeries](https://oss.redis.com/redistimeseries/), [RedisGears](https://oss.redis.com/redisgears/) and [Redis plugins](https://redisgrafana.github.io) to visualize data pipeline in Grafana.
8+
The Pop-up store is using [Redis Streams](https://redis.io/topics/streams-intro), [RedisTimeSeries](https://oss.redis.com/redistimeseries/), [RedisGears](https://oss.redis.com/redisgears/) and [Redis plugins](https://redisgrafana.github.io) to visualize data pipeline in Grafana.
99

1010
## How it works
1111

@@ -51,39 +51,35 @@ gb.register(prefix='queue:orders', batch=3, trimStream=True)
5151

5252
- Grafana query streams and Time-Series keys every 5 seconds to display samples using Grafana plugins.
5353

54-
## What is displayed on Grafana dashboard
54+
## Demo
5555

56-
- `Product Available` - the value of `product` key
57-
- `Customers Ordering` - length of `queue:customers`
58-
- `Orders Processing` - length of `queue:orders`
59-
- `Orders Completed` - length of `queue:complete`
60-
- `Customers Overflow` - the difference between customer submitted orders and orders completed
61-
- `Customers Ordering` - change of `queue:customers` length
62-
- `Orders In Queue` - change of `queue:orders` length
63-
- `Completed Flow` - how many orders processed
56+
Demo is available on [demo.volkovlabs.io](https://demo.volkovlabs.io):
57+
58+
- [Redis Overview dashboard](https://demo.volkovlabs.io/d/TgibHBv7z/redis-overview?orgId=1&refresh=1h)
59+
- [Pop-up Store dashboard](https://demo.volkovlabs.io/d/0LC0Sm7Ml/pop-up-store?orgId=1)
6460

6561
## Requirements
6662

6763
- [Docker](https://docker.com) to start Redis and Grafana.
6864
- [Node.js](https://nodejs.org) to run simulation script.
6965

70-
## Start Redis with RedisTimeSeries and RedisGears modules installed and Grafana
66+
## Start Redis with RedisTimeSeries, RedisGears modules installed and Grafana
7167

7268
```
7369
npm run start
7470
```
7571

76-
## Register [StreamReaders](https://oss.redis.com/redisgears/readers.html#streamreader)
72+
## Register RedisGears functions
7773

7874
Install Readers to add Time-Series and complete orders
7975

8076
```
8177
npm run register
8278
```
8379

84-
## Install [ioredis](https://github.com/luin/ioredis) module and run simulation
80+
## Install [ioredis](https://github.com/luin/ioredis) module and start simulation
8581

86-
Script `pop-up-store.js` will add customers to stream `queue:customers` and their orders to `queue:orders`.
82+
Script `pop-up-store.js` will add customers to stream `queue:customers` and their orders to the `orders` keys.
8783

8884
```
8985
npm run simulation

gears-execute.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

gears/complete.py renamed to gears/orders.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ def complete(x):
55
execute('XDEL', 'queue:customers', x['value']['customer'])
66
execute('DECR', 'product')
77

8+
product = execute('GET', 'product')
9+
if int(product) < 1000:
10+
execute('SET', 'product', 10000)
11+
812

913
# Stream Reader for Orders queue
1014
gb = GearsBuilder('StreamReader')
1115
gb.map(complete)
12-
gb.register(prefix='queue:orders', batch=3, trimStream=True)
16+
gb.register(prefix='orders', batch=3, trimStream=True)

images/pop-up-dashboard.png

496 KB
Loading

images/pop-up.gif

-3.36 MB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "redis-pop-up-store",
1010
"scripts": {
1111
"redis-cli": "docker exec -it redis redis-cli",
12-
"register": "./gears-execute.sh && docker exec -it redis redis-cli RG.DUMPREGISTRATIONS",
12+
"register": "./register.sh && docker exec -it redis redis-cli RG.DUMPREGISTRATIONS",
1313
"simulation": "npm i; node src/pop-up-store.js",
1414
"start": "docker-compose pull && docker-compose up",
1515
"stop": "docker-compose down",

0 commit comments

Comments
 (0)