fluent-plugin-opentelemetry-radiant 0.1.0
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 +7 -0
- data/CHANGELOG.md +50 -0
- data/LICENSE +202 -0
- data/NOTICE +23 -0
- data/README.md +278 -0
- data/lib/fluent/plugin/in_opentelemetry.rb +118 -0
- data/lib/fluent/plugin/in_opentelemetry_metrics.rb +285 -0
- data/lib/fluent/plugin/opentelemetry/constant.rb +35 -0
- data/lib/fluent/plugin/opentelemetry/grpc_input_handler.rb +89 -0
- data/lib/fluent/plugin/opentelemetry/grpc_output_handler.rb +161 -0
- data/lib/fluent/plugin/opentelemetry/http_input_handler.rb +177 -0
- data/lib/fluent/plugin/opentelemetry/http_output_handler.rb +157 -0
- data/lib/fluent/plugin/opentelemetry/log_record_builder.rb +229 -0
- data/lib/fluent/plugin/opentelemetry/output_response.rb +21 -0
- data/lib/fluent/plugin/opentelemetry/request.rb +67 -0
- data/lib/fluent/plugin/opentelemetry/response.rb +90 -0
- data/lib/fluent/plugin/opentelemetry/version.rb +9 -0
- data/lib/fluent/plugin/opentelemetry_radiant/version.rb +14 -0
- data/lib/fluent/plugin/out_opentelemetry.rb +11 -0
- data/lib/fluent/plugin/out_opentelemetry_radiant.rb +205 -0
- data/lib/opentelemetry/proto/collector/logs/v1/logs_service_pb.rb +27 -0
- data/lib/opentelemetry/proto/collector/logs/v1/logs_service_services_pb.rb +48 -0
- data/lib/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.rb +27 -0
- data/lib/opentelemetry/proto/collector/metrics/v1/metrics_service_services_pb.rb +48 -0
- data/lib/opentelemetry/proto/collector/profiles/v1development/profiles_service_pb.rb +27 -0
- data/lib/opentelemetry/proto/collector/profiles/v1development/profiles_service_services_pb.rb +47 -0
- data/lib/opentelemetry/proto/collector/trace/v1/trace_service_pb.rb +27 -0
- data/lib/opentelemetry/proto/collector/trace/v1/trace_service_services_pb.rb +48 -0
- data/lib/opentelemetry/proto/common/v1/common_pb.rb +26 -0
- data/lib/opentelemetry/proto/logs/v1/logs_pb.rb +29 -0
- data/lib/opentelemetry/proto/metrics/v1/metrics_pb.rb +41 -0
- data/lib/opentelemetry/proto/profiles/v1development/profiles_pb.rb +36 -0
- data/lib/opentelemetry/proto/resource/v1/resource_pb.rb +23 -0
- data/lib/opentelemetry/proto/trace/v1/trace_pb.rb +33 -0
- metadata +198 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5b3f35dd254aa50aee69218bd2a13ecdf80222d9c80f216694a3728821cead78
|
|
4
|
+
data.tar.gz: 124931e149bc6def82b37f5ce24c2e68995ec6040819ccfd9bc6a85eaa81d92a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1edb669c95e239d288c03819d14a1559dbf023fa8942b2be39435c4f60f7bb819175ac07798786d85566c7e95010dcb0c296ab3d680cbe5cee4ec08a87ad0a0f
|
|
7
|
+
data.tar.gz: f7ac40e9c4b7fe92e2956c28ceb2e89e1d2a4482720f276e1d6a6d3452017c46a632e423456bc66d9f6e8f2a50dbfe0cbcb63e7587af0f3fb64b30da8fec59f8
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
- Normalize log strings to valid UTF-8 without mutating records, preventing binary or invalid bytes from dropping whole chunks.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-09-02
|
|
6
|
+
|
|
7
|
+
- Add secret-masked authentication headers for HTTP and lowercase gRPC metadata.
|
|
8
|
+
- Add HTTP CA and mutual TLS settings without changing global Excon defaults;
|
|
9
|
+
warn once at start when HTTP certificate verification is disabled.
|
|
10
|
+
- Add gRPC TLS and configuration-time certificate file errors; reject URI-style
|
|
11
|
+
gRPC endpoints and disabled certificate verification.
|
|
12
|
+
- Port upstream 0.5.3 streaming HTTP input limits (32 MiB body / 256 MiB
|
|
13
|
+
decompressed), request closure, HTTP 413 and bad-gzip 400 responses
|
|
14
|
+
(CVE-2026-44163 / GHSA-2jc5-xhx8-qj6h), and gRPC input shutdown.
|
|
15
|
+
- Reuse persistent HTTP connections, consume responses, accept all 2xx statuses,
|
|
16
|
+
and normalize trailing endpoint slashes.
|
|
17
|
+
- Reuse gRPC stubs and apply compression, keepalive and per-call deadlines to
|
|
18
|
+
both relay and ordinary-record exports.
|
|
19
|
+
- Classify ordinary-record gRPC status errors as retryable or unrecoverable and
|
|
20
|
+
warn without retry on partial log success over HTTP or gRPC.
|
|
21
|
+
- Default output chunks to 2 MiB while preserving tag chunk keys.
|
|
22
|
+
- Add CONTENT_TYPE_PLAIN and retain CONTENT_TYPE_PAIN as a compatibility alias.
|
|
23
|
+
- Keep the original generated protobufs, internal metrics behavior and package
|
|
24
|
+
version; no additional runtime dependencies.
|
|
25
|
+
|
|
26
|
+
- Fork fluent-plugin-opentelemetry 0.4.0 under the Radiant package name.
|
|
27
|
+
- Add automatic, forced-relay, and ordinary-record output modes.
|
|
28
|
+
- Convert ordinary records into typed, batched OTLP log export requests.
|
|
29
|
+
- Preserve upstream input plugins and OTLP logs, metrics, and traces relay behavior.
|
|
30
|
+
- Register both `opentelemetry_radiant` and `opentelemetry` output names.
|
|
31
|
+
|
|
32
|
+
## Upstream history
|
|
33
|
+
|
|
34
|
+
## [0.4.0] - 2025-10-10
|
|
35
|
+
|
|
36
|
+
- in_opentelemetry_metrics: Add plugin to support fluentd metrics export (#10)
|
|
37
|
+
|
|
38
|
+
## [0.3.0] - 2025-07-23
|
|
39
|
+
|
|
40
|
+
- in_opentelemetry: add ${type} placeholder support in tag parameter (#8)
|
|
41
|
+
- in_opentelemetry: use String for record keys (#6)
|
|
42
|
+
|
|
43
|
+
## [0.2.0] - 2025-06-26
|
|
44
|
+
|
|
45
|
+
- Make gRPC sending and receiving optional (#4)
|
|
46
|
+
- To use gRPC sending and receiving, you need to install `grpc` gem manually.
|
|
47
|
+
|
|
48
|
+
## [0.1.0] - 2025-03-31
|
|
49
|
+
|
|
50
|
+
- Initial release
|
data/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/NOTICE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
fluent-plugin-opentelemetry-radiant
|
|
2
|
+
Copyright 2026 Radiant Logic, Inc.
|
|
3
|
+
|
|
4
|
+
This product is a derivative work of fluent-plugins-nursery/fluent-plugin-opentelemetry
|
|
5
|
+
version 0.4.0, Copyright 2025- Shizuo Fujita, licensed under the Apache
|
|
6
|
+
License, Version 2.0. The upstream source is available at
|
|
7
|
+
https://github.com/fluent-plugins-nursery/fluent-plugin-opentelemetry.
|
|
8
|
+
|
|
9
|
+
The derivative retains the upstream copyright and license notices. Its material
|
|
10
|
+
changes are:
|
|
11
|
+
|
|
12
|
+
- adds an output mode that converts ordinary Fluentd records into OTLP logs;
|
|
13
|
+
- batches converted records into one ExportLogsServiceRequest per Fluentd chunk;
|
|
14
|
+
- preserves typed scalar, nested map, and nested array values in OTLP AnyValue fields;
|
|
15
|
+
- projects configured record fields into OTLP resource attributes;
|
|
16
|
+
- preserves Fluentd event nanoseconds in OTLP log timestamps;
|
|
17
|
+
- lets the existing HTTP and optional gRPC handlers export prepared log requests;
|
|
18
|
+
- retains the upstream OTLP logs, metrics, and traces relay path; and
|
|
19
|
+
- registers both the `opentelemetry_radiant` and compatibility `opentelemetry`
|
|
20
|
+
output names.
|
|
21
|
+
|
|
22
|
+
The generated OpenTelemetry protobuf Ruby files remain derived from the
|
|
23
|
+
OpenTelemetry Protocol project and retain their embedded Apache-2.0 notices.
|
data/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# fluent-plugin-opentelemetry-radiant
|
|
2
|
+
|
|
3
|
+
A Fluentd input/output plugin for OpenTelemetry Protocol (OTLP) data. This is an
|
|
4
|
+
Apache-2.0 derivative of
|
|
5
|
+
[`fluent-plugin-opentelemetry` 0.4.0](https://github.com/fluent-plugins-nursery/fluent-plugin-opentelemetry)
|
|
6
|
+
by Shizuo Fujita.
|
|
7
|
+
|
|
8
|
+
The fork retains the upstream OTLP relay and both upstream input plugins, and
|
|
9
|
+
adds an output path that turns ordinary Fluentd records into batched OTLP logs.
|
|
10
|
+
It includes the input size-limit and transport robustness fixes from upstream
|
|
11
|
+
0.5.3, with authenticated HTTP and gRPC exports and client TLS configuration.
|
|
12
|
+
|
|
13
|
+
> [!IMPORTANT]
|
|
14
|
+
> Do not install this gem alongside `fluent-plugin-opentelemetry`. This gem
|
|
15
|
+
> replaces it and intentionally ships the same input names, compatibility output
|
|
16
|
+
> name, and generated protobuf descriptors. Co-installation can cause duplicate
|
|
17
|
+
> Fluentd registry entries or duplicate protobuf descriptor errors.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
fluent-gem install fluent-plugin-opentelemetry-radiant
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Output modes
|
|
26
|
+
|
|
27
|
+
The output is registered as both `opentelemetry_radiant` and `opentelemetry`.
|
|
28
|
+
|
|
29
|
+
| `mode` | Behavior |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `auto` (default) | Relay records with a supported OTLP `type` and a `message`; convert every other record. Mixed chunks are partitioned. |
|
|
32
|
+
| `relay` | Send every record through the upstream OTLP relay path. |
|
|
33
|
+
| `records` | Convert every record into an OTLP `LogRecord`. |
|
|
34
|
+
|
|
35
|
+
Supported relay types remain `opentelemetry_logs`, `opentelemetry_metrics`, and
|
|
36
|
+
`opentelemetry_traces`.
|
|
37
|
+
|
|
38
|
+
## Ordinary-record configuration
|
|
39
|
+
|
|
40
|
+
```conf
|
|
41
|
+
<match fid.**>
|
|
42
|
+
@type opentelemetry_radiant
|
|
43
|
+
mode records
|
|
44
|
+
|
|
45
|
+
# Read the token from the Fluentd process environment.
|
|
46
|
+
headers {"Authorization":"Bearer #{ENV['OTLP_TOKEN']}"}
|
|
47
|
+
|
|
48
|
+
body_key message
|
|
49
|
+
body_format string
|
|
50
|
+
severity_key severity
|
|
51
|
+
attributes_from_record true
|
|
52
|
+
exclude_keys hostname,clustername
|
|
53
|
+
|
|
54
|
+
resource_attributes {"service.name":"fid"}
|
|
55
|
+
resource_attributes_from_record {"host.name":"hostname","k8s.cluster.name":"clustername"}
|
|
56
|
+
scope_name fluent-plugin-opentelemetry-radiant
|
|
57
|
+
|
|
58
|
+
<http>
|
|
59
|
+
endpoint https://otel-collector.example.com
|
|
60
|
+
compress text
|
|
61
|
+
read_timeout 60
|
|
62
|
+
write_timeout 60
|
|
63
|
+
connect_timeout 60
|
|
64
|
+
</http>
|
|
65
|
+
|
|
66
|
+
<transport tls>
|
|
67
|
+
# Omit ca_path to use the system CA roots.
|
|
68
|
+
ca_path /etc/fluent/certs/collector-ca.pem
|
|
69
|
+
min_version TLSv1_2
|
|
70
|
+
</transport>
|
|
71
|
+
|
|
72
|
+
<buffer tag>
|
|
73
|
+
@type file
|
|
74
|
+
path /var/log/fluent/otel-buffer
|
|
75
|
+
flush_interval 5s
|
|
76
|
+
retry_forever true
|
|
77
|
+
</buffer>
|
|
78
|
+
</match>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
For `body_format string`, a present `body_key` value is converted with Ruby's
|
|
82
|
+
`to_s`; when the key is absent, the complete record is JSON-encoded. For
|
|
83
|
+
`body_format kvlist`, the complete record becomes an OTLP `KeyValueList` body.
|
|
84
|
+
|
|
85
|
+
With `attributes_from_record true`, fields other than `body_key`, `severity_key`,
|
|
86
|
+
and `exclude_keys` become log attributes. Strings, signed 64-bit integers,
|
|
87
|
+
floats, and booleans use their matching OTLP `AnyValue` fields. Hashes and arrays
|
|
88
|
+
are recursively represented as `kvlist_value` and `array_value`. Because OTLP
|
|
89
|
+
has no null `AnyValue`, `nil` is represented as the string `"null"`; integers
|
|
90
|
+
outside the signed 64-bit OTLP range are represented losslessly as strings.
|
|
91
|
+
`fluent.tag` is always added and cannot be excluded.
|
|
92
|
+
|
|
93
|
+
Static `resource_attributes` are overlaid by values selected through
|
|
94
|
+
`resource_attributes_from_record`; mapped values come from the first converted
|
|
95
|
+
record in the chunk. A missing mapped record key is ignored.
|
|
96
|
+
|
|
97
|
+
Severity matching is case-insensitive: TRACE=1, DEBUG=5, INFO=9, WARN=13,
|
|
98
|
+
ERROR=17, and FATAL=21. Unknown text uses OTLP's unspecified number (0). If the
|
|
99
|
+
severity key is absent, both fields remain unset/defaulted.
|
|
100
|
+
|
|
101
|
+
Converted records in one Fluentd chunk are sent in one
|
|
102
|
+
`ExportLogsServiceRequest`. Delivery is at least once: if any relay or converted
|
|
103
|
+
export fails, Fluentd retries the chunk and a previously accepted request can be
|
|
104
|
+
delivered again. The default buffer `chunk_limit_size` is **2 MiB**, with
|
|
105
|
+
`chunk_keys ["tag"]`. This leaves headroom below common 4 MiB gRPC receiver
|
|
106
|
+
limits because conversion can enlarge the message. It is not a strict encoded
|
|
107
|
+
request limit: large records and attributes can still exceed a receiver's limit.
|
|
108
|
+
Tune chunk sizes against the actual encoded requests and receiver settings.
|
|
109
|
+
|
|
110
|
+
## Relay configuration
|
|
111
|
+
|
|
112
|
+
This remains compatible with the output emitted by the upstream
|
|
113
|
+
`opentelemetry` and `opentelemetry_metrics` inputs:
|
|
114
|
+
|
|
115
|
+
```conf
|
|
116
|
+
<match opentelemetry.**>
|
|
117
|
+
@type opentelemetry
|
|
118
|
+
mode relay
|
|
119
|
+
|
|
120
|
+
<http>
|
|
121
|
+
endpoint http://127.0.0.1:4318
|
|
122
|
+
</http>
|
|
123
|
+
</match>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The HTTP path sends `application/x-protobuf`. Optional gRPC support requires the
|
|
127
|
+
`grpc` gem to be installed separately. The transport settings below apply to all
|
|
128
|
+
output modes and to relay logs, metrics, and traces.
|
|
129
|
+
|
|
130
|
+
## Authentication and HTTP TLS
|
|
131
|
+
|
|
132
|
+
Top-level `headers` is a hash of string values (default `{}`). Every export uses
|
|
133
|
+
these headers for HTTP or their lowercase keys for gRPC metadata. Fluentd masks
|
|
134
|
+
the entire hash in its configuration dump. `Content-Type` and `Content-Encoding`
|
|
135
|
+
are reserved, case-insensitively; configured values for them are ignored.
|
|
136
|
+
Keep tokens in the process environment or your existing secret management system.
|
|
137
|
+
|
|
138
|
+
```conf
|
|
139
|
+
<match fid.**>
|
|
140
|
+
@type opentelemetry_radiant
|
|
141
|
+
mode records
|
|
142
|
+
headers {"Authorization":"Bearer #{ENV['OTLP_TOKEN']}","X-Tenant-ID":"fid"}
|
|
143
|
+
<http>
|
|
144
|
+
endpoint https://collector.example.com:4318/
|
|
145
|
+
compress gzip
|
|
146
|
+
read_timeout 60
|
|
147
|
+
write_timeout 60
|
|
148
|
+
connect_timeout 60
|
|
149
|
+
</http>
|
|
150
|
+
<transport tls>
|
|
151
|
+
ca_path /etc/fluent/certs/ca.pem
|
|
152
|
+
# Set both for mutual TLS; omit both for server authentication only.
|
|
153
|
+
cert_path /etc/fluent/certs/client.pem
|
|
154
|
+
private_key_path /etc/fluent/certs/client-key.pem
|
|
155
|
+
private_key_passphrase "#{ENV['OTLP_KEY_PASSPHRASE']}"
|
|
156
|
+
min_version TLSv1_2
|
|
157
|
+
max_version TLSv1_3
|
|
158
|
+
</transport>
|
|
159
|
+
</match>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The HTTP endpoint is a base URL. Trailing slashes are removed before appending
|
|
163
|
+
`/v1/logs`, `/v1/metrics`, or `/v1/traces`. Use an `https://` URL for encryption.
|
|
164
|
+
`<transport tls>` supplies the CA, client certificate, key, passphrase, and TLS
|
|
165
|
+
version bounds to Excon. Omit `ca_path` for default system trust. `insecure true`
|
|
166
|
+
disables certificate verification only on this output's HTTP connections and
|
|
167
|
+
logs one warning at start; it does not change process-wide Excon defaults.
|
|
168
|
+
HTTP connections are persistent and reused across exports.
|
|
169
|
+
|
|
170
|
+
## gRPC TLS and options
|
|
171
|
+
|
|
172
|
+
```conf
|
|
173
|
+
<match fid.**>
|
|
174
|
+
@type opentelemetry_radiant
|
|
175
|
+
mode records
|
|
176
|
+
headers {"Authorization":"Bearer #{ENV['OTLP_TOKEN']}"}
|
|
177
|
+
<grpc>
|
|
178
|
+
endpoint collector.example.com:4317
|
|
179
|
+
compress gzip
|
|
180
|
+
timeout 60
|
|
181
|
+
keepalive_time 30
|
|
182
|
+
keepalive_timeout 10
|
|
183
|
+
</grpc>
|
|
184
|
+
<transport tls>
|
|
185
|
+
ca_path /etc/fluent/certs/ca.pem
|
|
186
|
+
# Optional mutual TLS:
|
|
187
|
+
cert_path /etc/fluent/certs/client.pem
|
|
188
|
+
private_key_path /etc/fluent/certs/client-key.pem
|
|
189
|
+
</transport>
|
|
190
|
+
</match>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The gRPC endpoint must be `host:port` (or `[IPv6]:port`), without `http://` or
|
|
194
|
+
`https://`. `<transport tls>` selects a secure channel. Omit `ca_path` to use
|
|
195
|
+
gRPC's default system roots; omit the client cert and key unless mutual TLS is
|
|
196
|
+
required. TLS files are read at configuration time, and unreadable files produce
|
|
197
|
+
a `Fluent::ConfigError` identifying the path. An encrypted client key can use
|
|
198
|
+
`private_key_passphrase`. Without `<transport tls>`, gRPC uses plaintext.
|
|
199
|
+
`insecure true` is rejected for gRPC; supply the server's CA using `ca_path`.
|
|
200
|
+
The HTTP `min_version` / `max_version` settings are not applied to gRPC, whose
|
|
201
|
+
TLS negotiation is managed by gRPC core.
|
|
202
|
+
|
|
203
|
+
| gRPC option | Default | Meaning |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `compress` | `text` | `text` sends uncompressed messages; `gzip` enables gRPC gzip compression. |
|
|
206
|
+
| `timeout` | `60` | Deadline in seconds, refreshed for every call. |
|
|
207
|
+
| `keepalive_time` | `30` | Interval in seconds between gRPC keepalive pings. |
|
|
208
|
+
| `keepalive_timeout` | `10` | Seconds to wait for a ping acknowledgement. |
|
|
209
|
+
|
|
210
|
+
Stubs and channels are reused. Keepalive pings are permitted without active
|
|
211
|
+
calls; coordinate the interval with the backend's keepalive policy.
|
|
212
|
+
|
|
213
|
+
## Delivery and retries
|
|
214
|
+
|
|
215
|
+
All HTTP **2xx** responses acknowledge success. HTTP `400` is unrecoverable.
|
|
216
|
+
The default retryable HTTP codes are `429`, `502`, `503`, and `504`, configurable
|
|
217
|
+
with `<http> retryable_response_codes`. Other non-2xx responses are unrecoverable
|
|
218
|
+
by default; `error_response_as_unrecoverable false` logs and acknowledges those
|
|
219
|
+
other responses instead. Connection and DNS errors remain retryable.
|
|
220
|
+
|
|
221
|
+
For ordinary-record gRPC exports, `CANCELLED`, `DEADLINE_EXCEEDED`, `ABORTED`,
|
|
222
|
+
`OUT_OF_RANGE`, `UNAVAILABLE`, `DATA_LOSS`, and `RESOURCE_EXHAUSTED` raise a
|
|
223
|
+
retryable error for Fluentd's buffer backoff. All other gRPC error statuses raise
|
|
224
|
+
`Fluent::UnrecoverableError` with the code name and server details. Relay-mode
|
|
225
|
+
gRPC status exceptions retain upstream behavior and remain retryable through
|
|
226
|
+
Fluentd. Configure buffer retry policy to match operational needs.
|
|
227
|
+
|
|
228
|
+
Successful HTTP and gRPC log responses with `partial_success.rejected_log_records`
|
|
229
|
+
greater than zero log a warning with the count and backend error message. They
|
|
230
|
+
are acknowledged without retry to avoid resending accepted records. Configured
|
|
231
|
+
header values are redacted from these warnings and ordinary-record gRPC status
|
|
232
|
+
errors.
|
|
233
|
+
|
|
234
|
+
## Input plugins
|
|
235
|
+
|
|
236
|
+
The upstream inputs remain registered under their original names:
|
|
237
|
+
|
|
238
|
+
- `@type opentelemetry` receives OTLP logs, metrics, and traces over HTTP and,
|
|
239
|
+
when available, gRPC.
|
|
240
|
+
- `@type opentelemetry_metrics` emits Fluentd internal metrics as OTLP relay
|
|
241
|
+
records.
|
|
242
|
+
|
|
243
|
+
The OTLP HTTP input now limits the streamed request body and decompressed gzip
|
|
244
|
+
body. Configure limits inside its `<http>` section:
|
|
245
|
+
|
|
246
|
+
```conf
|
|
247
|
+
<source>
|
|
248
|
+
@type opentelemetry
|
|
249
|
+
tag opentelemetry.${type}
|
|
250
|
+
<http>
|
|
251
|
+
bind 0.0.0.0
|
|
252
|
+
port 4318
|
|
253
|
+
body_size_limit 32m
|
|
254
|
+
decompression_size_limit 256m
|
|
255
|
+
</http>
|
|
256
|
+
</source>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
`body_size_limit` defaults to **32 MiB** and `decompression_size_limit` to
|
|
260
|
+
**256 MiB**. Bodies exceeding either limit return HTTP `413`; malformed or
|
|
261
|
+
truncated gzip returns `400`. Requests are closed on success and failure.
|
|
262
|
+
This includes the upstream CVE-2026-44163 / GHSA-2jc5-xhx8-qj6h fix. The gRPC
|
|
263
|
+
input now stops its server during Fluentd shutdown. The internal metrics input
|
|
264
|
+
keeps its upstream 0.4.0 behavior and `fluentd_` metric prefix; no process metrics
|
|
265
|
+
or `get_process_mem` dependency are added.
|
|
266
|
+
|
|
267
|
+
## Development
|
|
268
|
+
|
|
269
|
+
```sh
|
|
270
|
+
bundle install
|
|
271
|
+
bundle exec rake test
|
|
272
|
+
bundle exec rake build
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Attribution and license
|
|
276
|
+
|
|
277
|
+
Copyright notices from the upstream project are retained. See [NOTICE](NOTICE)
|
|
278
|
+
for the derivative-work statement and [LICENSE](LICENSE) for Apache License 2.0.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fluent/plugin/input"
|
|
4
|
+
require "fluent/plugin/opentelemetry/constant"
|
|
5
|
+
require "fluent/plugin/opentelemetry/http_input_handler"
|
|
6
|
+
require "fluent/plugin_helper/http_server"
|
|
7
|
+
require "fluent/plugin_helper/thread"
|
|
8
|
+
|
|
9
|
+
begin
|
|
10
|
+
require "grpc"
|
|
11
|
+
|
|
12
|
+
require "fluent/plugin/opentelemetry/grpc_input_handler"
|
|
13
|
+
rescue LoadError
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module Fluent::Plugin
|
|
17
|
+
class OpentelemetryInput < Input
|
|
18
|
+
Fluent::Plugin.register_input("opentelemetry", self)
|
|
19
|
+
|
|
20
|
+
helpers :thread, :http_server
|
|
21
|
+
|
|
22
|
+
desc "The tag of the event."
|
|
23
|
+
config_param :tag, :string
|
|
24
|
+
|
|
25
|
+
config_section :http, required: false, multi: false, init: false, param_name: :http_config do
|
|
26
|
+
desc "The address to bind to."
|
|
27
|
+
config_param :bind, :string, default: "0.0.0.0"
|
|
28
|
+
desc "The port to listen to."
|
|
29
|
+
config_param :port, :integer, default: 4318
|
|
30
|
+
|
|
31
|
+
desc "The size limit of the POSTed element. This value should be larger than the 'chunk_limit_size' in out_opentelemetry plugin."
|
|
32
|
+
config_param :body_size_limit, :size, default: 32 * 1024 * 1024
|
|
33
|
+
desc "The size limit of the decompressed element."
|
|
34
|
+
config_param :decompression_size_limit, :size, default: 256 * 1024 * 1024
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
config_section :grpc, required: false, multi: false, init: false, param_name: :grpc_config do
|
|
38
|
+
desc "The address to bind to."
|
|
39
|
+
config_param :bind, :string, default: "0.0.0.0"
|
|
40
|
+
desc "The port to listen to."
|
|
41
|
+
config_param :port, :integer, default: 4317
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
config_section :transport, required: false, multi: false, init: false, param_name: :transport_config do
|
|
45
|
+
config_argument :protocol, :enum, list: [:tls], default: nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def configure(conf)
|
|
49
|
+
super
|
|
50
|
+
|
|
51
|
+
expand_tag_placeholders(@tag)
|
|
52
|
+
|
|
53
|
+
if @grpc_config && !defined?(GRPC)
|
|
54
|
+
raise Fluent::ConfigError, "To use gRPC feature, please install grpc gem such as 'fluent-gem install grpc'."
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
unless [@http_config, @grpc_config].any?
|
|
58
|
+
raise Fluent::ConfigError, "Please configure either <http> or <grpc> section, or both."
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def start
|
|
63
|
+
super
|
|
64
|
+
|
|
65
|
+
if @http_config
|
|
66
|
+
http_handler = Opentelemetry::HttpInputHandler.new(@http_config, log)
|
|
67
|
+
http_server_create_http_server(:in_opentelemetry_http_server, addr: @http_config.bind, port: @http_config.port, logger: log) do |serv|
|
|
68
|
+
serv.post("/v1/logs") do |req|
|
|
69
|
+
http_handler.logs(req) { |record| router.emit(tag_for(Opentelemetry::RECORD_TYPE_LOGS), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_LOGS, "message" => record }) }
|
|
70
|
+
end
|
|
71
|
+
serv.post("/v1/metrics") do |req|
|
|
72
|
+
http_handler.metrics(req) { |record| router.emit(tag_for(Opentelemetry::RECORD_TYPE_METRICS), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_METRICS, "message" => record }) }
|
|
73
|
+
end
|
|
74
|
+
serv.post("/v1/traces") do |req|
|
|
75
|
+
http_handler.traces(req) { |record| router.emit(tag_for(Opentelemetry::RECORD_TYPE_TRACES), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_TRACES, "message" => record }) }
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if @grpc_config
|
|
81
|
+
thread_create(:in_opentelemetry_grpc_server) do
|
|
82
|
+
@grpc_handler = Opentelemetry::GrpcInputHandler.new(@grpc_config, log)
|
|
83
|
+
@grpc_handler.run(
|
|
84
|
+
logs: lambda { |record|
|
|
85
|
+
router.emit(tag_for(Opentelemetry::RECORD_TYPE_LOGS), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_LOGS, "message" => record })
|
|
86
|
+
},
|
|
87
|
+
metrics: lambda { |record|
|
|
88
|
+
router.emit(tag_for(Opentelemetry::RECORD_TYPE_METRICS), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_METRICS, "message" => record })
|
|
89
|
+
},
|
|
90
|
+
traces: lambda { |record|
|
|
91
|
+
router.emit(tag_for(Opentelemetry::RECORD_TYPE_TRACES), Fluent::EventTime.now, { "type" => Opentelemetry::RECORD_TYPE_TRACES, "message" => record })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def stop
|
|
99
|
+
@grpc_handler&.stop
|
|
100
|
+
|
|
101
|
+
super
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def expand_tag_placeholders(tag)
|
|
107
|
+
@expand_tag_placeholders ||= {
|
|
108
|
+
Opentelemetry::RECORD_TYPE_LOGS => tag.gsub(Opentelemetry::PLACEHOLDER_TYPE, Opentelemetry::PLACEHOLDER_TYPE_LOGS),
|
|
109
|
+
Opentelemetry::RECORD_TYPE_METRICS => tag.gsub(Opentelemetry::PLACEHOLDER_TYPE, Opentelemetry::PLACEHOLDER_TYPE_METRICS),
|
|
110
|
+
Opentelemetry::RECORD_TYPE_TRACES => tag.gsub(Opentelemetry::PLACEHOLDER_TYPE, Opentelemetry::PLACEHOLDER_TYPE_TRACES)
|
|
111
|
+
}
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def tag_for(type)
|
|
115
|
+
@expand_tag_placeholders[type]
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|