fluent-plugin-honeycomb 0.1.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 +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/README.md +52 -0
- data/Rakefile +10 -0
- data/fluent-plugin-honeycomb.gemspec +28 -0
- data/lib/fluent/plugin/out_honeycomb.rb +67 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 694235673dc407b31637ece8465a3d29d751a4a7
|
4
|
+
data.tar.gz: 2f1418e09051f5943099aa544a5b34ef67482c44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 50c888610e2a75b816a260f00e7d328e1229a1ba85d12ffe73ee6c3b8029ab0e64984f44e6f5e2e1e3f7f67811e1b601eb811a9cfb50d4148ff65bd70dfcdef9
|
7
|
+
data.tar.gz: 8292d2a3f871f44014e95dd6b9d884569ecde0002d2271747edad121a1cdc0c9219f2cc49e5a0dd27e2fb67accb2698facb3249a50afc23b3f68399415fc3e00
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2017 Honeycomb
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
|
2
|
+
## Getting started
|
3
|
+
|
4
|
+
1. Install this plugin with `gem install fluent-plugin-honeycomb`
|
5
|
+
|
6
|
+
2. Edit your `fluentd.conf` configuration file. A minimal configuration looks like this:
|
7
|
+
|
8
|
+
```
|
9
|
+
<match your_match>
|
10
|
+
@type honeycomb
|
11
|
+
writekey "YOUR_WRITEKEY"
|
12
|
+
dataset "fluentd_test_dataset"
|
13
|
+
</match>
|
14
|
+
```
|
15
|
+
|
16
|
+
## Configuration
|
17
|
+
|
18
|
+
### Basic options
|
19
|
+
|
20
|
+
Parameter | Type | Required? | Description
|
21
|
+
| --- | --- | --- | --- |
|
22
|
+
| `writekey` | string | yes | Your Honeycomb write key. |
|
23
|
+
| `dataset` | string | yes | The name of the destination dataset in your Honeycomb account. |
|
24
|
+
| `sample_rate` | integer | no | Sample your event stream by sending 1 out of every N events. |
|
25
|
+
| `include_tag_key` | bool | no | Whether to include the Fluentd tag in the submitted event. |
|
26
|
+
| `tag_key` | string | no | If `include_tag_key` is `true`, the tag key name in the event (default: `fluentd_tag`).
|
27
|
+
|
28
|
+
### Buffering options
|
29
|
+
|
30
|
+
`fluent-plugin-honeycomb` supports the [standard configuration options](http://docs.fluentd.org/v0.12/articles/buffer-plugin-overview) for buffered output plugins.
|
31
|
+
|
32
|
+
## Limitations
|
33
|
+
|
34
|
+
`fluent-plugin-honeycomb` does not currently batch events. This functionality should be implemented in `libhoney-rb`.
|
35
|
+
|
36
|
+
## Development
|
37
|
+
I recommend using [rbenv](https://github.com/rbenv/rbenv) for development.
|
38
|
+
|
39
|
+
To set up Fluentd, run:
|
40
|
+
|
41
|
+
```
|
42
|
+
gem install fluentd
|
43
|
+
fluentd --setup ./fluent
|
44
|
+
```
|
45
|
+
|
46
|
+
Edit the configuration file at `./fluent/fluent.conf`, then run
|
47
|
+
|
48
|
+
```
|
49
|
+
fluentd -c ./fluent/fluent.conf -v
|
50
|
+
```
|
51
|
+
|
52
|
+
A note about naming: This gem must be named `fluent-plugin-xxx` in order to automatically be included in Fluentd's plugin list. See http://www.fluentd.org/faqs.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'fluent-plugin-honeycomb'
|
3
|
+
spec.version = '0.1.1'
|
4
|
+
spec.date = '2017-02-07'
|
5
|
+
|
6
|
+
spec.summary = "send data to Honeycomb"
|
7
|
+
spec.description = "Ruby gem for sending data to Honeycomb"
|
8
|
+
spec.authors = ['The Honeycomb.io Team']
|
9
|
+
spec.email = 'support@honeycomb.io'
|
10
|
+
spec.files = []
|
11
|
+
spec.homepage = 'https://github.com/honeycombio/fluent-plugin-honeycomb'
|
12
|
+
spec.license = 'Apache-2.0'
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
15
|
+
f.match(%r{^(test|spec|features)/})
|
16
|
+
end
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.required_ruby_version = '>= 2.2.0'
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "libhoney", "~> 1.0"
|
22
|
+
spec.add_runtime_dependency "fluentd", "~> 0.12"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "webmock", "~> 2.1"
|
27
|
+
spec.add_development_dependency "test-unit"
|
28
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'fluent/output'
|
2
|
+
require 'libhoney'
|
3
|
+
|
4
|
+
module Fluent
|
5
|
+
class HoneycombOutput < BufferedOutput
|
6
|
+
# First, register the plugin. NAME is the name of this plugin
|
7
|
+
# and identifies the plugin in the configuration file.
|
8
|
+
Fluent::Plugin.register_output('honeycomb', self)
|
9
|
+
|
10
|
+
# config_param defines a parameter. You can refer a parameter via @path instance variable
|
11
|
+
# Without :default, a parameter is required.
|
12
|
+
config_param :writekey, :string
|
13
|
+
config_param :dataset, :string
|
14
|
+
config_param :sample_rate, :integer, :default => 1
|
15
|
+
config_param :include_tag_key, :bool, :default => false
|
16
|
+
config_param :tag_key, :string, :default => "fluentd_tag"
|
17
|
+
config_param :api_host, :string, :default => "https://api.honeycomb.io"
|
18
|
+
|
19
|
+
# This method is called before starting.
|
20
|
+
# 'conf' is a Hash that includes configuration parameters.
|
21
|
+
# If the configuration is invalid, raise Fluent::ConfigError.
|
22
|
+
def configure(conf)
|
23
|
+
super
|
24
|
+
|
25
|
+
# You can also refer raw parameter via conf[name].
|
26
|
+
@path = conf['path']
|
27
|
+
end
|
28
|
+
|
29
|
+
# This method is called when starting.
|
30
|
+
# Open sockets or files here.
|
31
|
+
def start
|
32
|
+
super
|
33
|
+
@client = Libhoney::Client.new(:writekey => @writekey,
|
34
|
+
:dataset => @dataset,
|
35
|
+
:sample_rate => @sample_rate,
|
36
|
+
:api_host => @api_host)
|
37
|
+
end
|
38
|
+
|
39
|
+
# This method is called when shutting down.
|
40
|
+
# Shutdown the thread and close sockets or files here.
|
41
|
+
def shutdown
|
42
|
+
super
|
43
|
+
# Drain libhoney request queue before shutting down.
|
44
|
+
@client.close(true)
|
45
|
+
end
|
46
|
+
|
47
|
+
def format(tag, time, record)
|
48
|
+
[tag, time, record].to_msgpack
|
49
|
+
end
|
50
|
+
|
51
|
+
# This method is called every flush interval. Write the buffer chunk
|
52
|
+
# to files or databases here.
|
53
|
+
# 'chunk' is a buffer chunk that includes multiple formatted
|
54
|
+
# events. You can use 'data = chunk.read' to get all events and
|
55
|
+
# 'chunk.open {|io| ... }' to get IO objects.
|
56
|
+
#
|
57
|
+
# NOTE! This method is called by internal thread, not Fluentd's main thread. So IO wait doesn't affect other plugins.
|
58
|
+
def write(chunk)
|
59
|
+
chunk.msgpack_each do |(tag, time, record)|
|
60
|
+
if @include_tag_key
|
61
|
+
record[@tag_key] = tag
|
62
|
+
end
|
63
|
+
@client.send_now(record)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-honeycomb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Honeycomb.io Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: libhoney
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fluentd
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.12'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: test-unit
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Ruby gem for sending data to Honeycomb
|
98
|
+
email: support@honeycomb.io
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ".gitignore"
|
104
|
+
- ".travis.yml"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- fluent-plugin-honeycomb.gemspec
|
110
|
+
- lib/fluent/plugin/out_honeycomb.rb
|
111
|
+
homepage: https://github.com/honeycombio/fluent-plugin-honeycomb
|
112
|
+
licenses:
|
113
|
+
- Apache-2.0
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 2.2.0
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.5
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: send data to Honeycomb
|
135
|
+
test_files: []
|