Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubburu

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubburu

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gem Version

GraphQL Ruby Hubburu Plugin

A tracer for integrating Hubburu with GraphQL Ruby

Installation

Install by adding it to your Gemfile, then bundling.

# Gemfile
gem 'hubburu'

Usage

These are the integration points you need to make to integrate with Hubburu.

  1. Add your API key
  2. Upload schema SDL to Hubburu
  3. Send operation reports to Hubburu

Adding Your API Key

Register for Hubburu, and you will be able to access your API Key from there. The recommended way is to add it to your environment variables. You can also add it manually to the Hubburu SDK calls.

Upload schema

Either you can upload your schema on server startup. This is an OK way to do it but not suitable for all environments. If you want to manually send it (such as in a CI/CD pipeline), you can do so like this:

namespace :hubburu do
  desc "register new schema version with hubburu"
  task register: :environment do
    api_key = ENV["HUBBURU_API_KEY"]
    environment = ENV["HUBBURU_ENVIRONMENT"] || "default"

    response = Hubburu.push_hubburu_schema(YOUR_SCHEMA, api_key, environment)
    response_code = response.code.to_i

    unless response_code >= 200 && response_code < 300
      raise "Failed to upload schema to Hubburu (status #{response_code})"
    end
  end
end

Send operation reports

This is done by adding the Hubburu tracer to the GraphQL schema.

require "hubburu"

class AppSchema < GraphQL::Schema
  ...

  use(Hubburu, request_id_context_key: :request_id)

  use(Hubburu,
    request_id_context_key: :request_id,
    queue_method: ->(path, body, headers) { YOUR_ASYNCHRONOUS_WORKER_METHOD(path, body, headers) })

  ...
end

request_id_context_key & queue_method are optional. Omitting queue_method will send Hubburu reports immediate. Adding an asynchronous worker will allow you to configure queueing of the report sendouts. Example of a Sidekiq worker:

class HubburuUploadWorker
  include Sidekiq::Worker
  sidekiq_options queue: :low

  def perform(url, body, headers)
    Faraday.post(url, body, headers)
  end
end

Development & Testing

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

This plugin is being developed and tested in another repository. You are welcome to send bug reports either as an issue on Github or to hello@hubburu.com.

FAQs

Package last updated on 26 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc