salestation 5.4.0 → 6.0.0

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: bd50a9f9fe461dc0d4fe8e4fea4153d1d361eb0f19a4e727ad74f33719fb043b
4
- data.tar.gz: 630f442282e5b19ecae156ab11f672ac3e8159ef7256ea6d2de8b1413ff8e7c9
3
+ metadata.gz: b77552025e87bb75e54a85f715ce2b81b2dcc8dd25a9f1a5ba7867be48784eff
4
+ data.tar.gz: b6ccb07510f4ec8d64e141bdb2ba87dff2fc17640bf58e0668bde252698b63e0
5
5
  SHA512:
6
- metadata.gz: c58774b66069bd350a63381752d18dc4dd6e6f374a741730010ed756678f5c6c19df5bb88fcbb4a87a31d2c5ebc319341c603c6dd646416835278723d760a1f5
7
- data.tar.gz: 6303f98fdb4269192c70c9123eae98d82821751da0b695425dd24c896af1dcca9f26600d95f9ed58a41a744408aa923acfec09eaaa66214cba634c2be77ab0a6
6
+ metadata.gz: 55d0cc16d83d1c3845fdf36682a7cf2679a8013a0e25b08ec44385e3eb63329b9b225f3447a15c9b0ac5e71c933d5423fac6df9835196520b325a6fbea3cd69d
7
+ data.tar.gz: 0d6e189ccedb87a9ecc85f1851ebc4911f2f3ceb838d63ca4d4c2bc2f678feba9f3c2596e9ac6dec536c21fbbf01885ffc6fac46cf72319ee358901a3416383e
@@ -0,0 +1 @@
1
+ * @salemove/tm-messenger
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## 6.0.0
9
+
10
+ ### Changed
11
+
12
+ - **Breaking change**: Change StatsdMiddleware metric type from timing to
13
+ distribution. Prior to 6.0.0, if you set the metric name to
14
+ `my_service.response.time`, then in Datadog you ended up with metrics
15
+ `my_service.response.time.avg`, `my_service.response.time.95_percentile`,
16
+ `my_service.response.time.count`. Now, only one metric with name
17
+ `my_service.response.time` of type distribution is sent.
data/README.md CHANGED
@@ -167,10 +167,19 @@ class Webapp < Sinatra::Base
167
167
  end
168
168
  ```
169
169
 
170
+ You can configure per-request fields by defining `salestation.request_logger.fields` in sinatra `env`:
171
+
172
+ ```ruby
173
+ def my_handler(env)
174
+ env['salestation.request_logger.fields'] = { foo: 'bar' }
175
+ # ...
176
+ end
177
+ ```
178
+
170
179
  ### Using StatsD
171
180
 
172
181
  Salestation provides a StatsD middleware which can be used record request
173
- execution time. A `timing` call with elapsed seconds is made to the provided
182
+ execution time. A `distribution` call with elapsed seconds is made to the provided
174
183
  StatsD instance with `path`, `method`, `status` and `status_class` tags.
175
184
 
176
185
  ```ruby
@@ -3,6 +3,8 @@
3
3
  module Salestation
4
4
  class Web < Module
5
5
  class RequestLogger
6
+ EXTRA_FIELDS_ENV_KEY = 'salestation.request_logger.fields'
7
+
6
8
  DURATION_PRECISION = 6
7
9
  REMOTE_ADDR = 'REMOTE_ADDR'
8
10
  REQUEST_URI = 'REQUEST_URI'
@@ -71,7 +73,8 @@ module Salestation
71
73
  log[:body] = body.join
72
74
  end
73
75
 
74
- log
76
+ extra_fields = env.fetch(EXTRA_FIELDS_ENV_KEY, {})
77
+ log.merge!(extra_fields)
75
78
  end
76
79
 
77
80
  def duration(from:)
@@ -33,7 +33,7 @@ module Salestation
33
33
  "status_class:#{status / 100}xx"
34
34
  ] + env.fetch(EXTRA_TAGS_ENV_KEY, [])
35
35
 
36
- @statsd.timing(@metric, duration_ms(from: start), tags: tags)
36
+ @statsd.distribution(@metric, duration_ms(from: start), tags: tags)
37
37
 
38
38
  [status, header, body]
39
39
  end
data/salestation.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "salestation"
7
- spec.version = "5.4.0"
7
+ spec.version = "6.0.0"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["open-source@glia.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-28 00:00:00.000000000 Z
10
+ date: 2025-04-01 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -185,11 +184,13 @@ executables: []
185
184
  extensions: []
186
185
  extra_rdoc_files: []
187
186
  files:
187
+ - ".github/CODEOWNERS"
188
188
  - ".github/workflows/publish.yml"
189
189
  - ".github/workflows/ruby.yml"
190
190
  - ".gitignore"
191
191
  - ".rspec"
192
192
  - ".yardopts"
193
+ - CHANGELOG.md
193
194
  - CONTRIBUTING.md
194
195
  - Gemfile
195
196
  - LICENSE.txt
@@ -220,7 +221,6 @@ homepage: ''
220
221
  licenses:
221
222
  - MIT
222
223
  metadata: {}
223
- post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -235,8 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  requirements: []
238
- rubygems_version: 3.5.9
239
- signing_key:
238
+ rubygems_version: 3.6.2
240
239
  specification_version: 4
241
240
  summary: ''
242
241
  test_files: []