From 58867d91607a4e43fd642d091a0eabd107233d1c Mon Sep 17 00:00:00 2001 From: Keifer Furzland Date: Mon, 25 Nov 2019 15:28:02 -0600 Subject: [PATCH 1/7] Update Faraday client to latest minor version (#12) * Update Faraday client to latest minor version --- breakers.gemspec | 2 +- lib/breakers/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/breakers.gemspec b/breakers.gemspec index dc99992..edce1bb 100644 --- a/breakers.gemspec +++ b/breakers.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_dependency 'faraday', ['>= 0.7.4', '< 0.10'] + spec.add_dependency 'faraday', ['>= 0.7.4', '< 0.18'] spec.add_dependency 'multi_json', '~> 1.0' spec.add_development_dependency 'bundler', '~> 1.0' diff --git a/lib/breakers/version.rb b/lib/breakers/version.rb index e4762e3..7abb420 100644 --- a/lib/breakers/version.rb +++ b/lib/breakers/version.rb @@ -1,3 +1,3 @@ module Breakers - VERSION = '0.2.4'.freeze + VERSION = '0.3.0'.freeze end From 25db035082edb8f0da005306300cbbaa32ee24df Mon Sep 17 00:00:00 2001 From: Johnny Holton Date: Mon, 12 Oct 2020 14:00:30 -0400 Subject: [PATCH 2/7] update UptimeMiddleware to return `duration` in milliseconds instead of seconds (#13) --- lib/breakers/uptime_middleware.rb | 2 +- lib/breakers/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/breakers/uptime_middleware.rb b/lib/breakers/uptime_middleware.rb index 242051d..60e8d3e 100644 --- a/lib/breakers/uptime_middleware.rb +++ b/lib/breakers/uptime_middleware.rb @@ -54,7 +54,7 @@ def outage_response(outage:, service:) def handle_request(service:, request_env:, current_outage: nil) start_time = Time.now return @app.call(request_env).on_complete do |response_env| - response_env[:duration] = Time.now - start_time + response_env[:duration] = (Time.now - start_time) * 1000 if response_env.status >= 500 handle_error( service: service, diff --git a/lib/breakers/version.rb b/lib/breakers/version.rb index 7abb420..3f29d2c 100644 --- a/lib/breakers/version.rb +++ b/lib/breakers/version.rb @@ -1,3 +1,3 @@ module Breakers - VERSION = '0.3.0'.freeze + VERSION = '0.4.0'.freeze end From 657cd3eb1fcac03f5427f6de8a61e62e87f54d27 Mon Sep 17 00:00:00 2001 From: Lindsey Hattamer Date: Fri, 14 May 2021 11:52:01 -0400 Subject: [PATCH 3/7] Bump faraday constraint (#15) * bump faraday version dependency * bump breakers version --- breakers.gemspec | 2 +- lib/breakers/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/breakers.gemspec b/breakers.gemspec index edce1bb..12b503a 100644 --- a/breakers.gemspec +++ b/breakers.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_dependency 'faraday', ['>= 0.7.4', '< 0.18'] + spec.add_dependency 'faraday', ['>= 0.7.4', '< 2.0'] spec.add_dependency 'multi_json', '~> 1.0' spec.add_development_dependency 'bundler', '~> 1.0' diff --git a/lib/breakers/version.rb b/lib/breakers/version.rb index 3f29d2c..f77d904 100644 --- a/lib/breakers/version.rb +++ b/lib/breakers/version.rb @@ -1,3 +1,3 @@ module Breakers - VERSION = '0.4.0'.freeze + VERSION = '0.5.0'.freeze end From 19d2e921898cf194143f52d9f2661a67726058c3 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Fri, 11 Mar 2022 11:23:50 -0800 Subject: [PATCH 4/7] Add code scanning (#14) --- .github/workflows/codeql.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..e8eed8b --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '27 2 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From 56dade3d492201726eba8315f93776f6be9d81eb Mon Sep 17 00:00:00 2001 From: VA DevOps Bot <56653823+va-devops-bot@users.noreply.github.com> Date: Fri, 11 Mar 2022 14:26:16 -0500 Subject: [PATCH 5/7] Request to add a document outling how to contribute (#17) Co-authored-by: VA-DevOps-Bot --- CONTRIBUTING.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ebb33a2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,88 @@ + + +# Contributing to breakers + +First off, thanks for taking the time to contribute! :heart: + +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: + + +## Table of Contents + +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) + +## I Have a Question + +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. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/department-of-veterans-affairs/breakers/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +## I Want To Contribute + +> ### Legal Notice +> 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. + +## Reporting Bugs + + +### Before Submitting a Bug Report + +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. + +- Make sure that you are using the latest version. +- 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)). +- 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). +- Collect information about the bug: + - Stack trace (Traceback) + - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) + - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. + - Possibly your input and the output +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + + +### How Do I Submit a Good Bug Report? + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- 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.) +- Explain the behavior you would expect and the actual behavior. +- 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. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- 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. +- 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. + +## Suggesting Enhancements + +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. + + +### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration. +- 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. +- 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. + + +### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/department-of-veterans-affairs/breakers/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **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. +- 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. +- **Explain why this enhancement would be useful** to most breakers users. From e404392da16ebb1ab413ad091d3d078b647b5302 Mon Sep 17 00:00:00 2001 From: Riley Anderson Date: Fri, 8 Apr 2022 10:15:22 -0600 Subject: [PATCH 6/7] Fix redis deprecations (#18) * wip * update version Co-authored-by: Eric Boehs --- lib/breakers/outage.rb | 6 +++--- lib/breakers/service.rb | 16 ++++++++-------- lib/breakers/version.rb | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/breakers/outage.rb b/lib/breakers/outage.rb index 706f6d7..513d4e3 100644 --- a/lib/breakers/outage.rb +++ b/lib/breakers/outage.rb @@ -132,9 +132,9 @@ def key end def replace_body(body:) - Breakers.client.redis_connection.multi do - Breakers.client.redis_connection.zrem(key, MultiJson.dump(@body)) - Breakers.client.redis_connection.zadd(key, start_time.to_i, MultiJson.dump(body)) + Breakers.client.redis_connection.multi do |pipeline| + pipeline.zrem(key, MultiJson.dump(@body)) + pipeline.zadd(key, start_time.to_i, MultiJson.dump(body)) end @body = body end diff --git a/lib/breakers/service.rb b/lib/breakers/service.rb index 4b12f53..de2f34b 100644 --- a/lib/breakers/service.rb +++ b/lib/breakers/service.rb @@ -143,9 +143,9 @@ def values_in_range(start_time:, end_time:, type:, sample_minutes:) end def increment_key(key:) - Breakers.client.redis_connection.multi do - Breakers.client.redis_connection.incr(key) - Breakers.client.redis_connection.expire(key, @configuration[:data_retention_seconds]) + Breakers.client.redis_connection.multi do |pipeline| + pipeline.incr(key) + pipeline.expire(key, @configuration[:data_retention_seconds]) end end @@ -156,11 +156,11 @@ def align_time_on_minute(time: nil) end def maybe_create_outage - data = Breakers.client.redis_connection.multi do - Breakers.client.redis_connection.get(errors_key(time: Time.now.utc)) - Breakers.client.redis_connection.get(errors_key(time: Time.now.utc - 60)) - Breakers.client.redis_connection.get(successes_key(time: Time.now.utc)) - Breakers.client.redis_connection.get(successes_key(time: Time.now.utc - 60)) + data = Breakers.client.redis_connection.multi do |pipeline| + pipeline.get(errors_key(time: Time.now.utc)) + pipeline.get(errors_key(time: Time.now.utc - 60)) + pipeline.get(successes_key(time: Time.now.utc)) + pipeline.get(successes_key(time: Time.now.utc - 60)) end failure_count = data[0].to_i + data[1].to_i success_count = data[2].to_i + data[3].to_i diff --git a/lib/breakers/version.rb b/lib/breakers/version.rb index f77d904..9f8195e 100644 --- a/lib/breakers/version.rb +++ b/lib/breakers/version.rb @@ -1,3 +1,3 @@ module Breakers - VERSION = '0.5.0'.freeze + VERSION = '0.6.0'.freeze end From 50440ab3152e7da54a90e64f2f1bab1ee98176f0 Mon Sep 17 00:00:00 2001 From: Jamie McCarthy Date: Wed, 2 Oct 2024 13:39:51 -0400 Subject: [PATCH 7/7] version 1.0.2 --- breakers.gemspec | 2 +- lib/breakers/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/breakers.gemspec b/breakers.gemspec index f2989b1..58c1139 100644 --- a/breakers.gemspec +++ b/breakers.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = 'breakers' - spec.version = '1.0.1' + spec.version = '1.0.2' spec.authors = ['Aubrey Holland'] spec.email = ['aubrey@adhocteam.us'] diff --git a/lib/breakers/version.rb b/lib/breakers/version.rb index f60788e..935ae81 100644 --- a/lib/breakers/version.rb +++ b/lib/breakers/version.rb @@ -1,3 +1,3 @@ module Breakers - VERSION = '1.0.1'.freeze + VERSION = '1.0.2'.freeze end