Skip to content

Commit 87a0eb4

Browse files
committed
fixed param
1 parent 1f75b39 commit 87a0eb4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Where
7070
* `topic-name`: the Apache Kafka topic name to write to (the topic needs to be pre-created or `kafka.auto_create_topics_enable` parameter enabled)
7171
* `nr-messages`: the number of messages to send
7272
* `max-waiting-time`: the maximum waiting time in seconds between messages
73-
* `subject`: select amongst various subjects: `pizza` is the default one, but you can generate also `userbehaviour`, `bet`, `stock`, `realstock` (using the yahoo finance apis), `metric`, and `rolling`.
73+
* `subject`: select amongst various subjects: `pizza` is the default one, but you can generate also `userbehaviour`, `bet`, `stock`, `realstock` (using the yahoo finance apis), `metric`, `advancedmetric`, and `rolling`.
7474

7575
If successfully connected to a Apache Kafka cluster, the command will output a number of messages (`nr-messages` parameter) that are been sent to Apache Kafka in the form
7676

@@ -196,6 +196,15 @@ To customise your dataset, you can check Faker's providers in the [related doc](
196196
**Edit**:
197197
Now with the ``subject`` parameter you can start generating:
198198

199+
* fake `advancedmetric` data, for `100000` different hostname each having `30` different CPUs
200+
201+
```
202+
Sending: {'hostname': 'hostname30692', 'cpu': 'cpu9', 'usage': 76.83123942281046, 'occurred_at': 1675064924126}
203+
Sending: {'hostname': 'hostname49005', 'cpu': 'cpu4', 'usage': 76.29121084860914, 'occurred_at': 1675064924126}
204+
Sending: {'hostname': 'hostname65485', 'cpu': 'cpu23', 'usage': 98.6179112244911, 'occurred_at': 1675064924126}
205+
Sending: {'hostname': 'hostname58818', 'cpu': 'cpu15', 'usage': 87.8367169647086, 'occurred_at': 1675064924126}
206+
```
207+
199208
* fake `metric` data
200209

201210
```

metricadvancedproducer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
class MetricAdvancedProvider(BaseProvider):
1010
def hostname(self):
11-
return "hostname" + random.randint(0, NUMBER_HOSTS)
11+
return "hostname" + str(random.randint(0, NUMBER_HOSTS))
1212

1313
def cpu_id(self):
1414

15-
return "cpu" + random.randint(0, NUMBER_CPU)
15+
return "cpu" + str(random.randint(0, NUMBER_CPU))
1616

1717
def usage(self):
1818
return random.random() * 30 + 70

0 commit comments

Comments
 (0)