rpush-plugin-prometheus-exporter 0.0.1

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: 4725f8c48f778c8576fcfbed906658c42624dc92201433dc97b53ec2a3983527
4
+ data.tar.gz: 03cfc925aa102d67254f519f5564c2a8829fe2223f9fd29ecea61c6f168e67fa
5
+ SHA512:
6
+ metadata.gz: 159783d7a0010c4c9a903d9ed23ef87fd838ee392abde16212445a39530b04842c0bbf0434bc2b2e916e2c9f3cd541a63eac802f88c67a71d0527bcfe99643d9
7
+ data.tar.gz: 916826bce8c4b1b8174a04a3c0eccc98ae4c61a2e99aaf3190aa291525e22e94586f8fe06b73daa9a82d4d0fd3fa67838cb6ffe0c82a4cc7d2fabb2fed35091f
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ AllCops:
2
+ Exclude:
3
+ - lib/generators/**/*
4
+
5
+ LineLength:
6
+ Enabled: false
7
+
8
+ StringLiterals:
9
+ Enabled: false
10
+
11
+ Documentation:
12
+ Enabled: false
13
+
14
+ MethodLength:
15
+ Enabled: false
16
+
17
+ ClassLength:
18
+ Enabled: false
19
+
20
+ CyclomaticComplexity:
21
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rpush-plugin-prometheus-exporter
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.3
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rubocop"
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 equinux
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # rpush-plugin-prometheus-exporter
2
+
3
+ Rpush plugin for exporting metrics to prometheus_exporter
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rpush-plugin-prometheus-exporter'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rpush-plugin-prometheus-exporter
20
+
21
+ ## Configuration
22
+
23
+ ```ruby
24
+ Rpush.config do |config|
25
+ config.plugin.prometheus_exporter do |plugin_config|
26
+ plugin_config.host = "127.0.0.1"
27
+ plugin_config.port = 9394
28
+ end
29
+ end
30
+ ```
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/[my-github-username]/rpush-plugin-prometheus-exporter/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,31 @@
1
+ require "prometheus_exporter/client"
2
+
3
+ plugin = Rpush.plugin(:prometheus_exporter)
4
+ plugin.url = "https://github.com/equinux/rpush-plugin-prometheus-exporter"
5
+ plugin.description = "Rpush plugin to send stats to prometheus_exporter."
6
+
7
+ plugin.configure do |config|
8
+ config.host = "localhost"
9
+ config.port = 9394
10
+ end
11
+
12
+ REFLECTIONS = [:error, :apns_feedback, :notification_enqueued, :notification_delivered,
13
+ :notification_failed, :notification_id_failed, :notification_will_retry,
14
+ :notification_id_will_retry, :tcp_connection_lost, :gcm_delivered_to_recipient,
15
+ :gcm_failed_to_recipient, :gcm_invalid_registration_id, :adm_failed_to_recipient]
16
+
17
+ plugin.reflect do |on|
18
+ REFLECTIONS.each do |reflection|
19
+ block = ->(*args) { @counter.observe(1, event: reflection.to_s) }
20
+ on.send(reflection, &block)
21
+ end
22
+ end
23
+
24
+ plugin.init do
25
+ PrometheusExporter::Metric::Base.default_prefix = "rpush"
26
+ @client = PrometheusExporter::Client.new(
27
+ host: plugin.config.host,
28
+ port: plugin.config.port,
29
+ )
30
+ @counter = @client.register(:counter, "rpush", "Rpush event counter")
31
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ Gem::Specification.new do |spec|
3
+ spec.name = "rpush-plugin-prometheus-exporter"
4
+ spec.version = "0.0.1"
5
+ spec.authors = ["Maximilian Szengel"]
6
+ spec.email = ["szengel@equinux.com"]
7
+ spec.summary = "Rpush plugin for prometheus_exporter."
8
+ spec.description = "Instrument Rpush with prometheus."
9
+ spec.homepage = "https://github.com/equinux/rpush-plugin-prometheus-exporter"
10
+ spec.license = "MIT"
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_dependency "prometheus_exporter", "~> 0.7.0"
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.7"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rpush-plugin-prometheus-exporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Maximilian Szengel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prometheus_exporter
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Instrument Rpush with prometheus.
56
+ email:
57
+ - szengel@equinux.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rubocop.yml"
64
+ - ".ruby-gemset"
65
+ - ".ruby-version"
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - lib/rpush/plugin/prometheus_exporter.rb
71
+ - rpush-plugin-prometheus-exporter.gemspec
72
+ homepage: https://github.com/equinux/rpush-plugin-prometheus-exporter
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.1.4
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Rpush plugin for prometheus_exporter.
95
+ test_files: []