From b38b50e90d8103e95f1c49763cfcefd76d217354 Mon Sep 17 00:00:00 2001 From: vu-hoang-kaligo Date: Tue, 14 Jan 2025 17:15:43 +0700 Subject: [PATCH] Bump version to 0.1.4 --- CHANGELOG.md | 17 +++++++++++++++++ Gemfile.lock | 2 +- README.md | 28 ++++++++++++++++++++++++++++ lib/idempotency/version.rb | 2 +- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 262874e..c3dabf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ ## [Change Log] +## [0.1.4] - 2025-01-14 + +- Support instrumentation via event hook approach +- Support metrics logging via StatsdListener + +## [0.1.3] - 2025-01-14 + +- Support testing by mocking MockRedis#evalsha + +## [0.1.2] - 2025-01-07 + +- Support auto-releasing gem + +## [0.1.1] - 2025-01-07 + +- Allow configuring idempotent methods instead of hardcoding POST + ## [0.1.0] - 2024-11-13 - Initial release diff --git a/Gemfile.lock b/Gemfile.lock index eb4d3f6..782c4d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - idempotency (0.1.3) + idempotency (0.1.4) base64 dry-configurable dry-monitor diff --git a/README.md b/README.md index a29d961..96b941e 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,31 @@ RSpec.configure do |config| end ``` +### Instrumentation + +The gem supports instrumentation through StatsD. It tracks the following metrics: + +- `idempotency_cache_hit_count` - Incremented when a cached response is found +- `idempotency_cache_miss_count` - Incremented when no cached response exists +- `idempotency_lock_conflict_count` - Incremented when concurrent requests conflict +- `idempotency_cache_duration_seconds` - Histogram of operation duration + +Each metric includes tags: +- `action` - Either the specified action name or `"{HTTP_METHOD}:{PATH}"` +- `namespace` - Your configured namespace (if provided) +- `metric` - The metric name (for duration histogram only) + +To enable above instrumentation, configure a StatsD listener: + +```ruby +statsd_client = Datadog::Statsd.new +statsd_listener = Idempotency::Instrumentation::StatsdListener.new( + statsd_client, + 'my_service_name' +) + +Idempotency.configure do |config| + config.instrumentation_listeners = [statsd_listener] +end +``` + diff --git a/lib/idempotency/version.rb b/lib/idempotency/version.rb index d8744e3..b125d72 100644 --- a/lib/idempotency/version.rb +++ b/lib/idempotency/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class Idempotency - VERSION = '0.1.3' + VERSION = '0.1.4' end