fluentd 1.13.0-x86-mingw32 → 1.14.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.yaml +38 -0
  4. data/.github/workflows/linux-test.yaml +1 -1
  5. data/.github/workflows/windows-test.yaml +4 -4
  6. data/.gitlab-ci.yml +0 -22
  7. data/CHANGELOG.md +131 -0
  8. data/README.md +2 -2
  9. data/example/v0_12_filter.conf +2 -2
  10. data/fluentd.gemspec +1 -1
  11. data/lib/fluent/command/fluentd.rb +8 -0
  12. data/lib/fluent/command/plugin_generator.rb +15 -5
  13. data/lib/fluent/compat/output.rb +9 -6
  14. data/lib/fluent/config/section.rb +5 -0
  15. data/lib/fluent/config/types.rb +15 -0
  16. data/lib/fluent/config/v1_parser.rb +3 -2
  17. data/lib/fluent/config.rb +1 -1
  18. data/lib/fluent/env.rb +2 -1
  19. data/lib/fluent/event_router.rb +28 -1
  20. data/lib/fluent/oj_options.rb +62 -0
  21. data/lib/fluent/plugin/bare_output.rb +49 -8
  22. data/lib/fluent/plugin/buffer.rb +84 -22
  23. data/lib/fluent/plugin/file_wrapper.rb +22 -0
  24. data/lib/fluent/plugin/filter.rb +35 -1
  25. data/lib/fluent/plugin/formatter.rb +1 -0
  26. data/lib/fluent/plugin/formatter_json.rb +9 -7
  27. data/lib/fluent/plugin/in_http.rb +21 -2
  28. data/lib/fluent/plugin/in_monitor_agent.rb +4 -2
  29. data/lib/fluent/plugin/in_syslog.rb +13 -1
  30. data/lib/fluent/plugin/in_tail/position_file.rb +20 -18
  31. data/lib/fluent/plugin/in_tail.rb +45 -4
  32. data/lib/fluent/plugin/input.rb +39 -1
  33. data/lib/fluent/plugin/metrics.rb +119 -0
  34. data/lib/fluent/plugin/metrics_local.rb +96 -0
  35. data/lib/fluent/plugin/multi_output.rb +43 -6
  36. data/lib/fluent/plugin/out_forward.rb +1 -3
  37. data/lib/fluent/plugin/output.rb +74 -33
  38. data/lib/fluent/plugin/parser_json.rb +2 -3
  39. data/lib/fluent/plugin/service_discovery.rb +0 -15
  40. data/lib/fluent/plugin.rb +10 -1
  41. data/lib/fluent/plugin_helper/event_emitter.rb +8 -1
  42. data/lib/fluent/plugin_helper/http_server/router.rb +1 -1
  43. data/lib/fluent/plugin_helper/metrics.rb +129 -0
  44. data/lib/fluent/plugin_helper/server.rb +4 -2
  45. data/lib/fluent/plugin_helper.rb +1 -0
  46. data/lib/fluent/root_agent.rb +6 -0
  47. data/lib/fluent/supervisor.rb +2 -0
  48. data/lib/fluent/system_config.rb +9 -1
  49. data/lib/fluent/test/driver/storage.rb +30 -0
  50. data/lib/fluent/version.rb +1 -1
  51. data/templates/new_gem/lib/fluent/plugin/storage.rb.erb +40 -0
  52. data/templates/new_gem/test/plugin/test_storage.rb.erb +18 -0
  53. data/test/command/test_cat.rb +11 -8
  54. data/test/command/test_plugin_generator.rb +2 -1
  55. data/test/config/test_section.rb +9 -0
  56. data/test/config/test_system_config.rb +6 -0
  57. data/test/config/test_types.rb +7 -0
  58. data/test/plugin/in_tail/test_position_file.rb +48 -8
  59. data/test/plugin/test_bare_output.rb +13 -0
  60. data/test/plugin/test_buffer.rb +8 -2
  61. data/test/plugin/test_file_wrapper.rb +11 -0
  62. data/test/plugin/test_filter.rb +11 -0
  63. data/test/plugin/test_in_forward.rb +59 -83
  64. data/test/plugin/test_in_http.rb +86 -43
  65. data/test/plugin/test_in_monitor_agent.rb +214 -8
  66. data/test/plugin/test_in_syslog.rb +101 -56
  67. data/test/plugin/test_in_tail.rb +149 -48
  68. data/test/plugin/test_in_tcp.rb +45 -32
  69. data/test/plugin/test_in_udp.rb +47 -33
  70. data/test/plugin/test_input.rb +11 -0
  71. data/test/plugin/test_metrics.rb +294 -0
  72. data/test/plugin/test_metrics_local.rb +96 -0
  73. data/test/plugin/test_multi_output.rb +25 -1
  74. data/test/plugin/test_out_forward.rb +103 -89
  75. data/test/plugin/test_out_stream.rb +18 -8
  76. data/test/plugin/test_output.rb +16 -0
  77. data/test/plugin_helper/http_server/test_route.rb +1 -1
  78. data/test/plugin_helper/test_child_process.rb +1 -1
  79. data/test/plugin_helper/test_event_emitter.rb +29 -0
  80. data/test/plugin_helper/test_http_server_helper.rb +33 -26
  81. data/test/plugin_helper/test_metrics.rb +137 -0
  82. data/test/plugin_helper/test_server.rb +137 -138
  83. data/test/plugin_helper/test_socket.rb +16 -9
  84. data/test/test_event_time.rb +2 -2
  85. data/test/test_oj_options.rb +55 -0
  86. data/test/test_plugin_classes.rb +102 -0
  87. data/test/test_root_agent.rb +30 -1
  88. metadata +22 -7
  89. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  90. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f00f1412978e5ecb62286053a2ce33cb42a17fbde4f42c4d583deb54339b7565
4
- data.tar.gz: a01afb91dd48120e40c86822a83a6cd64dd312cb3809f33cd63c7cffc357c920
3
+ metadata.gz: 585487ebe4fdf640b517d8673d446dcc683acae55d6a8b58a3255e3e523e6824
4
+ data.tar.gz: e4ce59e08623ad835cf979e870d46f98fcc89a43eac7d180ace8e88e4bda7e64
5
5
  SHA512:
6
- metadata.gz: abcf93241fea449701dad3a7b7e4c488a4ea30f190a7309ef0d36e017959c7f1e6df28e9161f26093930d8b378c2465bc4a16bb53776e4c114559ccca40969dc
7
- data.tar.gz: acec4c758daccd0cace472b5dd9be58a24c25bdf1ada9ace474f4c9123625d3aef62a27d5b1506df22dba0e65af28ac76f0eb1bd6e62e913dcbe498dc62e7734
6
+ metadata.gz: 14a8b359210ce14d816009b9afecbd7f749b68c96655fad2d6ea7700991bba771ca3834ecc4916c8edb26d69ad5f01006b4674a1b21fb4640c390457bd9835dc
7
+ data.tar.gz: a7dd58d022d2388fd4c2de96ce454405eb7bdba9cb2aba87379849567958e2da47591def7d5baac18f09977a9fde4ec356aea9ca409f7c204e73fc0965f772d6
@@ -0,0 +1,69 @@
1
+ name: Bug Report
2
+ description: Create a report with a procedure for reproducing the bug
3
+ body:
4
+ - type: markdown
5
+ attributes:
6
+ value: |
7
+ Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem.
8
+ - type: textarea
9
+ id: description
10
+ attributes:
11
+ label: Describe the bug
12
+ description: A clear and concise description of what the bug is
13
+ validations:
14
+ required: true
15
+ - type: textarea
16
+ id: reproduce
17
+ attributes:
18
+ label: To Reproduce
19
+ description: Steps to reproduce the behavior
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ id: expected
24
+ attributes:
25
+ label: Expected behavior
26
+ description: A clear and concise description of what you expected to happen
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ id: environment
31
+ attributes:
32
+ label: Your Environment
33
+ description: |
34
+ - Fluentd or td-agent version: `fluentd --version` or `td-agent --version`
35
+ - Operating system: `cat /etc/os-release`
36
+ - Kernel version: `uname -r`
37
+
38
+ Tip: If you hit the problem with older fluentd version, try latest version first.
39
+ value: |
40
+ - Fluentd version:
41
+ - TD Agent version:
42
+ - Operating system:
43
+ - Kernel version:
44
+ render: markdown
45
+ validations:
46
+ required: true
47
+ - type: textarea
48
+ id: configuration
49
+ attributes:
50
+ label: Your Configuration
51
+ description: |
52
+ Write your configuration here. Minimum reproducible fluentd.conf is recommended.
53
+ validations:
54
+ required: true
55
+ - type: textarea
56
+ id: logs
57
+ attributes:
58
+ label: Your Error Log
59
+ description: Write your ALL error log here
60
+ render: shell
61
+ validations:
62
+ required: true
63
+ - type: textarea
64
+ id: addtional-context
65
+ attributes:
66
+ label: Additional context
67
+ description: Add any other context about the problem here.
68
+ validations:
69
+ required: false
@@ -0,0 +1,38 @@
1
+ name: Feature request
2
+ description: Suggest an idea for this project
3
+ body:
4
+ - type: markdown
5
+ attributes:
6
+ value: |
7
+ Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem.
8
+ - type: textarea
9
+ id: description
10
+ attributes:
11
+ label: Is your feature request related to a problem? Please describe.
12
+ description: |
13
+ A clear and concise description of what the problem is.
14
+ Ex. I'm always frustrated when [...]
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: solution
19
+ attributes:
20
+ label: Describe the solution you'd like
21
+ description: A clear and concise description of what you want to happen.
22
+ validations:
23
+ required: true
24
+ - type: textarea
25
+ id: alternative
26
+ attributes:
27
+ label: Describe alternatives you've considered
28
+ description: A clear and concise description of any alternative solutions or features you've considered.
29
+ validations:
30
+ required: true
31
+ - type: textarea
32
+ id: addtional-context
33
+ attributes:
34
+ label: Additional context
35
+ description: Add any other context or screenshots about the feature request here.
36
+ validations:
37
+ required: false
38
+
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.0', '2.7', '2.6', '2.5']
16
+ ruby-version: ['3.0', '2.7', '2.6']
17
17
  os: [ubuntu-latest]
18
18
  experimental: [false]
19
19
  include:
@@ -13,12 +13,12 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['2.7', '2.6', '2.5']
16
+ ruby-version: ['2.7', '2.6']
17
17
  os:
18
18
  - windows-latest
19
19
  experimental: [false]
20
20
  include:
21
- - ruby-version: '3.0.1'
21
+ - ruby-version: '3.0.2'
22
22
  os: windows-latest
23
23
  experimental: true
24
24
  # On Ruby 3.0, we need to use fiddle 1.0.8 or later to retrieve correct
@@ -28,7 +28,7 @@ jobs:
28
28
  # * https://github.com/ruby/fiddle/issues/72
29
29
  # * https://bugs.ruby-lang.org/issues/17813
30
30
  # * https://github.com/oneclick/rubyinstaller2/blob/8225034c22152d8195bc0aabc42a956c79d6c712/lib/ruby_installer/build/dll_directory.rb
31
- ruby-lib-opt: RUBYLIB=%RUNNER_TOOL_CACHE%/Ruby/3.0.1/x64/lib/ruby/gems/3.0.0/gems/fiddle-1.0.8/lib
31
+ ruby-lib-opt: RUBYLIB=%RUNNER_TOOL_CACHE%/Ruby/3.0.2/x64/lib/ruby/gems/3.0.0/gems/fiddle-1.0.8/lib
32
32
 
