fluent-plugin-application-insights 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16cd7a0fed351fcf6f1c5c9030454658ea2bb1e6
|
4
|
+
data.tar.gz: '08af822420fb65b336283d29cd4fb23800aa3b10'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ff2242c21c5be630d7a10e15e406e9f517856261be253fa055fcd02dc66674b0f4d42882676d0612f17fef820612fccc5a22f2507675b6e68122c047b64071
|
7
|
+
data.tar.gz: e0933edfcbd3ff4f4c56185a166f506ddf47e7e74d107acb3f72051484f18546f2c943c8f0242e42b6af05232d1e4b3b04b536147a79d06522baab8f89f75f38
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-application-insights"
|
6
|
-
spec.version = "0.2.
|
6
|
+
spec.version = "0.2.1"
|
7
7
|
spec.authors = ["Microsoft Corporation"]
|
8
8
|
spec.email = ["ctdiagcore@microsoft.com"]
|
9
9
|
|
@@ -123,9 +123,13 @@ module Fluent::Plugin
|
|
123
123
|
|
124
124
|
envelope = Channel::Contracts::Envelope.new
|
125
125
|
Channel::Contracts::Envelope.json_mappings.each do |attr, name|
|
126
|
-
|
126
|
+
property = record.delete(name)
|
127
|
+
envelope.send(:"#{attr}=", property) if property
|
127
128
|
end
|
128
129
|
|
130
|
+
# There could be extra properties added during the fluentd pipeline. Merge the extra properties so they are not lost.
|
131
|
+
merge_extra_properties_standard_schema record, envelope
|
132
|
+
|
129
133
|
@tc.channel.queue.push(envelope)
|
130
134
|
else
|
131
135
|
log.warn "Unknown telemetry type #{base_type}. Event will be treated as as non standard schema event."
|
@@ -147,6 +151,14 @@ module Fluent::Plugin
|
|
147
151
|
end
|
148
152
|
end
|
149
153
|
|
154
|
+
def merge_extra_properties_standard_schema(record, envelope)
|
155
|
+
return if record.empty?
|
156
|
+
|
157
|
+
envelope.data["baseData"]["properties"] ||= {}
|
158
|
+
envelope.data["baseData"]["properties"].merge!(record)
|
159
|
+
stringify_properties(envelope.data["baseData"]["properties"])
|
160
|
+
end
|
161
|
+
|
150
162
|
def process_non_standard_schema_log(record, time)
|
151
163
|
time = record.delete(@time_property) || time
|
152
164
|
context = get_context_non_standard_schema(record)
|
@@ -83,6 +83,15 @@ class ApplicationInsightsOutputTest < Test::Unit::TestCase
|
|
83
83
|
assert_true logs.all?{ |log| log.include?("Unknown telemetry type unknown") }
|
84
84
|
end
|
85
85
|
|
86
|
+
test 'extra properties are not lost after processing' do
|
87
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
88
|
+
@d.run(default_tag: 'test', shutdown: false) do
|
89
|
+
@d.feed(time, {"name" => "telemetry name", "data" => { "baseType" => "RequestData", "baseData" => {} }, "kubernetes" => { "pod_name" => "frontend" }})
|
90
|
+
end
|
91
|
+
|
92
|
+
envelope = @d.instance.tc.channel.queue[0]
|
93
|
+
assert_equal({ "kubernetes" => "{\"pod_name\":\"frontend\"}" }, envelope.data["baseData"]["properties"])
|
94
|
+
end
|
86
95
|
end
|
87
96
|
|
88
97
|
sub_test_case 'set context on standard schema event' do
|
@@ -149,8 +158,12 @@ class ApplicationInsightsOutputTest < Test::Unit::TestCase
|
|
149
158
|
envelope = d.instance.tc.channel.queue[0]
|
150
159
|
assert_not_nil envelope.tags
|
151
160
|
assert_equal "frontend", envelope.tags["ai.cloud.role"]
|
152
|
-
|
153
|
-
|
161
|
+
|
162
|
+
extra_properties = {
|
163
|
+
"kubernetes_container_name" => "frontend",
|
164
|
+
"other_prop" => "prop value"
|
165
|
+
}
|
166
|
+
assert_equal extra_properties, envelope.data["baseData"]["properties"]
|
154
167
|
end
|
155
168
|
|
156
169
|
test 'context tag source is nested property path' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-application-insights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.6.14.1
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: This is the fluentd output plugin for Azure Application Insights.
|