prometheus_parser 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07be3476590d88af8f595b1a98c8373e7d92f6d50957e92afbdf2b1489a9fdbc
4
- data.tar.gz: 7339abafe9a6a064ee215189b03307c38bcc350989ac4e0d0e906ccf883f09be
3
+ metadata.gz: 918535ab98dcacc892e9c56c11296c9d7de44b918d4c7eea687b0a59a87b4796
4
+ data.tar.gz: 4079579c7abfc31b4586c452e48bbabe6ac4664e4f966668170989ea13a107b3
5
5
  SHA512:
6
- metadata.gz: fc6856638171409a5f8c9ef503727e6452e694fe5380452a60c86196473b3f14cc22f128a938edcf9b3286a2ea786dc08e42ebda7deeba979f42c2e12e289d4f
7
- data.tar.gz: 8ddd7ef3b50ff5a7697890b809b56631c9f123e3413146b60828839935d3dc93228cdea65518e33a0ac7001d015a4e17fc55f5b51b73ce0164234689ab88f6af
6
+ metadata.gz: 217e941af321f0a589bd024d207d071936660422976093c09936e60689636ca1a7add224aa67ba314edda6499ca4807a250812672e3be16c1343165ecf3a646f
7
+ data.tar.gz: 2f81966025c9c6604627bc45ea4500bbc56cf1e0c1d0ce7d84ed1794b6074e7d1549bffe154110c5e2f390194831a05250a25181d2fd44a5cc7d93c318bbbd75
@@ -0,0 +1,16 @@
1
+ on: [push,pull_request]
2
+
3
+ jobs:
4
+ build:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ ruby: [ 3.2.2 ]
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: ${{ matrix.ruby }}
15
+ - run: bundle install
16
+ - run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ coverage
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "https://rubygems.org"
2
+
3
+ ruby File.read(".ruby-version").strip
4
+
5
+ gem "dotenv"
6
+
7
+ group :development, :test do
8
+ gem "bundler"
9
+ gem "minitest"
10
+ gem "minitest-focus"
11
+ gem "minitest-hooks"
12
+ gem "minitest-line"
13
+ gem "minitest-reporters"
14
+ gem "rake"
15
+ gem "simplecov", require: false
16
+ gem "simplecov-csv"
17
+ gem "simplecov-lcov"
18
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ansi (1.5.0)
5
+ builder (3.2.4)
6
+ docile (1.4.0)
7
+ dotenv (2.8.1)
8
+ minitest (5.18.0)
9
+ minitest-focus (1.3.1)
10
+ minitest (>= 4, < 6)
11
+ minitest-hooks (1.5.0)
12
+ minitest (> 5.3)
13
+ minitest-line (0.6.5)
14
+ minitest (~> 5.0)
15
+ minitest-reporters (1.6.0)
16
+ ansi
17
+ builder
18
+ minitest (>= 5.0)
19
+ ruby-progressbar
20
+ rake (13.0.6)
21
+ ruby-progressbar (1.13.0)
22
+ simplecov (0.22.0)
23
+ docile (~> 1.1)
24
+ simplecov-html (~> 0.11)
25
+ simplecov_json_formatter (~> 0.1)
26
+ simplecov-csv (0.1.3)
27
+ simplecov
28
+ simplecov-html (0.12.3)
29
+ simplecov-lcov (0.8.0)
30
+ simplecov_json_formatter (0.1.4)
31
+
32
+ PLATFORMS
33
+ arm64-darwin-22
34
+
35
+ DEPENDENCIES
36
+ bundler
37
+ dotenv
38
+ minitest
39
+ minitest-focus
40
+ minitest-hooks
41
+ minitest-line
42
+ minitest-reporters
43
+ rake
44
+ simplecov
45
+ simplecov-csv
46
+ simplecov-lcov
47
+
48
+ RUBY VERSION
49
+ ruby 3.2.2p53
50
+
51
+ BUNDLED WITH
52
+ 2.4.11
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 84codes
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,2 @@
1
+ # prometheus_parser
2
+ Parse prometheus metrics
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/setup"
2
+ require "rake/testtask"
3
+ require "dotenv/load"
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "spec"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["spec/**/*_spec.rb"]
9
+ end
10
+
11
+ task default: :test
@@ -8,13 +8,13 @@ class PrometheusParser
8
8
  KEY_RE = /[\w:]+/
9
9
  VALUE_RE = /-?\d+\.?\d*E?-?\d*|NaN/
10
10
  ATTR_KEY_RE = /[ \w-]+/
11
- ATTR_VALUE_RE = %r{\s*"([\\"'\sa-zA-Z0-9\-_/.+~]*)"\s*} # /\s*"(\S*)"\s*/
11
+ ATTR_VALUE_RE = %r{\s*"([\\"'\sa-zA-Z0-9\-_/.+~@;=]*)"\s*} # /\s*"(\S*)"\s*/
12
12
 
13
13
  def self.parse(raw)
14
14
  s = StringScanner.new(raw)
15
15
  res = []
16
16
  until s.eos?
17
- if s.peek(1) == "#" # Skip comment lines
17
+ if s.peek(1) == "#" || s.peek(1) == "\n" # Skip comment and empty lines
18
18
  s.scan(/.*\n/)
19
19
  next
20
20
  end
@@ -0,0 +1,13 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "prometheus_parser"
3
+ s.version = "0.2.1"
4
+ s.summary = "Parse prometheus metrics"
5
+ s.authors = ["Magnus Landerblom"]
6
+ s.email = "mange@84codes.com"
7
+ s.files = Dir.chdir(File.expand_path(__dir__)) do
8
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
9
+ end
10
+ s.homepage =
11
+ "https://rubygems.org/gems/prometheus_parser"
12
+ s.license = "MIT"
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus Landerblom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: mange@84codes.com
@@ -16,7 +16,16 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - lib/parser.rb
19
+ - ".github/workflows/ci.yml"
20
+ - ".gitignore"
21
+ - ".ruby-version"
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - lib/prometheus_parser.rb
28
+ - prometheus_parser.gemspec
20
29
  homepage: https://rubygems.org/gems/prometheus_parser
21
30
  licenses:
22
31
  - MIT
@@ -36,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
45
  - !ruby/object:Gem::Version
37
46
  version: '0'
38
47
  requirements: []
39
- rubygems_version: 3.4.12
48
+ rubygems_version: 3.4.10
40
49
  signing_key:
41
50
  specification_version: 4
42
51
  summary: Parse prometheus metrics