breakers 0.5.0 → 0.6.0

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: eb4f99f9230a8a77ef80b47b9c06582f7e885f0f52f52998b1c92fa61070bb0b
4
- data.tar.gz: 78ec47202acff0af6961a7be2f8735103360bc976df6e32df3ab94eb0de79533
3
+ metadata.gz: ad133329d77aaebd6649aeb90149e8d29a6f9c83d51308cf02a713e45d259827
4
+ data.tar.gz: dbaa15f21f7cafb3a48cc608eaee3fff21c9fed20842a741e48983bab3238efc
5
5
  SHA512:
6
- metadata.gz: 158c40c57705a319eb1683f27f5fc58fe6da8786e59faf4d7ea05c5868333e55e1885eb8eaa005bb0564ad57931a18eddc12c0278a86ee2ef382820927392b87
7
- data.tar.gz: d5551fdb570642bb96b0cce674efed1e470454542793d5696a15eace950ed7dd73acde565ff515d790b0157936cb9b3b70f758cf6de8dfc6403aa30e4c4c17c1
6
+ metadata.gz: 445663bcb0ef02971e1ba4bc64a4ccecda8425aefdf51914e8142a4c21728a2db1263c01b4421bf541ad439dc6803f9a1733178c2e200744a33a713fc01289e9
7
+ data.tar.gz: 72c7d97b38850f69cb93a8f85a14732459cb62913f161d5d5ccc218946f383276641d4a2f4fb5bb59ac390c339efc3f5411de0878e6a021260d094b870508ee7
@@ -0,0 +1,46 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ # The branches below must be a subset of the branches above
8
+ branches: [ master ]
9
+ schedule:
10
+ - cron: '27 2 * * 1'
11
+
12
+ jobs:
13
+ analyze:
14
+ name: Analyze
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v2
20
+
21
+ # Initializes the CodeQL tools for scanning.
22
+ - name: Initialize CodeQL
23
+ uses: github/codeql-action/init@v1
24
+ # If you wish to specify custom queries, you can do so here or in a config file.
25
+ # By default, queries listed here will override any specified in a config file.
26
+ # Prefix the list here with "+" to use these queries and those in the config file.
27
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
28
+
29
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
30
+ # If this step fails, then you should remove it and run the build manually (see below)
31
+ - name: Autobuild
32
+ uses: github/codeql-action/autobuild@v1
33
+
34
+ # ℹ️ Command-line programs to run using the OS shell.
35
+ # 📚 https://git.io/JvXDl
36
+
37
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
38
+ # and modify them (or add more) to build your code if your project
39
+ # uses a compiled language
40
+
41
+ #- run: |
42
+ # make bootstrap
43
+ # make release
44
+
45
+ - name: Perform CodeQL Analysis
46
+ uses: github/codeql-action/analyze@v1
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,88 @@
1
+ <!-- markdownlint-disable MD013 -->
2
+ <!-- omit in toc -->
3
+ # Contributing to breakers
4
+
5
+ First off, thanks for taking the time to contribute! :heart:
6
+
7
+ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us project owners and smooth out the experience for all involved. The team looks forward to your contributions. :tada:
8
+
9
+ <!-- omit in toc -->
10
+ ## Table of Contents
11
+
12
+ - [I Have a Question](#i-have-a-question)
13
+ - [I Want To Contribute](#i-want-to-contribute)
14
+ - [Reporting Bugs](#reporting-bugs)
15
+ - [Suggesting Enhancements](#suggesting-enhancements)
16
+
17
+ ## I Have a Question
18
+
19
+ Before you ask a question, it is best to search for existing [Issues](https://github.com/department-of-veterans-affairs/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue.
20
+
21
+ If you then still feel the need to ask a question and need clarification, we recommend the following:
22
+
23
+ - Open an [Issue](https://github.com/department-of-veterans-affairs/breakers/issues/new).
24
+ - Provide as much context as you can about what you're running into.
25
+ - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
26
+
27
+ We will then take care of the issue as soon as possible.
28
+
29
+ ## I Want To Contribute
30
+
31
+ > ### Legal Notice <!-- omit in toc -->
32
+ > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
33
+
34
+ ## Reporting Bugs
35
+
36
+ <!-- omit in toc -->
37
+ ### Before Submitting a Bug Report
38
+
39
+ A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
40
+
41
+ - Make sure that you are using the latest version.
42
+ - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation. If you are looking for support, you might want to check [this section](#i-have-a-question)).
43
+ - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/department-of-veterans-affairs/breakers/issues).
44
+ - Collect information about the bug:
45
+ - Stack trace (Traceback)
46
+ - OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
47
+ - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
48
+ - Possibly your input and the output
49
+ - Can you reliably reproduce the issue? And can you also reproduce it with older versions?
50
+
51
+ <!-- omit in toc -->
52
+ ### How Do I Submit a Good Bug Report?
53
+
54
+ We use GitHub issues to track bugs and errors. If you run into an issue with the project:
55
+
56
+ - Open an [Issue](https://github.com/department-of-veterans-affairs/breakers/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
57
+ - Explain the behavior you would expect and the actual behavior.
58
+ - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
59
+ - Provide the information you collected in the previous section.
60
+
61
+ Once it's filed:
62
+
63
+ - The project team will label the issue accordingly.
64
+ - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
65
+ - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone.
66
+
67
+ ## Suggesting Enhancements
68
+
69
+ This section guides you through submitting an enhancement suggestion for breakers, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
70
+
71
+ <!-- omit in toc -->
72
+ ### Before Submitting an Enhancement
73
+
74
+ - Make sure that you are using the latest version.
75
+ - Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration.
76
+ - Perform a [search](https://github.com/department-of-veterans-affairs/breakers/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
77
+ - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature or to develop the feature yourself and contribute it to the project.
78
+
79
+ <!-- omit in toc -->
80
+ ### How Do I Submit a Good Enhancement Suggestion?
81
+
82
+ Enhancement suggestions are tracked as [GitHub issues](https://github.com/department-of-veterans-affairs/breakers/issues).
83
+
84
+ - Use a **clear and descriptive title** for the issue to identify the suggestion.
85
+ - Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
86
+ - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
87
+ - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to.
88
+ - **Explain why this enhancement would be useful** to most breakers users.
@@ -132,9 +132,9 @@ module Breakers
132
132
  end
133
133
 
134
134
  def replace_body(body:)
135
- Breakers.client.redis_connection.multi do
136
- Breakers.client.redis_connection.zrem(key, MultiJson.dump(@body))
137
- Breakers.client.redis_connection.zadd(key, start_time.to_i, MultiJson.dump(body))
135
+ Breakers.client.redis_connection.multi do |pipeline|
136
+ pipeline.zrem(key, MultiJson.dump(@body))
137
+ pipeline.zadd(key, start_time.to_i, MultiJson.dump(body))
138
138
  end
139
139
  @body = body
140
140
  end
@@ -143,9 +143,9 @@ module Breakers
143
143
  end
144
144
 
145
145
  def increment_key(key:)
146
- Breakers.client.redis_connection.multi do
147
- Breakers.client.redis_connection.incr(key)
148
- Breakers.client.redis_connection.expire(key, @configuration[:data_retention_seconds])
146
+ Breakers.client.redis_connection.multi do |pipeline|
147
+ pipeline.incr(key)
148
+ pipeline.expire(key, @configuration[:data_retention_seconds])
149
149
  end
150
150
  end
151
151
 
@@ -156,11 +156,11 @@ module Breakers
156
156
  end
157
157
 
158
158
  def maybe_create_outage
159
- data = Breakers.client.redis_connection.multi do
160
- Breakers.client.redis_connection.get(errors_key(time: Time.now.utc))
161
- Breakers.client.redis_connection.get(errors_key(time: Time.now.utc - 60))
162
- Breakers.client.redis_connection.get(successes_key(time: Time.now.utc))
163
- Breakers.client.redis_connection.get(successes_key(time: Time.now.utc - 60))
159
+ data = Breakers.client.redis_connection.multi do |pipeline|
160
+ pipeline.get(errors_key(time: Time.now.utc))
161
+ pipeline.get(errors_key(time: Time.now.utc - 60))
162
+ pipeline.get(successes_key(time: Time.now.utc))
163
+ pipeline.get(successes_key(time: Time.now.utc - 60))
164
164
  end
165
165
  failure_count = data[0].to_i + data[1].to_i
166
166
  success_count = data[2].to_i + data[3].to_i
@@ -1,3 +1,3 @@
1
1
  module Breakers
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breakers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aubrey Holland
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-17 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -178,10 +178,12 @@ executables: []
178
178
  extensions: []
179
179
  extra_rdoc_files: []
180
180
  files:
181
+ - ".github/workflows/codeql.yml"
181
182
  - ".gitignore"
182
183
  - ".rspec"
183
184
  - ".rubocop.yml"
184
185
  - ".travis.yml"
186
+ - CONTRIBUTING.md
185
187
  - Gemfile
186
188
  - LICENSE.md
187
189
  - README.md