yabeda-honeybadger_insights 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d29ae1672f88e4a18c194104fe3ca5aae41f463b3dd6aeab76e46a3199cf7158
4
+ data.tar.gz: 84588213a2d6fd7607fde9c1a4d9917ab8150dd30ded76a2d03d55cbff42e49b
5
+ SHA512:
6
+ metadata.gz: 4b7c36927ab4500e4f782605d34058c8a623b783fb9b6dea0d2143715509004e9f35efc2dfe97df9bab3916fc96c99c6b8223625f2a15ea5fd879346a7c8f455
7
+ data.tar.gz: 6052a06ccf11c638a783804955ea990bd7c816f53953abd2c2be906abf975b1ea80d7c74d13a908930e1217337c7fa089e7985dc4a9d88ceed9386c515f72768
@@ -0,0 +1,43 @@
1
+ name: Release gem
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [Tests]
6
+ types: [completed]
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: write
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ release-if-needed:
15
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Create Release PR
19
+ uses: google-github-actions/release-please-action@v3
20
+ id: release
21
+ with:
22
+ release-type: ruby
23
+ package-name: yabeda-honeybadger_insights
24
+ version-file: lib/yabeda/honeybadger_insights/version.rb
25
+
26
+ - uses: actions/checkout@v4
27
+
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ bundler-cache: true
32
+
33
+ - name: Publish gem
34
+ if: ${{ steps.release.outputs.release_created }}
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
40
+ gem build *.gemspec
41
+ gem push *.gem
42
+ env:
43
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,35 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - ruby: 3.3
18
+ - ruby: 3.2
19
+ - ruby: 3.1
20
+ - ruby: 3.0
21
+ - ruby: 2.7
22
+ env:
23
+ CI: true
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: true
32
+ rubygems: latest
33
+
34
+ - name: Run tests
35
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.3.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## 0.1.0 - 2024-02-27
8
+
9
+ * Initial release of yabeda-honeybadger_insights gem.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gemspec
8
+
9
+ group :development, :test do
10
+ gem "rake"
11
+ gem "standardrb"
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Honeybadger Industries
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Honeybadger Insights plugin for Yabeda
2
+
3
+ [![Tests](https://github.com/honeybadger-io/yabeda-honeybadger_insights/actions/workflows/test.yml/badge.svg)](https://github.com/honeybadger-io/yabeda-honeybadger_insights/actions/workflows/test.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/yabeda-honeybadger_insights.svg)](https://rubygems.org/gems/yabeda-honeybadger_insights)
5
+
6
+ This [Yabeda] adapter sends application metrics to [Honeybadger Insights].
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'yabeda-honeybadger_insights'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```shell
19
+ bundle
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Register the adapter along with your other Yabeda initialization code (such as in `config/initializers/yabeda.rb`).
25
+
26
+ ```ruby
27
+ Yabeda.configure do
28
+ register_adapter(:honeybadger_insights, Yabeda::HoneybadgerInsights::Adapter.new)
29
+ end
30
+ ```
31
+
32
+ All metrics will be sent to Honeybadger Insights as events, so counters, gauges, and histograms are all treated the same way.
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/honeybadger-io/yabeda-honeybadger_insights).
41
+
42
+ ### To contribute your code:
43
+
44
+ 1. Fork the repo.
45
+ 2. Create a topic branch `git checkout -b my_branch`.
46
+ 3. Make your changes and add an entry to the [CHANGELOG](CHANGELOG.md).
47
+ 4. Commit your changes `git commit -am "Boom"`
48
+ 5. Push to your branch `git push origin my_branch`
49
+ 6. Send a [pull request](https://github.com/honeybadger-io/yabeda-honeybadger_insights/pulls)
50
+
51
+ ### Releasing
52
+
53
+ Releases are automated using [GitHub Actions](.github/workflows/release.yml):
54
+
55
+ * When a PR is merged on main the [test.yml](.github/workflows/test.yml) workflow is executed to run the tests.
56
+ * If the tests pass, the [release.yml](.github/workflows/release.yml) workflow will be executed.
57
+ * Depending on the commit message, a release PR will be created with the suggested version bump and changelog.
58
+ Note: Not all commit messages trigger a new release. For example, `chore: ...` will not trigger a release.
59
+ * If the release PR is merged, the [release.yml](.github/workflows/release.yml) workflow will be executed again, and this time it will create a GitHub release, bundle the gem, and push it to RubyGems.
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
64
+
65
+ [Honeybadger Insights]: https://www.honeybadger.io/tour/insights/
66
+ [Yabeda]: https://github.com/yabeda-rb/yabeda
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'yabeda/honeybadger-insights'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yabeda/base_adapter"
4
+ require "honeybadger"
5
+
6
+ module Yabeda
7
+ module HoneybadgerInsights
8
+ class Adapter < BaseAdapter
9
+ def register_counter!(counter)
10
+ end
11
+
12
+ def perform_counter_increment!(counter, tags, increment)
13
+ record_metric(counter, tags, increment, "counter")
14
+ end
15
+
16
+ def register_gauge!(gauge)
17
+ end
18
+
19
+ def perform_gauge_set!(gauge, tags, value)
20
+ record_metric(gauge, tags, value, "gauge")
21
+ end
22
+
23
+ def register_histogram!(histogram)
24
+ end
25
+
26
+ def perform_histogram_measure!(histogram, tags, value)
27
+ record_metric(histogram, tags, value, "histogram")
28
+ end
29
+
30
+ private
31
+
32
+ # Since Honeybadger Insights records metrics as logs, treat all metrics as events, regardless of type
33
+ def record_metric(metric, tags, value, type)
34
+ Honeybadger.event("metric", {
35
+ name: metric.name,
36
+ value: value,
37
+ tags: tags,
38
+ type: type,
39
+ group: metric.group,
40
+ unit: metric.unit
41
+ }.compact)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yabeda
4
+ module HoneybadgerInsights
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yabeda"
4
+ require "yabeda/honeybadger_insights/version"
5
+ require "yabeda/honeybadger_insights/adapter"
6
+
7
+ module Yabeda
8
+ module HoneybadgerInsights
9
+ class Error < StandardError; end
10
+ end
11
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/yabeda/honeybadger_insights/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "yabeda-honeybadger_insights"
7
+ spec.version = Yabeda::HoneybadgerInsights::VERSION
8
+ spec.authors = ["Benjamin Curtis"]
9
+ spec.email = ["ben@bencurtis.com"]
10
+
11
+ spec.summary = "Yabeda Honeybadger Insights adapter"
12
+ spec.homepage = "https://github.com/honeybadger-io/yabeda-honeybadger_insights"
13
+ spec.license = "MIT"
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/honeybadger-io/yabeda-honeybadger_insights"
17
+ spec.metadata["changelog_uri"] = "https://github.com/honeybadger-io/yabeda-honeybadger_insights/blob/master/CHANGELOG.md"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.required_ruby_version = ">= 2.3"
27
+
28
+ spec.add_dependency "honeybadger", ">= 5.5"
29
+ spec.add_dependency "yabeda", "~> 0.12"
30
+
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "rspec"
34
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yabeda-honeybadger_insights
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Benjamin Curtis
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: honeybadger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '5.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yabeda
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.12'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - ben@bencurtis.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".github/workflows/release.yml"
91
+ - ".github/workflows/test.yml"
92
+ - ".gitignore"
93
+ - ".tool-versions"
94
+ - CHANGELOG.md
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - lib/yabeda/honeybadger_insights.rb
102
+ - lib/yabeda/honeybadger_insights/adapter.rb
103
+ - lib/yabeda/honeybadger_insights/version.rb
104
+ - yabeda-honeybadger_insights.gemspec
105
+ homepage: https://github.com/honeybadger-io/yabeda-honeybadger_insights
106
+ licenses:
107
+ - MIT
108
+ metadata:
109
+ homepage_uri: https://github.com/honeybadger-io/yabeda-honeybadger_insights
110
+ source_code_uri: https://github.com/honeybadger-io/yabeda-honeybadger_insights
111
+ changelog_uri: https://github.com/honeybadger-io/yabeda-honeybadger_insights/blob/master/CHANGELOG.md
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '2.3'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubygems_version: 3.5.3
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Yabeda Honeybadger Insights adapter
131
+ test_files: []