riemann-valkey 1.0.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 +7 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/ci.yml +45 -0
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/.simplecov +7 -0
- data/Gemfile +12 -0
- data/README.md +13 -0
- data/Rakefile +20 -0
- data/bin/riemann-valkey +8 -0
- data/lib/riemann/tools/valkey/version.rb +9 -0
- data/lib/riemann/tools/valkey.rb +44 -0
- data/riemann-valkey.gemspec +35 -0
- metadata +86 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ee49d80a95b0b42bf94b1c96329eba9327f72bcd0b20655596c0e9bb759dae64
|
|
4
|
+
data.tar.gz: 28468a6f097b4a6481098d4cd73c1a4b9312fa4b930c900f70d7c2e89d0c9194
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 36e6a2c8659e85d2dce3ad44beeafa716880d1a2010e3c5fc03df92975f5f6ea504ec0e2923fa09036ba1d3baef958fda2a5ad3d233449986396e8590c152a79
|
|
7
|
+
data.tar.gz: 30993467a972d9a1410a1deacb776e084ecddb265d5834ea75e5e026da647b5a74c4e7ffb54e08e0e73cebe086f5db41bb2ad3beab3b4940faca29d74b677d69
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @opus-codium/core
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CI
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
standard:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
- name: Setup ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: 3.0
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
- name: Run static code analysis
|
|
23
|
+
run: bundle exec standardrb
|
|
24
|
+
unit:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
needs: standard
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
ruby:
|
|
30
|
+
- "2.6"
|
|
31
|
+
- "2.7"
|
|
32
|
+
- "3.0"
|
|
33
|
+
- "3.1"
|
|
34
|
+
- "3.2"
|
|
35
|
+
- "3.3"
|
|
36
|
+
name: Ruby ${{ matrix.ruby }}
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v6
|
|
39
|
+
- name: Setup ruby
|
|
40
|
+
uses: ruby/setup-ruby@v1
|
|
41
|
+
with:
|
|
42
|
+
ruby-version: ${{ matrix.ruby }}
|
|
43
|
+
bundler-cache: true
|
|
44
|
+
- name: Run tests without uploading code coverage
|
|
45
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.simplecov
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# riemann-valkey
|
|
2
|
+
|
|
3
|
+
[](https://github.com/opus-codium/riemann-valkey/actions/workflows/ci.yml)
|
|
4
|
+
[](https://codeclimate.com/github/opus-codium/riemann-valkey/maintainability)
|
|
5
|
+
[](https://codeclimate.com/github/opus-codium/riemann-valkey/test_coverage)
|
|
6
|
+
|
|
7
|
+
Submits valkey information to riemann.
|
|
8
|
+
|
|
9
|
+
## Get started
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
gem install riemann-valkey
|
|
13
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "riemann/tools/valkey/version"
|
|
4
|
+
|
|
5
|
+
require "bundler/gem_tasks"
|
|
6
|
+
require "rspec/core/rake_task"
|
|
7
|
+
|
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
+
|
|
10
|
+
task default: :spec
|
|
11
|
+
|
|
12
|
+
require "github_changelog_generator/task"
|
|
13
|
+
|
|
14
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
15
|
+
config.user = "opus-codium"
|
|
16
|
+
config.project = "riemann-valkey"
|
|
17
|
+
config.exclude_labels = %w[dependencies skip-changelog]
|
|
18
|
+
config.future_release = "v#{Riemann::Tools::Valkey::VERSION}"
|
|
19
|
+
config.since_tag = "v1.0.0"
|
|
20
|
+
end
|
data/bin/riemann-valkey
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "redis"
|
|
4
|
+
|
|
5
|
+
require "riemann/tools"
|
|
6
|
+
|
|
7
|
+
module Riemann
|
|
8
|
+
module Tools
|
|
9
|
+
class Valkey
|
|
10
|
+
include Riemann::Tools
|
|
11
|
+
|
|
12
|
+
attr_reader :redis
|
|
13
|
+
|
|
14
|
+
def initialize
|
|
15
|
+
@redis = Redis.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def tick
|
|
19
|
+
redis = Redis.new
|
|
20
|
+
memory_info = redis.info("MEMORY")
|
|
21
|
+
used_memory = memory_info["used_memory"].to_i
|
|
22
|
+
maxmemory = memory_info["maxmemory"].to_i
|
|
23
|
+
|
|
24
|
+
memory_usage = used_memory.to_f / maxmemory
|
|
25
|
+
report({
|
|
26
|
+
service: "valkey memory",
|
|
27
|
+
metric: memory_usage,
|
|
28
|
+
state: memory_state(memory_usage),
|
|
29
|
+
description: format("%.2f %%", memory_usage * 100)
|
|
30
|
+
})
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def memory_state(metric)
|
|
34
|
+
if metric > 0.95
|
|
35
|
+
"critical"
|
|
36
|
+
elsif metric > 0.8
|
|
37
|
+
"warning"
|
|
38
|
+
else
|
|
39
|
+
"ok"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/riemann/tools/valkey/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "riemann-valkey"
|
|
7
|
+
spec.version = Riemann::Tools::Valkey::VERSION
|
|
8
|
+
spec.authors = ["Romain Tartière"]
|
|
9
|
+
spec.email = ["romain@blogreen.org"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Submits valkey information to riemann"
|
|
12
|
+
spec.homepage = "https://github.com/opus-codium/riemann-valkey"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
|
15
|
+
|
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
|
21
|
+
|
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
23
|
+
|
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "bin"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_dependency "redis", "~> 5.0"
|
|
34
|
+
spec.add_dependency "riemann-tools", "~> 1.0"
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: riemann-valkey
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Romain Tartière
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: redis
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: riemann-tools
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
40
|
+
email:
|
|
41
|
+
- romain@blogreen.org
|
|
42
|
+
executables:
|
|
43
|
+
- riemann-valkey
|
|
44
|
+
extensions: []
|
|
45
|
+
extra_rdoc_files: []
|
|
46
|
+
files:
|
|
47
|
+
- ".github/CODEOWNERS"
|
|
48
|
+
- ".github/dependabot.yml"
|
|
49
|
+
- ".github/workflows/ci.yml"
|
|
50
|
+
- ".gitignore"
|
|
51
|
+
- ".rspec"
|
|
52
|
+
- ".simplecov"
|
|
53
|
+
- Gemfile
|
|
54
|
+
- README.md
|
|
55
|
+
- Rakefile
|
|
56
|
+
- bin/riemann-valkey
|
|
57
|
+
- lib/riemann/tools/valkey.rb
|
|
58
|
+
- lib/riemann/tools/valkey/version.rb
|
|
59
|
+
- riemann-valkey.gemspec
|
|
60
|
+
homepage: https://github.com/opus-codium/riemann-valkey
|
|
61
|
+
licenses:
|
|
62
|
+
- MIT
|
|
63
|
+
metadata:
|
|
64
|
+
allowed_push_host: https://rubygems.org/
|
|
65
|
+
homepage_uri: https://github.com/opus-codium/riemann-valkey
|
|
66
|
+
source_code_uri: https://github.com/opus-codium/riemann-valkey
|
|
67
|
+
changelog_uri: https://github.com/opus-codium/riemann-valkey
|
|
68
|
+
rubygems_mfa_required: 'true'
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
require_paths:
|
|
71
|
+
- lib
|
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: 2.6.0
|
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
requirements: []
|
|
83
|
+
rubygems_version: 3.7.2
|
|
84
|
+
specification_version: 4
|
|
85
|
+
summary: Submits valkey information to riemann
|
|
86
|
+
test_files: []
|