fluent-plugin-honeycomb 0.4.0 → 0.4.1
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 +2 -2
- data/fluent-plugin-honeycomb.gemspec +1 -2
- data/lib/fluent/plugin/out_honeycomb.rb +46 -33
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ab38aaf106e01ace1f186cf8622601bf94e0ca
|
4
|
+
data.tar.gz: 0f976da371561c9aac100a83c53c304435f8318d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b63188d32f34689f2a7de629b134c498d432bdda2a112c0eaba972d37889c3e165e4f25abcbc5ba0b074a1f39a9d70f185a5712b20c47695c7f5d08350cbc0
|
7
|
+
data.tar.gz: 7f69ca94ab060668c786697bf5da4a989061e13b6e3dec0bedcf031af0041bfc7845069a8b2864c2a8d6a1b5ef683f3f1fc984d45679fb2260c3f0eac146fcf9
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[](https://travis-ci.org/honeycombio/fluent-plugin-honeycomb)
|
2
2
|
|
3
|
-
Send your logs to [Honeycomb](https://honeycomb.io).
|
3
|
+
Send your logs to [Honeycomb](https://honeycomb.io). (For more information about using Honeycomb, see [our docs](https://honeycomb.io/docs/).)
|
4
4
|
|
5
5
|
## Getting started
|
6
6
|
|
@@ -58,5 +58,5 @@ Travis will automatically upload tagged releases to Rubygems. To release a new
|
|
58
58
|
version, run
|
59
59
|
```
|
60
60
|
bump patch --tag # Or bump minor --tag, etc.
|
61
|
-
git push --tags
|
61
|
+
git push --follow-tags
|
62
62
|
```
|
@@ -1,7 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'fluent-plugin-honeycomb'
|
3
|
-
spec.version = '0.4.
|
4
|
-
spec.date = '2017-02-07'
|
3
|
+
spec.version = '0.4.1'
|
5
4
|
|
6
5
|
spec.summary = "Fluentd output plugin for Honeycomb.io"
|
7
6
|
spec.description = "Fluentd output plugin for Honeycomb.io"
|
@@ -22,10 +22,13 @@ module Fluent
|
|
22
22
|
# 'conf' is a Hash that includes configuration parameters.
|
23
23
|
# If the configuration is invalid, raise Fluent::ConfigError.
|
24
24
|
def configure(conf)
|
25
|
+
# Apply sane defaults. These override the poor fluentd defaults, but not
|
26
|
+
# anything explicitly specified in the configuration.
|
27
|
+
conf["buffer_chunk_limit"] ||= "500k"
|
28
|
+
conf["flush_interval"] ||= "1s"
|
29
|
+
conf["max_retry_wait"] ||= "30s"
|
30
|
+
conf["retry_limit"] ||= 17
|
25
31
|
super
|
26
|
-
|
27
|
-
# You can also refer raw parameter via conf[name].
|
28
|
-
@path = conf['path']
|
29
32
|
end
|
30
33
|
|
31
34
|
# This method is called when starting.
|
@@ -76,59 +79,69 @@ module Fluent
|
|
76
79
|
})
|
77
80
|
end
|
78
81
|
|
82
|
+
publish_batch(batch, 0)
|
83
|
+
end
|
84
|
+
|
85
|
+
def publish_batch(batch, retry_count)
|
79
86
|
if batch.length == 0
|
80
87
|
return
|
81
88
|
end
|
82
89
|
log.info "publishing #{batch.length} records"
|
83
|
-
body = JSON.dump(
|
90
|
+
body = JSON.dump(batch)
|
84
91
|
resp = HTTP.headers(
|
85
92
|
"User-Agent" => "fluent-plugin-honeycomb",
|
86
93
|
"Content-Type" => "application/json",
|
87
94
|
"X-Honeycomb-Team" => @writekey)
|
88
|
-
.post(URI.join(@api_host, "/1/batch"), {
|
95
|
+
.post(URI.join(@api_host, "/1/batch/#{@dataset}"), {
|
89
96
|
:body => body,
|
90
97
|
})
|
91
|
-
parse_response(resp)
|
98
|
+
failures = parse_response(batch, resp)
|
99
|
+
if failures.size > 0 && retry_count < @retry_limit
|
100
|
+
# sleep and retry with the set of failed events
|
101
|
+
sleep 1
|
102
|
+
publish_batch(failures, retry_count + 1)
|
103
|
+
end
|
92
104
|
end
|
93
105
|
|
94
|
-
def parse_response(resp)
|
106
|
+
def parse_response(batch, resp)
|
95
107
|
if resp.status != 200
|
96
108
|
# Force retry
|
97
109
|
log.error "Error sending batch: #{resp.status}, #{resp.body}"
|
98
110
|
raise Exception.new("Error sending batch: #{resp.status}, #{resp.body}")
|
99
|
-
|
100
|
-
begin
|
101
|
-
results = JSON.parse(resp.body)
|
102
|
-
rescue JSON::ParserError => e
|
103
|
-
log.warn "Error parsing response as JSON: #{e}"
|
104
|
-
return
|
105
|
-
end
|
106
|
-
successes = 0
|
107
|
-
failures = []
|
108
|
-
results.each do |key, statuses|
|
109
|
-
if !statuses.is_a? Array
|
110
|
-
next
|
111
|
-
end
|
111
|
+
end
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
begin
|
114
|
+
results = JSON.parse(resp.body)
|
115
|
+
rescue JSON::ParserError => e
|
116
|
+
log.warn "Error parsing response as JSON: #{e}"
|
117
|
+
raise e
|
118
|
+
end
|
119
|
+
successes = 0
|
120
|
+
failures = []
|
121
|
+
if !results.is_a? Array
|
122
|
+
log.warning "Unexpected response format: #{results}"
|
123
|
+
raise Exception.new("Unexpected response format: #{resp.status}")
|
124
|
+
end
|
117
125
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
123
|
-
end
|
126
|
+
results.each_with_index do |result, idx|
|
127
|
+
if !result.is_a? Hash
|
128
|
+
log.warning "Unexpected status format in response: #{result}"
|
129
|
+
next
|
124
130
|
end
|
125
131
|
|
126
|
-
if
|
127
|
-
|
132
|
+
if result["status"] == 202
|
133
|
+
successes += 1
|
128
134
|
else
|
129
|
-
|
135
|
+
failures.push(batch[idx])
|
130
136
|
end
|
131
137
|
end
|
138
|
+
|
139
|
+
if failures.size > 0
|
140
|
+
log.warn "Errors publishing records: #{failures.size} failures out of #{successes + failures.size}"
|
141
|
+
else
|
142
|
+
log.debug "Successfully published #{successes} records"
|
143
|
+
end
|
144
|
+
return failures
|
132
145
|
end
|
133
146
|
|
134
147
|
def flatten(record, prefix)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-honeycomb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Honeycomb.io Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|