Legend:
(L) = Low Priority
(M) = Medium Priority
(H) = High Priority
sentry-ruby/lib/sentry/client.rb
The reason we want to do this is to provide this functionallity:
Capture with provided a block to change the scope only for one capture call
SentrySDK.capture(error: error) { (scope) in
// Changes in here will only be captured for this event
// The scope in this callback is a clone of the current scope
// It contains all data but mutations only influence the event being sent
scope.setTag(value: "value", key: "myTag")
}
Capture Call by passing a new Scope instance:
// By explicity just passing the scope, only the data in this scope object will be added to the event
// The global scope (calls to configureScope) will be ignored
// Only do this if you know what you are doing, you loose a lot of useful info
// If you just want to mutate what's in the scope use the callback, see: captureError
SentrySDK.capture(exception: exception, scope: scope)
Or the normal way of using configure_scope
sentry-ruby/lib/sentry/configuration.rb
Envelopes
We already create Envelopes, see: https://develop.sentry.dev/sdk/envelopes/
and shouldn't send anything through store.
It can just be a wrapper class.
Something like
::Sentry::Envelope.fromEvent(event)
::Sentry::Envelope.fromTransaction(transaction) # later after we add support for performance
And the Transport should have a function sendEnvelope instead of sendEvent
sentry-ruby/lib/sentry/hub.rb
sentry-ruby/lib/sentry/scope.rb
Legend:
(L) = Low Priority
(M) = Medium Priority
(H) = High Priority
sentry-ruby/lib/sentry/client.rb
(M) def encode(event)
Should be in transport (or in an abstraction)
(M) def generate_auth_header
Should also be in transport
Same:
(H) functions in the Client should receive a Scope that the Hub passes.
https://github.com/getsentry/sentry-php/blob/master/src/Client.php#L126
The reason we want to do this is to provide this functionallity:
Capture with provided a block to change the scope only for one capture call
Capture Call by passing a new Scope instance:
Or the normal way of using
configure_scopesentry-ruby/lib/sentry/configuration.rb
(L) Can we rename this to Options? Or is this not idiomatic?
It's called Options in most other SDKs
(M) attr_accessor :project_id, attr_accessor :public_key , attr_accessor :secret_key, attr_accessor :host, attr_accessor :path, attr_accessor :port
Can we remove this?
(H) Remove all
attr_accessor :sanitize*fields(H) attr_accessor :scheme
This should become a transport option, where users can provide their own instance of a transport to send stuff to Sentry
Also the transport should just switch depending on if the DSN has http or https
(H) attr_accessor :ssl* Should all be TransportOptions, see JavaScript
attr_accessor :timeout -> TransportOptions
attr_reader :encoding -> TransportOptions
attr_accessor :open_timeout -> TransportOptions
attr_accessor :proxy -> TransportOptions
(M) attr_reader :transport_failure_callback
Remove
Envelopes
We already create Envelopes, see: https://develop.sentry.dev/sdk/envelopes/
and shouldn't send anything through store.
It can just be a wrapper class.
Something like
And the Transport should have a function sendEnvelope instead of sendEvent
sentry-ruby/lib/sentry/hub.rb
(H) @Clients & @scopes shouldn't be two seperate arrays, instead it should be one containing both
https://github.com/getsentry/sentry-javascript/blob/master/packages/hub/src/hub.ts#L53
https://github.com/getsentry/sentry-javascript/blob/master/packages/hub/src/hub.ts#L67
(H) The way hubs should work for Ruby Server applications is that, for every incoming request we need to make sure
to create a clone of the current global Hub. This clone, for the scope/lifetime of the request, is the Hub that is returned when someone uses
current_hub.Since the Hub is our concurrency unit, it is important it works that way so changes to a scope in one request do not bleed into another.
This might be something we need to have a call about.
sentry-ruby/lib/sentry/scope.rb
transactiontotransaction_name