fluent-plugin-opentelemetry 0.5.1 → 0.5.2
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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +6 -0
- data/README.md +9 -3
- data/lib/fluent/plugin/opentelemetry/version.rb +1 -1
- data/lib/fluent/plugin/out_opentelemetry.rb +39 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7caa8c736a332ab38da184793751d6760bc1d8bf59c996bffcbe324dd5da7ab5
|
|
4
|
+
data.tar.gz: d4c07bffd3ccdd29e8b151a134e5bbe77e1686d8e0ad9a84e5ecd432224d1dd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48d509ee79d59085508bd591c051d7ba8cc33efc3e0cb1d64e8ad04f28ed60444fdd4f322e65d4e41ffc84c3d0e7c7770bf7f3cfe1d1076df692ba5dfb8dddcc
|
|
7
|
+
data.tar.gz: 9c21c80065796cdadc5fb8aad7c4c1b810cff27a1581d5e83a21d4de920ff34f9318d52f39337c599da8148bbbb6f4f1ac6e365459373079d906cd6812397c77
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -202,9 +202,15 @@ Refer [Config: Transport Section](https://docs.fluentd.org/configuration/transpo
|
|
|
202
202
|
|
|
203
203
|
#### `<buffer>` section
|
|
204
204
|
|
|
205
|
-
| parameter
|
|
206
|
-
|
|
207
|
-
| chunk_keys
|
|
205
|
+
| parameter | type | description | default |
|
|
206
|
+
|------------------|---------|-----------------------------------------------------------------|------------|
|
|
207
|
+
| chunk_keys | array | Overwrites the default `chunk_keys` value in this plugin. | `tag` |
|
|
208
|
+
| chunk_limit_size | integer | Overwrites the default `chunk_limit_size` value in this plugin. | `8M` (8MB) |
|
|
209
|
+
|
|
210
|
+
**Note on chunk_limit_size:**
|
|
211
|
+
Currently, this plugin is reducing I/O load by combining data within a chunk and sending it as a single unit.
|
|
212
|
+
Depending on the configuration of your OpenTelemetry Collector or downstream backend (e.g., maximum request body size limits), an 8MB chunk might be rejected with a `413 Payload Too Large` error.
|
|
213
|
+
If you encounter this error in your Fluentd logs, please adjust (decrease) the `chunk_limit_size` in your `<buffer>` section.
|
|
208
214
|
|
|
209
215
|
Refer [Config: Buffer Section](https://docs.fluentd.org/configuration/buffer-section)
|
|
210
216
|
|
|
@@ -21,8 +21,10 @@ module Fluent::Plugin
|
|
|
21
21
|
|
|
22
22
|
helpers :server
|
|
23
23
|
|
|
24
|
+
DEFAULT_CHUNK_LIMIT_SIZE = 8 * 1024 * 1024 # 8MB
|
|
24
25
|
config_section :buffer do
|
|
25
26
|
config_set_default :chunk_keys, ["tag"]
|
|
27
|
+
config_set_default :chunk_limit_size, DEFAULT_CHUNK_LIMIT_SIZE
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
config_section :http, required: false, multi: false, init: false, param_name: :http_config do
|
|
@@ -88,13 +90,47 @@ module Fluent::Plugin
|
|
|
88
90
|
end
|
|
89
91
|
|
|
90
92
|
def write(chunk)
|
|
91
|
-
chunk.each do |
|
|
93
|
+
BatchProcessor.build_export_requests(chunk).each do |export_request|
|
|
92
94
|
if @grpc_handler
|
|
93
|
-
@grpc_handler.export(
|
|
95
|
+
@grpc_handler.export(export_request)
|
|
94
96
|
else
|
|
95
|
-
@http_handler.export(
|
|
97
|
+
@http_handler.export(export_request)
|
|
96
98
|
end
|
|
97
99
|
end
|
|
98
100
|
end
|
|
101
|
+
|
|
102
|
+
class BatchProcessor
|
|
103
|
+
RESOURCE_KEY_MAP = {
|
|
104
|
+
Opentelemetry::RECORD_TYPE_LOGS => "resourceLogs",
|
|
105
|
+
Opentelemetry::RECORD_TYPE_METRICS => "resourceMetrics",
|
|
106
|
+
Opentelemetry::RECORD_TYPE_TRACES => "resourceSpans"
|
|
107
|
+
}.freeze
|
|
108
|
+
|
|
109
|
+
def self.build_export_requests(chunk)
|
|
110
|
+
requests = {
|
|
111
|
+
Opentelemetry::RECORD_TYPE_LOGS => {},
|
|
112
|
+
Opentelemetry::RECORD_TYPE_METRICS => {},
|
|
113
|
+
Opentelemetry::RECORD_TYPE_TRACES => {}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
chunk.each do |_, record| # rubocop:disable Style/HashEachMethods
|
|
117
|
+
record_type = record["type"]
|
|
118
|
+
resource_key = RESOURCE_KEY_MAP[record_type]
|
|
119
|
+
record["message"] = JSON.parse(record["message"])
|
|
120
|
+
resource_hash = record["message"][resource_key][0]["resource"].hash
|
|
121
|
+
if requests[record_type][resource_hash].nil?
|
|
122
|
+
requests[record_type][resource_hash] = record
|
|
123
|
+
else
|
|
124
|
+
requests[record_type][resource_hash]["message"][resource_key].concat(record["message"][resource_key])
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
merged_records = requests.values.flat_map(&:values)
|
|
129
|
+
merged_records.each do |record|
|
|
130
|
+
record["message"] = record["message"].to_json
|
|
131
|
+
end
|
|
132
|
+
merged_records
|
|
133
|
+
end
|
|
134
|
+
end
|
|
99
135
|
end
|
|
100
136
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-opentelemetry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shizuo Fujita
|
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
154
|
version: '0'
|
|
155
155
|
requirements: []
|
|
156
|
-
rubygems_version: 4.0.
|
|
156
|
+
rubygems_version: 4.0.6
|
|
157
157
|
specification_version: 4
|
|
158
158
|
summary: Fluentd input/output plugin to forward OpenTelemetry Protocol data.
|
|
159
159
|
test_files: []
|