activejob-traceable 0.3.5 → 0.4.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: b54c11e7a22889140d06573ff007ba010390e2b63a76acf3e89bec9c5925fd0f
4
- data.tar.gz: 2e7e17cd4c3b4575b26bdf648f9f8690879442255992ce803941ea6acc665186
3
+ metadata.gz: ff9134281999c7d1295ecf6539f6822c3b5236da86152b551f84b47ef3c9c103
4
+ data.tar.gz: 1709730aaf3eb5ff6dc4f6594b4c0c23ec6b11cddbc2e7145344a22dbdbc290f
5
5
  SHA512:
6
- metadata.gz: 9d8dc30daa8d03d34e0647ae4afd9c80a22b344d719a3b0414356e71d89ae4e198f16c7d93f9186eb8c2d0796e92e798ea2c9088fee52e9c868729a040bc2222
7
- data.tar.gz: dafe29b1bfe58ba46e3aa9944aec3b047727a19018567a302c681e8c1d5c304d63a4c283e6e9e420c548a8f06dac3ff8aeb7faeeb0fd53a04b94c3d97f99959c
6
+ metadata.gz: 3c3c86bd7267e70dbc4ae2c9b985a2f0c63d53d330cdc37f1ad0b01716c370b5d5025b089bbfb0191bf29e2c0a178b2d56c5c7cd6d7c0dee6c350c577388cb20
7
+ data.tar.gz: 4fa36116a98bff5877512b2da25cf8d2b4ce50e6018b496e31f664a60397e47c2d0b723f56c7ff85618369d4b0c9721708b6e518f42c61c7c908317005bba586
@@ -0,0 +1,32 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Build and publish
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ packages: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Set up Ruby 3.2
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: 3.2.2
22
+
23
+ - name: Publish to RubyGems
24
+ run: |
25
+ mkdir -p $HOME/.gem
26
+ touch $HOME/.gem/credentials
27
+ chmod 0600 $HOME/.gem/credentials
28
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
29
+ gem build *.gemspec
30
+ gem push *.gem
31
+ env:
32
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,27 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ pull_request:
7
+ branches: ["master"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby-version: ['3.0', '3.1', '3.2']
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
+ - name: Run tests
27
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Gem Version](https://badge.fury.io/rb/activejob-traceable.svg) ![CI Status](https://github.com/qonto/activejob-traceable/actions/workflows/tests.yml/badge.svg)
2
+
1
3
  # ActiveJob::Traceable
2
4
 
3
5
  Patches ActiveJob to add attribute `tracing_info`, which is added as log's tag.
@@ -47,7 +49,7 @@ Once configured, works out of the box.
47
49
 
48
50
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
49
51
 
50
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, make sure you updated the version number in `version.rb`, and then create a new release and tag from github.
51
53
 
52
54
  ## Contributing
53
55
 
@@ -15,6 +15,7 @@ module ActiveJob
15
15
  ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
16
16
 
17
17
  def serialize
18
+ add_telemetry_data!
18
19
  super.merge!('tracing_info' => tracing_info)
19
20
  end
20
21
 
@@ -25,10 +26,22 @@ module ActiveJob
25
26
  self.tracing_info = job_data['tracing_info']
26
27
  end
27
28
 
29
+ add_telemetry_data!
30
+
28
31
  Traceable.tracing_info_setter.call(tracing_info.with_indifferent_access)
29
32
  end
30
33
  end
31
34
 
35
+ private
36
+
37
+ def add_telemetry_data!
38
+ if ENV["OTEL_EXPORTER_OTLP_ENDPOINT"].present?
39
+ current_span = OpenTelemetry::Trace.current_span
40
+ @tracing_info[:trace_id] = current_span.context.trace_id.unpack1("H*")
41
+ @tracing_info[:span_id] = current_span.context.span_id.unpack1("H*")
42
+ end
43
+ end
44
+
32
45
  class << self
33
46
  def tracing_info_getter
34
47
  @tracing_info_getter || -> { {} }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Traceable
5
- VERSION = '0.3.5'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob-traceable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qonto team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -94,13 +94,15 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.8'
97
- description:
97
+ description:
98
98
  email:
99
99
  - backend@qonto.eu
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/workflows/rubygems.yml"
105
+ - ".github/workflows/tests.yml"
104
106
  - ".gitignore"
105
107
  - ".rspec"
106
108
  - ".travis.yml"
@@ -117,7 +119,7 @@ homepage: https://github.com/qonto/activejob-traceable
117
119
  licenses:
118
120
  - MIT
119
121
  metadata: {}
120
- post_install_message:
122
+ post_install_message:
121
123
  rdoc_options: []
122
124
  require_paths:
123
125
  - lib
@@ -132,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  - !ruby/object:Gem::Version
133
135
  version: '0'
134
136
  requirements: []
135
- rubygems_version: 3.1.4
136
- signing_key:
137
+ rubygems_version: 3.4.10
138
+ signing_key:
137
139
  specification_version: 4
138
140
  summary: Patches ActiveJob to add trace_id attribute.
139
141
  test_files: []