Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry-ruby works with Sentry 9.1.2? #1236

Closed
pedrofurtado opened this issue Jan 25, 2021 · 4 comments
Closed

Sentry-ruby works with Sentry 9.1.2? #1236

pedrofurtado opened this issue Jan 25, 2021 · 4 comments
Labels
Projects

Comments

@pedrofurtado
Copy link

Sentry-ruby works with Sentry 9.1.2?

@st0012
Copy link
Collaborator

st0012 commented Jan 26, 2021

@pedrofurtado unfortunately, no. the minimum requirement is 20.6.0 🙂

@st0012 st0012 added this to To do in 4.x via automation Jan 26, 2021
@st0012 st0012 closed this as completed Jan 26, 2021
4.x automation moved this from To do to Done Jan 26, 2021
@EmmN
Copy link

EmmN commented Nov 11, 2021

ugly hack if anyone needs it

module Sentry
  class DSN
    def envelope_endpoint
      "/api/#{project_id}/store/"
    end
  end
end
module Sentry
  class HTTPTransport < Transport
    def should_compress?(data)
      false
    end
  end
end
module Sentry
  class Transport
    def encode(event)
      hash = JSON.parse(event.to_json)
      encoded = JSON.fast_generate(hash)
      Base64.strict_encode64(Zlib::Deflate.deflate(encoded))
    end
  end
end

# initialize sentry
Sentry.init do |config|
  ...
end

@st0012
Copy link
Collaborator

st0012 commented Nov 11, 2021

@EmmN wow thanks for the snippet. I think you can actually write a custom transport class like LegacyTransport < HTTPTransport, and assign it with config.transport.transport_class = LegacyTransport. it should make the code simpler.

@EmmN
Copy link

EmmN commented Nov 11, 2021

Thanks!

class SentryLegacyTransport < Sentry::HTTPTransport
    def initialize(*args)
      super
      @endpoint = "/api/#{@dsn.project_id}/store/"
    end

    def should_compress?(data)
      false
    end

    def encode(event)
      hash = JSON.parse(event.to_json)
      encoded = JSON.fast_generate(hash)
      Base64.strict_encode64(Zlib::Deflate.deflate(encoded))
    end
  end

  # initialize sentry
  Sentry.init do |config|
    config.transport.transport_class = SentryLegacyTransport
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
4.x
  
Done
Development

No branches or pull requests

3 participants