33
33
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
34
34
  steps:
@@ -38,7 +38,7 @@ jobs:
38
38
  with:
39
39
  ruby-version: ${{ matrix.ruby-version }}
40
40
  - name: Add Fiddle 1.0.8
41
- if: ${{ matrix.ruby-version == '3.0.1' }}
41
+ if: ${{ matrix.ruby-version == '3.0.2' }}
42
42
  run: gem install fiddle --version 1.0.8
43
43
  - name: Install dependencies
44
44
  run: ridk exec bundle install
data/.gitlab-ci.yml CHANGED
@@ -13,16 +13,6 @@ stages:
13
13
  - build
14
14
  - tests
15
15
 
16
- 2-5-8:
17
- image: "ruby:2.5.8"
18
- stage: build
19
- extends: .install-template
20
- script:
21
- - bundle install --jobs=3 --retry=3
22
- cache:
23
- key: "$CI_COMMIT_REF_SLUG 2-5-8"
24
- paths:
25
-
26
16
  2-6-6:
27
17
  image: "ruby:2.6.6"
28
18
  stage: build
@@ -64,18 +54,6 @@ rubyhead:
64
54
  paths:
65
55
  - ./*
66
56
 
67
- 2-5-8-test:
68
- image: "ruby:2.5.8"
69
- stage: tests
70
- allow_failure: true
71
- extends: .test-template
72
- script:
73
- - bundle exec rake test
74
- cache:
75
- key: "$CI_COMMIT_REF_SLUG 2-5-8"
76
- paths:
77
- - ./*
78
-
79
57
  2-6-6-test:
80
58
  image: "ruby:2.6.6"
81
59
  stage: tests
data/CHANGELOG.md CHANGED
@@ -1,3 +1,134 @@
1
+ # v1.14.0
2
+
3
+ ## Release v1.14.0 - 2021/08/30
4
+
5
+ ### Enhancement
6
+
7
+ * Added `enable_input_metrics`, `enable_size_metrics` system
8
+ configuration parameter
9
+ This feature might need to pay higher CPU cost, so input event metrics
10
+ features are disabled by default. These features are also enabled by
11
+ `--enable-input-metrics`,`--enable-size-metrics` command line
12
+ option.
13
+ https://github.com/fluent/fluentd/pull/3440
14
+ * Added reserved word `@ROOT` for getting root router.
15
+ This is incompatible change. Do not use `@ROOT` for label name.
16
+ https://github.com/fluent/fluentd/pull/3358
17
+ * in_syslog: Added `send_keepalive_packet` option
18
+ https://github.com/fluent/fluentd/pull/3474
19
+ * in_http: Added `cors_allow_credentials` option.
20
+ This option tells browsers whether to expose the response to
21
+ frontend when the credentials mode is "include".
22
+ https://github.com/fluent/fluentd/pull/3481
23
+ https://github.com/fluent/fluentd/pull/3491
24
+
25
+ ### Bug fix
26
+
27
+ * in_tail: Fixed a bug that deleted paths are not removed
28
+ from pos file by file compaction at start up
29
+ https://github.com/fluent/fluentd/pull/3467
30
+ * in_tail: Revived a warning message of retrying unaccessible file
31
+ https://github.com/fluent/fluentd/pull/3478
32
+ * TLSServer: Fixed a crash bug on logging peer host name errors
33
+ https://github.com/fluent/fluentd/pull/3483
34
+
35
+ ### Misc
36
+
37
+ * Added metrics plugin mechanism
38
+ The implementations is changed to use metrics plugin.
39
+ In the future, 3rd party plugin will be able to handle these metrics.
40
+ https://github.com/fluent/fluentd/pull/3471
41
+ https://github.com/fluent/fluentd/pull/3473
42
+ https://github.com/fluent/fluentd/pull/3479
43
+ https://github.com/fluent/fluentd/pull/3484
44
+
45
+ # v1.13.3
46
+
47
+ ## Release v1.13.3 - 2021/07/27
48
+
49
+ ### Bug fix
50
+
51
+ * in_tail: Care DeletePending state on Windows
52
+ https://github.com/fluent/fluentd/pull/3457
53
+ https://github.com/fluent/fluentd/pull/3460
54
+ * in_tail: Fix some pos_file bugs.
55
+ Avoid deleting pos_file entries unexpectedly when both
56
+ `pos_file_compaction_interval` and `follow_inode` are enabled.
57
+ Use `bytesize` instead of `size` for path length.
58
+ https://github.com/fluent/fluentd/pull/3459
59
+ * in_tail: Fix detecting rotation twice on `follow_inode`.
60
+ https://github.com/fluent/fluentd/pull/3466
61
+
62
+ ### Misc
63
+
64
+ * Remove needless spaces in a sample config file
65
+ https://github.com/fluent/fluentd/pull/3456
66
+
67
+ ### Enhancement
68
+
69
+ # v1.13.2
70
+
71
+ ## Release v1.13.2 - 2021/07/12
72
+
73
+ ### Enhancement
74
+
75
+ * fluent-plugin-generate: Storage plugin was supported.
76
+ https://github.com/fluent/fluentd/pull/3426
77
+ * parser_json: Added support to customize configuration of oj options.
78
+ Use `FLUENT_OJ_OPTION_BIGDECIMAL_LOAD`, `FLUENT_OJ_OPTION_MAX_NESTING`,
79
+ `FLUENT_OJ_OPTION_MODE`, and `FLUENT_OJ_OPTION_USE_TO_JSON` environment
80
+ variable to configure it.
81
+ https://github.com/fluent/fluentd/pull/3315
82
+
83
+ ### Bug fix
84
+
85
+ * binlog_reader: Fixed a crash bug by missing "fluent/env" dependency.
86
+ https://github.com/fluent/fluentd/pull/3443
87
+ * Fixed a crash bug on outputting log at the early stage when parsing
88
+ config file. This is a regression since v1.13.0. If you use invalid
89
+ '@' prefix parameter, remove it as a workaround.
90
+ https://github.com/fluent/fluentd/pull/3451
91
+ * in_tail: Fixed a bug that when rotation is occurred, remaining lines
92
+ will be discarded if the throttling feature is enabled.
93
+ https://github.com/fluent/fluentd/pull/3390
94
+ * fluent-plugin-generate: Fixed a crash bug during gemspec generation.
95
+ It was unexpectedly introduced by #3305, thus this bug was a
96
+ regression since 1.12.3.
97
+ https://github.com/fluent/fluentd/pull/3444
98
+
99
+ ### Misc
100
+
101
+ * Fixed the runtime dependency version of http_parse.rb to 0.7.0.
102
+ It was fixed because false positive detection is occurred frequently
103
+ by security scanning tools.
104
+ https://github.com/fluent/fluentd/pull/3450
105
+
106
+ # v1.13.1
107
+
108
+ ## Release v1.13.1 - 2021/06/25
109
+
110
+ ### Bug fix
111
+
112
+ * out_forward: Fixed a race condition on handshake
113
+ It's caused by using a same unpacker from multiple threads.
114
+ https://github.com/fluent/fluentd/pull/3405
115
+ https://github.com/fluent/fluentd/pull/3406
116
+ * in_tail: Fixed to remove too much verbose debugging logs
117
+ It was unexpectedly introduced by #3185 log throttling feature.
118
+ https://github.com/fluent/fluentd/pull/3418
119
+ * Fixed not to echo back the provides path as is on a 404 error
120
+ There was a potential cross-site scripting vector even though
121
+ it is quite difficult to exploit.
122
+ https://github.com/fluent/fluentd/pull/3427
123
+
124
+ ### Misc
125
+
126
+ * Pretty print for Fluent::Config::Section has been supported
127
+ for debugging
128
+ https://github.com/fluent/fluentd/pull/3398
129
+ * CI: Dropped to run CI for Ruby 2.5
130
+ https://github.com/fluent/fluentd/pull/3412
131
+
1
132
  # v1.13
2
133
 
3
134
  ## Release v1.13.0 - 2021/05/29
data/README.md CHANGED
@@ -25,9 +25,9 @@ An event consists of *tag*, *time* and *record*. Tag is a string separated with
25
25
 
26
26
  Use Case | Description | Diagram
27
27
  -------- | ------------|:---------:
28
- Centralizing Apache/Nginx Server Logs | Fluentd can be used to tail access/error logs and transport them reliably to remote systems. | <img src="https://www.fluentd.org/assets/img/recipes/elasticsearch-s3-fluentd.png" height="150"/>
28
+ Centralizing Apache/Nginx Server Logs | Fluentd can be used to tail access/error logs and transport them reliably to remote systems. | <img src="https://www.fluentd.org/images/recipes/elasticsearch-s3-fluentd.png" height="150"/>
29
29
  Syslog Alerting | Fluentd can "grep" for events and send out alerts. | <img src="https://www.fluentd.org/images/syslog-fluentd-alert.png" height="100"/>
30
- Mobile/Web Application Logging | Fluentd can function as middleware to enable asynchronous, scalable logging for user action events. | <img src="https://www.fluentd.org/assets/img/datasources/asynchronous_logging.png" height="150"/>
30
+ Mobile/Web Application Logging | Fluentd can function as middleware to enable asynchronous, scalable logging for user action events. | <img src="https://www.fluentd.org/images/datasources/asynchronous_logging.png" height="150"/>
31
31
 
32
32
  ## Quick Start
33
33
 
@@ -52,10 +52,10 @@
52
52
  </match>
53
53
 
54
54
  # Composing two filters. For all events with the tag foo.bar,
55
- #
55
+ #
56
56
  # 1. The first filter filters out all events that has the field "hello"
57
57
  # 2. Then, for those events, we downcase the value of the "name" field.
58
- #
58
+ #
59
59
  # - {"name":"SADA", "hello":100} gets filtered out
60
60
  # - {"name":"SADA"} becomes {"name":"sada"}
61
61
  # - {"last_name":"FURUHASHI"} throws an error because it has no field called "name"
data/fluentd.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
24
24
  gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
25
25
  gem.add_runtime_dependency("serverengine", [">= 2.2.2", "< 3.0.0"])
26
- gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.7.0"])
26
+ gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.8.0"])
27
27
  gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
28
28
  gem.add_runtime_dependency("tzinfo", [">= 1.0", "< 3.0"])
29
29
  gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
@@ -134,6 +134,14 @@ op.on('--strict-config-value', "Parse config values strictly", TrueClass) {|b|
134
134
  opts[:strict_config_value] = b
135
135
  }
136
136
 
137
+ op.on('--enable-input-metrics', "Enable input plugin metrics on fluentd", TrueClass) {|b|
138
+ opts[:enable_input_metrics] = b
139
+ }
140
+
141
+ op.on('--enable-size-metrics', "Enable plugin record size metrics on fluentd", TrueClass) {|b|
142
+ opts[:enable_size_metrics] = b
143
+ }
144
+
137
145
  op.on('-v', '--verbose', "increase verbose level (-v: debug, -vv: trace)", TrueClass) {|b|
138
146
  if b
139
147
  opts[:log_level] = [opts[:log_level] - 1, Fluent::Log::LEVEL_TRACE].max
@@ -27,7 +27,7 @@ class FluentPluginGenerator
27
27
  attr_reader :type, :name
28
28
  attr_reader :license_name
29
29
 
30
- SUPPORTED_TYPES = ["input", "output", "filter", "parser", "formatter"]
30
+ SUPPORTED_TYPES = ["input", "output", "filter", "parser", "formatter", "storage"]
31
31
 
32
32
  def initialize(argv = ARGV)
33
33
  @argv = argv
@@ -164,8 +164,13 @@ BANNER
164
164
  end
165
165
 
166
166
  def locked_gem_version(gem_name)
167
- d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
168
- d.locked_gems.dependencies[gem_name].requirement.requirements.first.last.version
167
+ if File.exist?(lock_file_path)
168
+ d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
169
+ d.locked_gems.dependencies[gem_name].requirement.requirements.first.last.version
170
+ else
171
+ # fallback even though Fluentd is installed without bundler
172
+ Gem::Specification.find_by_name(gem_name).version.version
173
+ end
169
174
  end
170
175
 
171
176
  def rake_version
@@ -177,8 +182,13 @@ BANNER
177
182
  end
178
183
 
179
184
  def bundler_version
180
- d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
181
- d.locked_gems.bundler_version.version
185
+ if File.exist?(lock_file_path)
186
+ d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
187
+ d.locked_gems.bundler_version.version
188
+ else
189
+ # fallback even though Fluentd is installed without bundler
190
+ Gem::Specification.find_by_name("bundler").version.version
191
+ end
182
192
  end
183
193
 
184
194
  def class_name
@@ -310,7 +310,7 @@ module Fluent
310
310
  # original implementation of v0.12 BufferedOutput
311
311
  def emit(tag, es, chain, key="")
312
312
  # this method will not be used except for the case that plugin calls super
313
- @emit_count += 1
313
+ @emit_count_metrics.inc
314
314
  data = format_stream(tag, es)
315
315
  if @buffer.emit(key, data, chain)
316
316
  submit_flush
@@ -337,14 +337,14 @@ module Fluent
337
337
  # because v0.12 BufferedOutput may overrides #format_stream, but original #handle_stream_simple method doesn't consider about it
338
338
  def handle_stream_simple(tag, es, enqueue: false)
339
339
  if @overrides_emit
340
- current_emit_count = @emit_count
340
+ current_emit_count = @emit_count_metrics.get
341
341
  size = es.size
342
342
  key = data = nil
343
343
  begin
344
344
  emit(tag, es, NULL_OUTPUT_CHAIN)
345
345
  key, data = self.last_emit_via_buffer
346
346
  ensure
347
- @emit_count = current_emit_count
347
+ @emit_count_metrics.set(current_emit_count)
348
348
  self.last_emit_via_buffer = nil
349
349
  end
350
350
  # on-the-fly key assignment can be done, and it's not configurable if Plugin#emit does it dynamically
@@ -352,7 +352,8 @@ module Fluent
352
352
  write_guard do
353
353
  @buffer.write({meta => data}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
354
354
  end
355
- @counter_mutex.synchronize{ @emit_records += size }
355
+ @emit_records_metrics.add(es.size)
356
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
356
357
  return [meta]
357
358
  end
358
359
 
@@ -363,7 +364,8 @@ module Fluent
363
364
  write_guard do
364
365
  @buffer.write({meta => bulk}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
365
366
  end
366
- @counter_mutex.synchronize{ @emit_records += size }
367
+ @emit_records_metrics.add(es.size)
368
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
367
369
  return [meta]
368
370
  end
369
371
 
@@ -373,7 +375,8 @@ module Fluent
373
375
  write_guard do
374
376
  @buffer.write({meta => data}, enqueue: enqueue)
375
377
  end
376
- @counter_mutex.synchronize{ @emit_records += size }
378
+ @emit_records_metrics.add(es.size)
379
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
377
380
  [meta]
378
381
  end
379
382