reqsample 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/reqsample/generator.rb +9 -9
- data/lib/reqsample/version.rb +1 -1
- data/screenshot.png +0 -0
- data/spec/lib/reqsample/generator_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6904a9d1e327322cc54dc86b1f82a7884c4892f3
|
4
|
+
data.tar.gz: 1f8d0cf747f60b9ee1d78611c3acc438d4f21353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62130bd76c70331f59b88479c7972d2b49aafc81430ba472f05ebb97124922a8416ecaacff4fcf0e2c1504f1a77865e9aaa91396449d200d535ac3181f1286ce
|
7
|
+
data.tar.gz: 3f7cdafda5e1bebac1fa72ebb5ffef7d16458689cbb577c8927ccd41d7ae18dbbbcf80f18c3818c9efe6d5ffc8d4f5449dab3e3ff15b215b573ea92bddd43c10
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
* [Homepage](https://rubygems.org/gems/reqsample)
|
4
4
|
* [Documentation](http://rubydoc.info/gems/reqsample/frames)
|
5
5
|
|
6
|
+
![Example Screenshot](./screenshot.png)
|
7
|
+
|
6
8
|
## Description
|
7
9
|
|
8
10
|
`reqsample` is a utility to generate somewhat-realistic public HTTP traffic. If you've ever needed a large corpus of Apache or nginx logs to test geoip processing, a Logstash pipeline, or as the source for a demo; this utility is for you.
|
@@ -63,7 +65,7 @@ The `produce` method is the central way to generate log values:
|
|
63
65
|
gen.produce
|
64
66
|
```
|
65
67
|
|
66
|
-
Will return an array of logs with the previously mentioned parameters. If a block is given to the `produce` method, the results will instead be streamed to the block by yielding each log event
|
68
|
+
Will return an array of logs with the previously mentioned parameters. If a block is given to the `produce` method, the results will instead be streamed to the block by yielding each log event.
|
67
69
|
|
68
70
|
## Install
|
69
71
|
|
data/lib/reqsample/generator.rb
CHANGED
@@ -47,6 +47,8 @@ module ReqSample
|
|
47
47
|
# @option opts [Integer] :count how many logs to generate
|
48
48
|
# @option opts [String] :format form to return logs, :apache or :hash
|
49
49
|
# @option opts [Time] :peak normal distribution peak for log timestamps
|
50
|
+
# @option opts [Boolean] :sleep whether or not to "realistically" sleep
|
51
|
+
# between emitting logs.
|
50
52
|
# @option opts [Integer] :truncate hard limit to keep log range within
|
51
53
|
#
|
52
54
|
# @return [Array<String, Hash>] the collection of generated log events
|
@@ -54,17 +56,15 @@ module ReqSample
|
|
54
56
|
opts[:count] ||= DEFAULT_COUNT
|
55
57
|
opts[:format] ||= DEFAULT_FORMAT
|
56
58
|
opts[:peak] ||= Time.now - (12 * 60 * 60)
|
59
|
+
opts[:sleep] ||= false
|
57
60
|
opts[:truncate] ||= 12
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
sample time, opts[:format]
|
67
|
-
end
|
62
|
+
return to_enum(:produce, opts) unless block_given?
|
63
|
+
|
64
|
+
opts[:count].times do
|
65
|
+
time = sample_time opts[:peak], opts[:truncate]
|
66
|
+
if opts[:sleep] and (delay = time - Time.now) > 0 then sleep delay end
|
67
|
+
yield sample time, opts[:format]
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
data/lib/reqsample/version.rb
CHANGED
data/screenshot.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reqsample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Langlois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/reqsample/time.rb
|
221
221
|
- lib/reqsample/version.rb
|
222
222
|
- reqsample.gemspec
|
223
|
+
- screenshot.png
|
223
224
|
- spec/lib/reqsample/generator_spec.rb
|
224
225
|
- spec/lib/reqsample/version_spec.rb
|
225
226
|
- spec/lib/reqsample_spec.rb
|