fluent-plugin-deis-graphite 0.1.1 → 0.1.2

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: 8d8cd4cf879ae865af6aad63ac00d9dfc74122f2
4
- data.tar.gz: 460161509c2dd785dffb47ce3517dcc6b2020f68
3
+ metadata.gz: bc8fbb6c8d97e3949db5e6232ece65ae8d624c46
4
+ data.tar.gz: 7e552cb88a1a2b260f9d01d9cd1204b135efc87d
5
5
  SHA512:
6
- metadata.gz: 81c85cf6691c130e76ebc8256db8c6ff429f2e69db8235d2261ba66987d52e2376c4abba696bf978c17abd850a27fca16293baaca19550d11e3faa93d23ebbe4
7
- data.tar.gz: e29352d72ead330a39c130a374e9a503b4c6cda8a16e9cab2795297ef8967a8d842a097184a39ae6628bbeb99d79fb844e641b655f902a230ee7572b3f352d93
6
+ metadata.gz: b59f20345aa1907c5fa1823cca9bda874e5901c59b07982ffa61e5f97c9dc976e1ad96150afd17772ed5717c4da16ab4dfbc9216bfeb2fbe345ea504a71cc311
7
+ data.tar.gz: 6efd5351c6643ae72f581a1cc9dee81108276684e366d66564005f22f9ce66e180a092942263cdbbdb7bfa3bb7f4fd4e5cba36f92b08a92dec4790d833b7b374
@@ -2,6 +2,7 @@ require 'fluent/output'
2
2
  require 'metriks'
3
3
  require 'metriks/reporter/graphite'
4
4
  require 'metriks/reporter/logger'
5
+ require 'unirest'
5
6
 
6
7
  module Fluent
7
8
  class DeisGraphiteOutput < Output
@@ -9,11 +10,23 @@ module Fluent
9
10
 
10
11
  @reporter = nil
11
12
  @logging_reporter = nil
13
+ @cluster_name="unknown_cluster"
12
14
  config_param :graphite_url, :string, :default => ''
13
15
  config_param :graphite_port, :integer, :default => 2003
14
16
  config_param :graphite_interval, :integer, :default => 10
15
17
 
16
18
  def initialize
19
+
20
+ #Get the cluster name from Google metadata service
21
+ begin
22
+ response = Unirest.get('http://metadata.google.internal/computeMetadata/v1/instance/attributes/cluster-name',headers:{ "Metadata-Flavor" => "Google"})
23
+ if response.code == 200
24
+ @cluster_name=response.body
25
+ end
26
+ rescue
27
+ p "Couldn't determine cluster name."
28
+ end
29
+
17
30
  super
18
31
  end
19
32
 
@@ -43,7 +56,7 @@ module Fluent
43
56
  #response_time = split_message[12].strip.to_f
44
57
  #request_time = split_message[13].strip.to_f
45
58
 
46
- Metriks.meter("response_rates.#{record["kubernetes"]["pod_name"]}.#{app}.#{status_code}").mark
59
+ Metriks.meter("response_rates.#{@cluster_name}.#{record["kubernetes"]["pod_name"]}.#{app}.#{status_code}").mark
47
60
  end
48
61
  end
49
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-deis-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Knox
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: unirest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement