File tree Expand file tree Collapse file tree 2 files changed +44
-5
lines changed Expand file tree Collapse file tree 2 files changed +44
-5
lines changed Original file line number Diff line number Diff line change 1
1
FROM fluent/fluentd:v1.15-debian-1
2
2
3
3
USER root
4
- RUN fluent-gem install fluent-plugin-prometheus -v 2.0.3
5
-
6
- USER fluent
7
-
8
- EXPOSE 24231
4
+ RUN fluent-gem install fluent-plugin-prometheus -v 2.0.3 && \
5
+ fluent-gem install fluent-plugin-s3 -v 1.7.1
6
+ COPY ./plugins/ /fluentd/plugins/
Original file line number Diff line number Diff line change
1
+ module Fluent ::Plugin
2
+ class HttpHealthCheckInput < Input
3
+ Fluent ::Plugin . register_input ( 'http_healthcheck' , self )
4
+ helpers :http_server
5
+
6
+ desc 'The address to bind to.'
7
+ config_param :bind , :string , default : '0.0.0.0'
8
+ desc 'The port to listen to.'
9
+ config_param :port , :integer , default : 8080
10
+
11
+ CONTENT_TYPE_TEXT_PLAIN = { 'Content-Type' => 'text/plain' } . freeze
12
+
13
+ def start
14
+ super
15
+
16
+ log . info "healthcheck endpoint at http://#{ @bind } :#{ @port } /healthz"
17
+
18
+ http_server_create_http_server (
19
+ :in_http_healthcheck_helper ,
20
+ addr : @bind ,
21
+ port : @port ,
22
+ logger : log ,
23
+ ) do |serv |
24
+ serv . get ( '/healthz' ) do
25
+ if healthy?
26
+ [ 200 , CONTENT_TYPE_TEXT_PLAIN , [ 'ok' ] ]
27
+ else
28
+ [ 500 , CONTENT_TYPE_TEXT_PLAIN , [ 'not ok' ] ]
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def healthy?
37
+ # TODO: check workers in multi-worker mode
38
+ true
39
+ end
40
+ end
41
+ end
You can’t perform that action at this time.
0 commit comments