grafana_annotations 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b8f824ed8c6d9b1a0c170564819962895aa7b1e28b205943f10c50747d60742
4
- data.tar.gz: 3f8244937b2ee09e8f1d7eec67f553f51c0165257f68bcabe70d1c45783a859b
3
+ metadata.gz: e267c0a1a55c4ef041a2265d4b0f5c196cfef80e45a99c94d959bc053bbc5c17
4
+ data.tar.gz: b0803367808f76bd1d841bb38992e240fc6a3a6e0bd3bb2941289503fa842d91
5
5
  SHA512:
6
- metadata.gz: d4aa25b46e25cb0bb08d60459c3fbbdfaf11f8a19a2c5f64e3e0c039eeb7276d5907868748bfdc15504f1a8c723cd1c7862daf672a24436f166af63f516ce238
7
- data.tar.gz: 20037e0fbd7e636c1b341991e270ef0c9808de853e9e79b13480a3b926aa2259a1e2895170d217d4be63f64e72e887796946dd1dac8d40e889af328c98e15473
6
+ metadata.gz: bdccb1742d90c8c6a48038ca8a9f2e1dcd3b7c1bdb13ebe069edcfcca6c029963317647ed31fa56b4dfa9acef63105dd70dfe96f5493c80009567b78b5f1ab1e
7
+ data.tar.gz: c28f18dfb730fabc2d170c3b2afad4daca5c06c2870920b3acf4153c72a7eab878988fc2e10bb30a221f5270369ba33b32ff6ad6857abf67d9e64a8afa227145
data/.bumpversion.cfg CHANGED
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.1.0
2
+ current_version = 0.1.1
3
3
  commit = True
4
4
  tag = True
5
5
  tag_name = {new_version}
@@ -10,5 +10,5 @@ message = bump version {current_version} → {new_version}
10
10
  [bumpversion:file:README.md]
11
11
 
12
12
  [bumpversion:file:Gemfile.lock]
13
- search = http_health_check ({current_version})
14
- replace = http_health_check ({new_version})
13
+ search = grafana_annotations ({current_version})
14
+ replace = grafana_annotations ({new_version})
@@ -15,10 +15,13 @@ jobs:
15
15
  steps:
16
16
  - uses: actions/checkout@v3
17
17
  - name: Set up Ruby
18
- uses: ruby/setup-ruby@v1
18
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
19
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
20
+ # uses: ruby/setup-ruby@v1
21
+ uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
19
22
  with:
20
- bundler-cache: true
21
- ruby-version: ${{ matrix.ruby }}
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
22
25
  - name: Run all tests
23
26
  run: bundle exec rspec
24
27
  - name: Run rubocop
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.idea
10
+ grafana_annotations-*.gem
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG.md
2
2
 
3
+ ## 0.1.1 (2022-09-02)
4
+
5
+ Features:
6
+
7
+ - use default value for `GrafanaAnnotations::Annotation.time`
8
+ - add `GrafanaAnnotations#configured?` for ready-state probing
9
+
10
+
3
11
  ## 0.1.0 (2022-07-21)
4
12
 
5
13
  Features:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grafana_annotations (http_health_check (0.1.0))
4
+ grafana_annotations (0.1.1)
5
5
  dry-initializer
6
6
  dry-monads
7
7
  dry-struct
@@ -11,25 +11,25 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- addressable (2.7.0)
14
+ addressable (2.8.0)
15
15
  public_suffix (>= 2.0.2, < 5.0)
16
16
  ast (2.4.2)
17
17
  concurrent-ruby (1.1.10)
18
- crack (0.4.3)
19
- safe_yaml (~> 1.0.0)
18
+ crack (0.4.5)
19
+ rexml
20
20
  diff-lcs (1.5.0)
21
- dry-configurable (0.12.0)
21
+ dry-configurable (0.12.1)
22
22
  concurrent-ruby (~> 1.0)
23
23
  dry-core (~> 0.5, >= 0.5.0)
24
24
  dry-container (0.7.2)
25
25
  concurrent-ruby (~> 1.0)
26
26
  dry-configurable (~> 0.1, >= 0.1.3)
27
- dry-core (0.5.0)
27
+ dry-core (0.6.0)
28
28
  concurrent-ruby (~> 1.0)
29
29
  dry-equalizer (0.3.0)
30
30
  dry-inflector (0.2.0)
31
31
  dry-initializer (3.0.4)
32
- dry-logic (1.1.0)
32
+ dry-logic (1.2.0)
33
33
  concurrent-ruby (~> 1.0)
34
34
  dry-core (~> 0.5, >= 0.5)
35
35
  dry-monads (1.3.5)
@@ -40,24 +40,42 @@ GEM
40
40
  dry-core (~> 0.5, >= 0.5)
41
41
  dry-types (~> 1.5)
42
42
  ice_nine (~> 0.11)
43
- dry-types (1.5.0)
43
+ dry-types (1.5.1)
44
44
  concurrent-ruby (~> 1.0)
45
45
  dry-container (~> 0.3)
46
46
  dry-core (~> 0.5, >= 0.5)
47
47
  dry-inflector (~> 0.1, >= 0.1.2)
48
48
  dry-logic (~> 1.0, >= 1.0.2)
49
- faraday (1.3.0)
49
+ faraday (1.10.0)
50
+ faraday-em_http (~> 1.0)
51
+ faraday-em_synchrony (~> 1.0)
52
+ faraday-excon (~> 1.1)
53
+ faraday-httpclient (~> 1.0)
54
+ faraday-multipart (~> 1.0)
50
55
  faraday-net_http (~> 1.0)
