fluent-plugin-google-cloud 0.4.3 → 0.4.4
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.
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ eos
|
|
10
10
|
gem.homepage = \
|
11
11
|
'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
|
12
12
|
gem.license = 'Apache 2.0'
|
13
|
-
gem.version = '0.4.
|
13
|
+
gem.version = '0.4.4'
|
14
14
|
gem.authors = ['Todd Derr', 'Alex Robinson']
|
15
15
|
gem.email = ['salty@google.com']
|
16
16
|
|
@@ -302,10 +302,10 @@ module Fluent
|
|
302
302
|
unless label_map.nil?
|
303
303
|
labels = {}
|
304
304
|
@label_map.each do |field, label|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
305
|
+
next unless record.key?(field)
|
306
|
+
# label values are required to be strings.
|
307
|
+
labels[label] = record[field].to_s
|
308
|
+
record.delete(field)
|
309
309
|
end
|
310
310
|
entry['metadata']['labels'] = labels unless labels.empty?
|
311
311
|
end
|
@@ -497,7 +497,7 @@ module Fluent
|
|
497
497
|
def init_api_client
|
498
498
|
@client = Google::APIClient.new(
|
499
499
|
application_name: 'Fluentd Google Cloud Logging plugin',
|
500
|
-
application_version: '0.4.
|
500
|
+
application_version: '0.4.4',
|
501
501
|
retries: 1)
|
502
502
|
|
503
503
|
if @auth_method == 'private_key'
|
@@ -537,6 +537,35 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
|
|
537
537
|
verify_log_entries(1, params)
|
538
538
|
end
|
539
539
|
|
540
|
+
def test_label_map_with_numeric_field
|
541
|
+
setup_gce_metadata_stubs
|
542
|
+
setup_logging_stubs
|
543
|
+
config = %(label_map { "label_field": "sent_label" })
|
544
|
+
d = create_driver(config)
|
545
|
+
d.emit('message' => log_entry(0), 'label_field' => 123_456_789)
|
546
|
+
d.run
|
547
|
+
# make a deep copy of COMPUTE_PARAMS and add the parsed label.
|
548
|
+
params = Marshal.load(Marshal.dump(COMPUTE_PARAMS))
|
549
|
+
params['labels']['sent_label'] = '123456789'
|
550
|
+
verify_log_entries(1, params)
|
551
|
+
end
|
552
|
+
|
553
|
+
def test_label_map_with_hash_field
|
554
|
+
setup_gce_metadata_stubs
|
555
|
+
setup_logging_stubs
|
556
|
+
config = %(label_map { "label_field": "sent_label" })
|
557
|
+
d = create_driver(config)
|
558
|
+
# I'm not sure this actually makes sense for a user to do, but make
|
559
|
+
# sure that it works if they try it.
|
560
|
+
d.emit('message' => log_entry(0),
|
561
|
+
'label_field' => { 'k1' => 10, 'k2' => 'val' })
|
562
|
+
d.run
|
563
|
+
# make a deep copy of COMPUTE_PARAMS and add the parsed label.
|
564
|
+
params = Marshal.load(Marshal.dump(COMPUTE_PARAMS))
|
565
|
+
params['labels']['sent_label'] = '{"k1"=>10, "k2"=>"val"}'
|
566
|
+
verify_log_entries(1, params)
|
567
|
+
end
|
568
|
+
|
540
569
|
def test_label_map_with_multiple_fields
|
541
570
|
setup_gce_metadata_stubs
|
542
571
|
setup_logging_stubs
|
@@ -874,6 +903,8 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
|
|
874
903
|
all_labels ||= common_labels
|
875
904
|
all_labels.merge!(entry['metadata']['labels'] || {})
|
876
905
|
all_labels.each do |key, value|
|
906
|
+
assert value.is_a?(String), "Value #{value} for label #{key} " \
|
907
|
+
'is not a string: ' + value.class.name
|
877
908
|
assert expected_labels.key?(key), "Unexpected label #{key} => #{value}"
|
878
909
|
assert_equal value, expected_labels[key], 'Value mismatch - expected ' \
|
879
910
|
"#{expected_labels[key]} in #{key} => #{value}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-google-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|