fluent-plugin-time-sampling 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -5
- data/fluent-plugin-time-sampling.gemspec +2 -2
- data/lib/fluent/plugin/filter_time_sampling.rb +7 -8
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e27fd7c88ad8400f4aecf81704ca0135b077fa8
|
4
|
+
data.tar.gz: 1d1abcdce48e0c6502654a2be6518f64377e6946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ad3bc857f5bc464d055a4d17d23107f1061ef95802ccbcc00eb7590aaf16bcf77cc11ca1dee13b41ba6611e7315e205322ba7dc370cbadea337ae2793a81ef4
|
7
|
+
data.tar.gz: f26d6a494bfa861b1bb95683b6e36ebd2ce2526edfc4d563f7a37808838ee51f34f4b6d2fd30792d7455c0623d87edf5ad9c52b71efc8fddcb68423812fa8d9e
|
data/README.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# fluent-plugin-time-sampling
|
2
2
|
|
3
|
+
## Requirements
|
4
|
+
|
5
|
+
| fluent-plugin-time-sampling | fluentd |
|
6
|
+
|-----------------------------|------------|
|
7
|
+
| >= 1.0.0 | >= v0.14.0 |
|
8
|
+
| < 1.0.0 | < v0.14.0 |
|
9
|
+
|
3
10
|
## Installation
|
4
11
|
```
|
5
12
|
gem install fluent-plugin-time-sampling
|
@@ -18,15 +25,17 @@ Example:
|
|
18
25
|
|
19
26
|
Assume following input in 10 seconds:
|
20
27
|
```
|
21
|
-
|
22
|
-
|
23
|
-
|
28
|
+
test.tag { "hostname": "host1", "sample_key1": "foo", "sample_key2": "aaa" }
|
29
|
+
test.tag { "hostname": "host1", "sample_key1": "foo", "sample_key2": "bbb" }
|
30
|
+
test.tag { "hostname": "host2", "sample_key1": "bar", "sample_key2": "ccc" }
|
31
|
+
test.tag { "hostname": "host2", "sample_key1": "baz", "sample_key2": "ddd" }
|
24
32
|
```
|
25
33
|
|
26
34
|
then output is below:
|
27
35
|
```
|
28
|
-
|
29
|
-
|
36
|
+
test.tag { "hostname": "host1", "sample_key2": "aaa" }
|
37
|
+
test.tag { "hostname": "host2", "sample_key2": "ccc" }
|
38
|
+
test.tag { "hostname": "host2", "sample_key2": "ddd" }
|
30
39
|
```
|
31
40
|
|
32
41
|
## Configuration
|
@@ -4,10 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-time-sampling"
|
7
|
-
gem.version = "0.1.
|
7
|
+
gem.version = "0.1.2"
|
8
8
|
gem.authors = ["Yuki Kuwabara"]
|
9
9
|
gem.email = ["eramuk@gmail.com"]
|
10
|
-
gem.summary = "
|
10
|
+
gem.summary = "Fluentd filter plugin to sampling from tag and keys at time interval"
|
11
11
|
gem.description = gem.summary
|
12
12
|
gem.homepage = "https://github.com/eramuk/fluent-plugin-time-sampling"
|
13
13
|
gem.licenses = ["MIT"]
|
@@ -15,10 +15,9 @@ module Fluent
|
|
15
15
|
def configure(conf)
|
16
16
|
super
|
17
17
|
@cache = {}
|
18
|
-
@
|
18
|
+
@cache_clear_lasttime = Time.now
|
19
|
+
@cache_clear_interval = @interval * 2
|
19
20
|
@interval = -1 if @interval.zero?
|
20
|
-
@unused_cache_clear_interval = 300
|
21
|
-
@unused_cache_clear_time = Time.now
|
22
21
|
end
|
23
22
|
|
24
23
|
def start
|
@@ -49,9 +48,9 @@ module Fluent
|
|
49
48
|
record.dup : record.select { |k, v| @keep_keys.include?(k) }
|
50
49
|
end
|
51
50
|
|
52
|
-
if Time.now > @
|
53
|
-
|
54
|
-
@
|
51
|
+
if Time.now > @cache_clear_lasttime + @cache_clear_interval
|
52
|
+
clear_cache
|
53
|
+
@cache_clear_lasttime = Time.now
|
55
54
|
end
|
56
55
|
|
57
56
|
new_record ||= nil
|
@@ -70,9 +69,9 @@ module Fluent
|
|
70
69
|
end
|
71
70
|
end
|
72
71
|
|
73
|
-
def
|
72
|
+
def clear_cache
|
74
73
|
@cache.each_key do |key|
|
75
|
-
expired = Time.now > @cache[key][:time]
|
74
|
+
expired = Time.now > @cache[key][:time]
|
76
75
|
@cache.delete(key) if expired
|
77
76
|
end
|
78
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-time-sampling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description: Fluentd filter plugin to sampling from tag and keys at time interval
|
56
56
|
email:
|
57
57
|
- eramuk@gmail.com
|
58
58
|
executables: []
|
@@ -87,10 +87,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.2.5
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
|
-
summary:
|
93
|
+
summary: Fluentd filter plugin to sampling from tag and keys at time interval
|
94
94
|
test_files:
|
95
95
|
- test/helper.rb
|
96
96
|
- test/plugin/test_filter_time_sampling.rb
|