51
- multipart-post (>= 1.2, < 3)
52
- ruby2_keywords
56
+ faraday-net_http_persistent (~> 1.0)
57
+ faraday-patron (~> 1.0)
58
+ faraday-rack (~> 1.0)
59
+ faraday-retry (~> 1.0)
60
+ ruby2_keywords (>= 0.0.4)
61
+ faraday-em_http (1.0.0)
62
+ faraday-em_synchrony (1.0.0)
63
+ faraday-excon (1.1.0)
64
+ faraday-httpclient (1.0.1)
65
+ faraday-multipart (1.0.4)
66
+ multipart-post (~> 2)
53
67
  faraday-net_http (1.0.1)
54
- hashdiff (0.4.0)
68
+ faraday-net_http_persistent (1.2.0)
69
+ faraday-patron (1.0.0)
70
+ faraday-rack (1.0.0)
71
+ faraday-retry (1.0.3)
72
+ hashdiff (1.0.1)
55
73
  ice_nine (0.11.2)
56
- multipart-post (2.1.1)
74
+ multipart-post (2.2.3)
57
75
  parallel (1.22.1)
58
76
  parser (3.1.2.0)
59
77
  ast (~> 2.4.1)
60
- public_suffix (4.0.6)
78
+ public_suffix (4.0.7)
61
79
  rainbow (3.1.1)
62
80
  rake (13.0.6)
63
81
  regexp_parser (2.5.0)
@@ -87,16 +105,16 @@ GEM
87
105
  rubocop-ast (1.17.0)
88
106
  parser (>= 3.1.1.0)
89
107
  ruby-progressbar (1.11.0)
90
- ruby2_keywords (0.0.4)
91
- safe_yaml (1.0.5)
108
+ ruby2_keywords (0.0.5)
92
109
  unicode-display_width (1.8.0)
93
- webmock (3.3.0)
94
- addressable (>= 2.3.6)
110
+ webmock (3.14.0)
111
+ addressable (>= 2.8.0)
95
112
  crack (>= 0.3.2)
96
- hashdiff
113
+ hashdiff (>= 0.4.0, < 2.0.0)
97
114
 
98
115
  PLATFORMS
99
116
  x86_64-darwin-21
117
+ x86_64-linux
100
118
 
101
119
  DEPENDENCIES
102
120
  grafana_annotations!
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # GrafanaAnnotations
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/grafana_annotations.svg)](https://badge.fury.io/rb/grafana_annotations)
4
+
3
5
  Add custom annotations to grafana from your ruby application.
4
6
 
5
7
  ## Installation
@@ -7,7 +9,7 @@ Add custom annotations to grafana from your ruby application.
7
9
  Add this line to your application's Gemfile:
8
10
 
9
11
  ```ruby
10
- gem 'grafana_annotations', '~> 0.1.0'
12
+ gem 'grafana_annotations', '~> 0.1.1'
11
13
  ```
12
14
 
13
15
  And then execute:
@@ -45,7 +47,7 @@ end
45
47
 
46
48
  ```ruby
47
49
  result = GrafanaAnnotations.default_api_client.create(
48
- time: GrafanaAnnotations::Utils::Time.now_ms, # timestamp in milliseconds (integer)
50
+ time: GrafanaAnnotations::Utils::Time.now_ms, # timestamp in milliseconds (integer), optional
49
51
  tags: [:my_app, :my_event],
50
52
  text: "Boom!"
51
53
  )
@@ -64,6 +66,7 @@ end
64
66
  ### Rake tasks instrumentation
65
67
 
66
68
  Just require `grafana_annotations/rake` within your Rakefile and annotation request will be sent for every rake task.
69
+
67
70
  ```ruby
68
71
  # Rakefile
69
72
  require 'grafana_annotations/rake'
@@ -4,7 +4,7 @@ module GrafanaAnnotations
4
4
  class Annotation < Dry::Struct
5
5
  attribute? :dashboardUID, Types::Strict::String.optional
6
6
  attribute? :panelId, Types::Strict::String.optional
7
- attribute :time, Types::Strict::Integer
7
+ attribute(:time, Types::Strict::Integer.default { GrafanaAnnotations::Utils::Time.now_ms })
8
8
  attribute? :timeEnd, Types::Strict::Integer
9
9
  attribute :tags, Types::Strict::Array.of(Types::Coercible::String)
10
10
  attribute :text, Types::Strict::String
@@ -4,7 +4,7 @@ module GrafanaAnnotations
4
4
  module Rake
5
5
  module Task
6
6
  def invoke(*args)
7
- return super unless GrafanaAnnotations.config
7
+ return super unless GrafanaAnnotations.configured?
8
8
 
9
9
  text = [GrafanaAnnotations.config.rake_text_prefix, name].join(' ')
10
10
  text += " #{args.inspect}" unless args.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrafanaAnnotations
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -29,16 +29,22 @@ module GrafanaAnnotations
29
29
  raise ConfigurationError, e.message
30
30
  end
31
31
 
32
+ def configured?
33
+ config.is_a? GrafanaAnnotations::Config
34
+ end
35
+
32
36
  def default_api_client
33
37
  @default_api_client ||= begin
34
- raise ConfigurationError, 'todo' unless config
38
+ unless configured?
39
+ raise ConfigurationError, 'Use GrafanaAnnotations.configure in initializer (see https://github.com/SberMarket-Tech/grafana_annotations#configuration)'
40
+ end
35
41
 
36
42
  new_api_client({})
37
43
  end
38
44
  end
39
45
 
40
46
  def new_api_client(opts)
41
- return ApiClient.new(opts) unless config
47
+ return ApiClient.new(opts) unless configured?
42
48
 
43
49
  ApiClient.new(
44
50
  opts.merge(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grafana_annotations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SberMarket Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-21 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer