Use a unix socket instead udp for reception of metrics (#2652)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-06-17 11:04:03 -04:00 committed by GitHub
parent cd7625b72f
commit c4ec773966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 94 deletions

View file

@ -1,4 +1,4 @@
local socket = ngx.socket.udp
local socket = ngx.socket.tcp
local cjson = require('cjson')
local defer = require('defer')
local assert = assert
@ -7,7 +7,7 @@ local _M = {}
local function send_data(jsonData)
local s = assert(socket())
assert(s:setpeername("127.0.0.1", 8000))
assert(s:connect('unix:/tmp/prometheus-nginx.socket'))
assert(s:send(jsonData))
assert(s:close())
end