fluent-plugin-newrelic 0.2.7 → 0.2.8
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/lib/fluent/plugin/out_newrelic.rb +6 -30
- data/lib/newrelic-fluentd-output/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87b63e728e6200ed540cd79312f282f37e61cae7a6882431f27cc88e193dbaf8
|
4
|
+
data.tar.gz: 2a14f80ae306fc788cedfd9e7ca5e0bea336689e2f7b1be03ce6795776322db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5278a2cc7cebd0fe819192efcb401a4c2c420ab652bf4f7bccfc2db872c85bb0758027185b073fb21e96cbe98bcfcac163964f6b00a2a879a6bdee1864908f6c
|
7
|
+
data.tar.gz: d6bc99a34a7f632862a68a13fdcefbca68cf279dfc7f13dd04adce27c51274a8311b694ec506832b3c35f02095fdbacdb4a499f086707248552c65ec9f61f2e3
|
@@ -17,7 +17,6 @@ require 'fluent/plugin/output'
|
|
17
17
|
require 'net/http'
|
18
18
|
require 'uri'
|
19
19
|
require 'zlib'
|
20
|
-
require 'json'
|
21
20
|
require 'newrelic-fluentd-output/version'
|
22
21
|
|
23
22
|
module Fluent
|
@@ -65,21 +64,16 @@ module Fluent
|
|
65
64
|
def package_record(record, timestamp)
|
66
65
|
packaged = {
|
67
66
|
'timestamp' => timestamp,
|
68
|
-
'attributes'
|
67
|
+
# non-intrinsic attributes get put into 'attributes'
|
68
|
+
'attributes' => record
|
69
69
|
}
|
70
70
|
|
71
|
+
# intrinsic attributes go at the top level
|
71
72
|
if record.has_key?('message')
|
72
|
-
message = record['message']
|
73
|
-
packaged['attributes']
|
74
|
-
end
|
75
|
-
|
76
|
-
record.each do |key, value|
|
77
|
-
if key == 'message'
|
78
|
-
packaged['message'] = record['message']
|
79
|
-
else
|
80
|
-
packaged['attributes'][key] = record[key]
|
81
|
-
end
|
73
|
+
packaged['message'] = record['message']
|
74
|
+
packaged['attributes'].delete('message')
|
82
75
|
end
|
76
|
+
|
83
77
|
packaged
|
84
78
|
end
|
85
79
|
|
@@ -144,24 +138,6 @@ module Fluent
|
|
144
138
|
http.request(request)
|
145
139
|
end
|
146
140
|
|
147
|
-
def maybe_parse_message_json(record)
|
148
|
-
if record.has_key?('message')
|
149
|
-
message = record['message']
|
150
|
-
record = record.merge(maybe_parse_json(message))
|
151
|
-
end
|
152
|
-
record
|
153
|
-
end
|
154
|
-
|
155
|
-
def maybe_parse_json(message)
|
156
|
-
begin
|
157
|
-
parsed = JSON.parse(message)
|
158
|
-
if Hash === parsed
|
159
|
-
return parsed
|
160
|
-
end
|
161
|
-
rescue JSON::ParserError
|
162
|
-
end
|
163
|
-
return {}
|
164
|
-
end
|
165
141
|
end
|
166
142
|
end
|
167
143
|
end
|