fluent-plugin-coralogix 1.0.4 → 1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 1ce2acecdd79fb16064e42482203fecf190d0e85909b08059b6fd79c001e38fb
4
- data.tar.gz: 8443396fbcb5ac930e899878410e447c782a12c556fc1df19b0864f2fd31ddb8
2
+ SHA1:
3
+ metadata.gz: 5e77fbb9d9a357eb434d590d1167828178a969ba
4
+ data.tar.gz: 49e351ca9176671c19cd69e34bb1e3772fbd50ff
5
5
  SHA512:
6
- metadata.gz: d0423e9052c876066007afc1137ed0ce103ef86120ac4a7bbdb3b2cd5d91db59c70c3d9d4fffc818b5ca9b9a4711fed288fbe19c9604ee5416408abe8e5c5d54
7
- data.tar.gz: 5acf5d83bb67a338fc4bc8845515344d5f923a8bbe5c980a6f2093388befecadcf37229be15639b449622bf0722d871c18bc4d158da809ee7e4be17887cc85ba
6
+ metadata.gz: 0c2e97519cdd278439fffc6a44e554e9499f2a7526033e75747b1e6a81a40c7489148f07d0417ae630cda9158e9db9b23bb4e7c711c00d2716b3e90347433455
7
+ data.tar.gz: 7bc70fe0c4d0aa9b9b2197ce3ddc8d4ed049e2761decbd7403b5519eca314b48ec4d962c743cd2ccd6ef5a3a55b80c064897c74f331d0fec3f445ffb44aff7b4
@@ -22,29 +22,38 @@ module Fluent
22
22
  config_param :is_json, :bool, :default => false
23
23
  config_param :force_compression, :bool, :default => false
24
24
  config_param :debug, :bool, :default => false
25
+ config_param :number_of_workers, :integer, :default => 1
25
26
  config_section :proxy, :param_name => "proxy", required: false, multi: false do
26
27
  config_param :host, :string
27
28
  config_param :port, :integer
28
29
  config_param :user, :string, :default => nil
29
30
  config_param :password, :string, :default => nil, secret: true
30
31
  end
31
- @configured = false
32
32
 
33
33
  # This method is called before starting.
34
34
  def configure(conf)
35
35
  super
36
36
  begin
37
- @loggers = {}
38
-
39
- #If config parameters doesn't start with $ then we can configure Coralogix logger now.
40
- if !appname.start_with?("$") && !subsystemname.start_with?("$")
37
+ @currentWorker = 0;
38
+ @workers = {}
39
+ @app_name_from_config = DEFAULT_appname;
40
+ @sub_name_from_config = DEFAULT_subsystemname;
41
+ i = 0
42
+ $log.info "configure #{number_of_workers} workers"
43
+ until i == number_of_workers do
44
+ @workers[i.to_s] = {}
45
+ $log.info "init worker ##{i}"
41
46
  private_key = get_private_key
42
- app_name = config.fetch("APP_NAME", appname)
43
- sub_name = config.fetch("SUB_SYSTEM", subsystemname)
44
-
45
- @logger = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k,v| [k.to_s,v] }.to_h : Hash.new
46
- @configured = true
47
+ if !appname.start_with?("$") && !subsystemname.start_with?("$")
48
+ @app_name_from_config = config.fetch("APP_NAME", appname)
49
+ @sub_name_from_config = config.fetch("SUB_SYSTEM", subsystemname)
50
+ @workers[i.to_s]["#{@app_name_from_config}.#{@sub_name_from_config}"] = CoralogixLogger.new private_key, @app_name_from_config, @sub_name_from_config, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k,v| [k.to_s,v] }.to_h : Hash.new
51
+ else
52
+ @workers[i.to_s] = {}
53
+ end
54
+ i+=1
47
55
  end
56
+
48
57
  rescue Exception => e
49
58
  $log.error "Failed to configure: #{e}"
50
59
  end
@@ -85,17 +94,25 @@ module Fluent
85
94
  end
86
95
 
87
96
  def get_logger(record)
88
-
89
- return @logger if @configured
90
-
91
97
  private_key = get_private_key
92
- app_name, sub_name = get_app_sub_name(record)
93
-
94
- if !@loggers.key?("#{app_name}.#{sub_name}")
95
- @loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k, v| [k.to_s, v] }.to_h : Hash.new
98
+ if !appname.start_with?("$") && !subsystemname.start_with?("$")
99
+ app_name = @app_name_from_config
100
+ sub_name = @sub_name_from_config
101
+ else
102
+ app_name, sub_name = get_app_sub_name(record)
103
+ end
104
+
105
+ if @currentWorker == number_of_workers
106
+ @currentWorker = 0
107
+ end
108
+ worker = @workers[@currentWorker.to_s]
109
+ @currentWorker+=1;
110
+ if !worker.key?("#{app_name}.#{sub_name}")
111
+ worker["#{app_name}.#{sub_name}"] = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k, v| [k.to_s, v] }.to_h : Hash.new
96
112
  end
97
113
 
98
- return @loggers["#{app_name}.#{sub_name}"]
114
+ return worker["#{app_name}.#{sub_name}"]
115
+
99
116
  end
100
117
 
101
118
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-coralogix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Royee Goldberg
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  requirements: []
53
53
  rubyforge_project:
54
- rubygems_version: 2.7.3
54
+ rubygems_version: 2.6.8
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: Coralogix Fluentd out plugin