Comments (8)
I'm quite happy with the explicitness of Send
vs Report
. I think the docs need to be more clear, but I don't think combining them makes much sense. In Go all of your underlying transports are going to be async to some extent, and 99% of users will use the HTTP transport, which is async.
from raven-go.
I can get behind that. Any purpose in keeping Report
around then? If it's conventional for golang transports to be asynchronous by default we could probably get rid of it.
from raven-go.
Do you mean Send
? Report
is the async one. I'm okay with dropping Send
if we provide a channel that returns an error value so that Report
can optionally be used synchronously. The ID from the response should also be made accessible.
from raven-go.
I just figured out where some confusion is!
It's based the truthiness of these statements: "A synchronous send to Sentry waits for the HTTP response and parses the returned "id"
. An asynchronous send does not. Therefore, when you want the "id"
you do a sync send, and when you don't you do an async send."
However, I'm not convinced that's the way to think about it, and I'm feeling thorough: I've got
Sentry isn't built this way
- The docs don't actually encourage Reading the Response of anything but the status code
- UDP. UDP is a valid transport, and you don't get a response from sentry's UDP server
Examples of how the eventID is actually returned
The first two have a form of return $data['event_id'];
where $data
is what's passed to it, and the last one explicitly documents that the expected behavior is returning the request event_id
, not the response's. The commit message reads: "Made the documentation in RavenClient.Capture methods explicit about using JsonPacket.EventID as its return value", though it admittedly doesn't do this: interestingly enough, the conflict was introduced by the same person on the same day.
Why this works
Sentry doesn't prevent duplicate IDs. No really! I made this change, and every response I got back from the Sentry server was the ID I sent it, even if it was a duplicate. In other words, like the docs say, you only need to read the response code from the response: the ID it sends back will always be the one you sent it:
tylrtrmbl:example % go run example.go http://<pubkey>:<pvtkey>@sentry.thenewtricks.com/4
{"id": "0123456789abcdef0123456789abcdef"}2013/12/27 14:39:54 sent packet successfully
tylrtrmbl:example % go run example.go http://<pubkey>:<pvtkey>@sentry.thenewtricks.com/4
{"id": "0123456789abcdef0123456789abcdef"}2013/12/27 14:40:02 sent packet successfully
tylrtrmbl:example %
To conclude my novel
I think we should mimic raven-python's architecture, since it's basically the golden master template for a Sentry client and it works:
- Async is introduced by the transports, not the "send" methods
- You prepare for any kind of async transport by assuming you don't get a response - you parse your ID return value from the packet you send
This is exactly the way #2 works now, since our HTTP transport is async by default as given to us by the go std library. Whaddaya think, heavy reader?
Fin
from raven-go.
Okay, so clients generate the ID if they want it? We should probably add that.
I miscommunicated the asyncness of our current HTTP transport. The Send
method on the transport is actually asynchronous, it is made async by the worker goroutine and the channel used in Report
.
My inclination is to keep it close to the existing model of having the Send
method on transports be blocking until a final error can be returned. This allows the synchronicity to be managed by the Client
rather than creating two options (sync/async) for each of two protocols (HTTP/UDP).
from raven-go.
Hmm, we could do a wrapper transport that's async.
from raven-go.
Also solved by #2?
from raven-go.
Yeppers!
from raven-go.
Related Issues (20)
- Improve documentation HOT 2
- How to add a Fingerprint to the Capture? HOT 3
- Crash when unwrapping Error() HOT 4
- Ability to set vars on StackTraceFrame
- Use gometalinter project-wide and on TravisCI HOT 2
- Allow attaching extra data to CapturePanic calls
- Add support for Go Modules HOT 2
- Allow to change level of Packet in Capture* calls
- Make raven-go Wait() thread safe
- Allow record panic arg manually
- gitignored file in repo
- Errors registering with wrong request URL (GorillaMux, CaptureError, Recovery Handler)
- New SDK sentry-go
- Way to track sentry errors HOT 1
- Code context when deploying only binary HOT 3
- Context tags - behavior when value is "" (empty string)?
- Raven panics when using juju errors HOT 2
- Stack trace frames aren't getting indexed properly HOT 1
- tags.7.1: Discarded invalid value HOT 1
- Panic if the error implements causer and the cause is nil
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raven-go.