Skip to content

Commit a957407

Browse files
committed
Remove UDP
1 parent 45cff54 commit a957407

File tree

5 files changed

+5
-190
lines changed

5 files changed

+5
-190
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
raven-lua
22
=========
33

4-
A small Lua interface to [Sentry](http://sentry.readthedocs.org/) that supports
5-
both the HTTP and UDP interfaces and also has a helpful wrapper function
6-
`call()` that takes any arbitrary Lua function (with arguments) and executes
7-
it, traps any errors and reports it automatically to Sentry.
4+
A small Lua interface to [Sentry](https://sentry.readthedocs.org/) that also
5+
has a helpful wrapper function `call()` that takes any arbitrary Lua function
6+
(with arguments) and executes it, traps any errors and reports it automatically
7+
to Sentry.
88

99
Synopsis
1010
========
@@ -13,9 +13,7 @@ Synopsis
1313

1414
local raven = require "raven"
1515

16-
-- Both HTTP protocol and UDP protocol are supported. For example:
1716
-- http://pub:secret@127.0.0.1:8080/sentry/proj-id
18-
-- udp://pub:secret@127.0.0.1:8080/sentry/proj-id
1917
local rvn = raven:new("http://pub:secret@127.0.0.1:8080/sentry/proj-id", {
2018
tags = { foo = "bar" },
2119
})

docs/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ <h3>Parameters:</h3>
106106
<li><span class="parameter">dsn</span>
107107
The DSN of the Sentry instance with this format:
108108
<pre>{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}???/{PATH}{PROJECT_ID}</pre>
109-
Both HTTP protocol and UDP protocol are supported. For example:
110109
<pre>http://pub:secret@127.0.0.1:8080/sentry/proj-id</pre>
111-
<pre>udp://pub:secret@127.0.0.1:8080/sentry/proj-id</pre>
112110
</li>
113111
<li><span class="parameter">conf</span>
114112
client configuration. Conf should be a hash table. Possiable

raven.lua

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ _M._parse_dsn = _parse_dsn
214214
-- @param self raven client
215215
-- @param dsn The DSN of the Sentry instance with this format:
216216
-- <pre>{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}/{PATH}{PROJECT_ID}</pre>
217-
-- Both HTTP protocol and UDP protocol are supported. For example:
218217
-- <pre>http://pub:secret@127.0.0.1:8080/sentry/proj-id</pre>
219-
-- <pre>udp://pub:secret@127.0.0.1:8080/sentry/proj-id</pre>
220218
-- @param conf client configuration. Conf should be a hash table. Possiable
221219
-- keys are: "tags", "logger". For example:
222220
-- <pre>{ tags = { foo = "bar", abc = "def" }, logger = "myLogger" }</pre>
@@ -390,9 +388,7 @@ function _M.send_report(self, json, conf)
390388

391389
local json_str = json_encode(json)
392390
local ok, err
393-
if self.protocol == "udp" then
394-
ok, err = self:udp_send(json_str)
395-
elseif self.protocol == "http" then
391+
if self.protocol == "http" then
396392
ok, err = self:http_send(json_str)
397393
else
398394
error("protocol not implemented yet: " .. self.protocol)
@@ -487,44 +483,9 @@ function _M.gen_capture_err(self)
487483
end
488484
end
489485

490-
-- UDP request template
491-
local xsentryauth_udp="Sentry sentry_version=2.0,sentry_client=%s,"
492-
.. "sentry_timestamp=%s,sentry_key=%s,sentry_secret=%s\n\n%s\n"
493-
494486
-- HTTP request template
495487
local xsentryauth_http = "POST %s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\nContent-Type: application/json\r\nContent-Length: %d\r\nUser-Agent: %s\r\nX-Sentry-Auth: Sentry sentry_version=5, sentry_client=%s, sentry_timestamp=%s, sentry_key=%s, sentry_secret=%s\r\n\r\n%s"
496488

497-
-- udp_send: actually sends the structured data to the Sentry server using
498-
-- UDP
499-
function _M.udp_send(self, json_str)
500-
local ok, err
501-
502-
if not self.sock then
503-
local sock = socket.udp()
504-
505-
if sock then
506-
ok, err = sock:setpeername(self.host, self.port)
507-
if not ok then
508-
return nil, err
509-
end
510-
self.sock = sock
511-
end
512-
end
513-
514-
local bytes
515-
516-
if self.sock then
517-
local content = string_format(xsentryauth_udp,
518-
self.client_id,
519-
iso8601(),
520-
self.public_key,
521-
self.secret_key,
522-
json_str)
523-
bytes, err = self.sock:send(content)
524-
end
525-
return bytes, err
526-
end
527-
528489
-- http_send_core: do the actual network send. Expects an already
529490
-- connected socket.
530491
function _M.http_send_core(self, json_str)

tests/test_exceptions.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module("test_exceptions", lunit.testcase)
1313
local rvn
1414
local port = 29999
1515
local dsn_http = "http://pub:secret@127.0.0.1:" .. port .. "/sentry/proj-id"
16-
local dsn_udp = "udp://pub:secret@127.0.0.1:" .. port .. "/sentry/proj-id"
1716

1817
function test_capture_message_connection_refused_http()
1918
local rvn = raven:new(dsn_http)
@@ -34,10 +33,3 @@ function test_capture_message_connection_refused_http_xpcall()
3433
assert_nil(id)
3534
assert_equal("connection refused", err)
3635
end
37-
38-
function test_capture_message_connection_refused_udp()
39-
local rvn = raven:new(dsn_udp)
40-
local id, err = rvn:captureMessage("Sentry is a realtime event logging and aggregation platform.")
41-
42-
assert_not_nil(id)
43-
end

tests/test_udp.lua

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)