@@ -13,6 +13,8 @@ module Fluent::Plugin
13
13
class OtlpOutput < Output
14
14
Fluent ::Plugin . register_output ( "otlp" , self )
15
15
16
+ helpers :server
17
+
16
18
config_section :buffer do
17
19
config_set_default :chunk_keys , [ "tag" ]
18
20
config_set_default :flush_at_shutdown , true
@@ -26,6 +28,10 @@ class OtlpOutput < Output
26
28
config_param :proxy , :string , default : ENV [ "HTTP_PROXY" ] || ENV [ "http_proxy" ]
27
29
end
28
30
31
+ config_section :transport , required : false , multi : false , init : true , param_name : :transport_config do
32
+ config_argument :protocol , :enum , list : [ :tls ] , default : nil
33
+ end
34
+
29
35
desc "Compress request body"
30
36
config_param :compress , :enum , list : %i[ text gzip ] , default : :text
31
37
@@ -41,6 +47,15 @@ def configure(conf)
41
47
OtlpOutput . const_set ( :HTTP_LOGS_ENDPOINT , "#{ @http_config . endpoint } /v1/logs" . freeze )
42
48
OtlpOutput . const_set ( :HTTP_METRICS_ENDPOINT , "#{ @http_config . endpoint } /v1/metrics" . freeze )
43
49
OtlpOutput . const_set ( :HTTP_TRACES_ENDPOINT , "#{ @http_config . endpoint } /v1/traces" . freeze )
50
+
51
+ @certs = { }
52
+ if @transport_config . protocol == :tls
53
+ @certs [ :client_cert ] = @transport_config . cert_path
54
+ @certs [ :client_key ] = @transport_config . private_key_path
55
+ @certs [ :client_key_pass ] = @transport_config . private_key_passphrase
56
+ @certs [ :ssl_verify_peer ] = false if @transport_config . insecure
57
+ @certs [ :ssl_version ] = @transport_config . version
58
+ end
44
59
end
45
60
46
61
def multi_workers_ready?
@@ -87,7 +102,7 @@ def create_connection(chunk)
87
102
body = gz . close . string
88
103
end
89
104
90
- connection = Excon . new ( uri , body : body , headers : headers , proxy : @http_config . proxy , persistent : true )
105
+ connection = Excon . new ( uri , body : body , headers : headers , proxy : @http_config . proxy , persistent : true , ** @certs )
91
106
[ uri , connection ]
92
107
end
93
108
end
0 commit comments