Skip to content

WIP: Unified API #1051

@HazAT

Description

@HazAT

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:

    PROTOCOL_VERSION = '5'
    USER_AGENT = "sentry-ruby/#{Sentry::VERSION}"
    CONTENT_TYPE = 'application/json'
    
  • (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

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

  • (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

::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

  • (H) Rename transaction to transaction_name

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions