logtail 0.1.17 → 0.1.18

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: d044ba470b7e68b4da31ecd63bf00d4e35be44cd58ab0af0cb3b3837335692d3
4
- data.tar.gz: 58052b27afea62453f35eb9807144554ebc798eec805939b6f5b29a7d7d3156a
3
+ metadata.gz: 93f4739daeaac5fe30db5251e9463e4139adcb9fe1bb5cc06988bd2617827d1c
4
+ data.tar.gz: 7de7ff6b0b83de585e95c70c2fea5ce2e2c7067592d6f18f8d139db665525c75
5
5
  SHA512:
6
- metadata.gz: aac98143909431c687db15b2b33090f899e044660df8bcd0246b82d3cd62a32c713840189f94e6b9761fbe43953a6cd95e429906a90ba512711efff01fb2e649
7
- data.tar.gz: 1cfd8815639f7e1c27483d254a99c2ceedd9884630c4e2fefb3e59f8bb2510166a74f8687038078955679fd55099c6422d4a79baccedd52b461e6af6e8f05de6
6
+ metadata.gz: 80fe56d644e5f07108859de6399c29f16fd26b7294b5ea63bc8b710b4ad9de757048e61c89e3e27837643c61d63525c79c60d9384c338c410daf8dacc840cac4
7
+ data.tar.gz: 64b96d54f5531470e8b87cb0e2ba4515266b25a5c03c20828cc3d1fb8e21ac81dc686057ac4b927b5bb55f571ef7c1f1b0e22265eaf342e5302d746d00ff0222
@@ -2,19 +2,22 @@ name: build
2
2
 
3
3
  on:
4
4
  push:
5
+ branches: [main]
6
+ pull_request:
5
7
  schedule:
6
8
  - cron: '20 5 * * 1'
7
9
  workflow_dispatch:
8
10
 
9
11
  jobs:
10
12
  test:
11
- runs-on: ubuntu-20.04
13
+ runs-on: ubuntu-24.04
12
14
 
13
15
  strategy:
14
16
  fail-fast: false
15
17
 
16
18
  matrix:
17
19
  ruby-version:
20
+ - "4.0"
18
21
  - "3"
19
22
  - "3.4"
20
23
  - "3.3"
@@ -24,13 +27,10 @@ jobs:
24
27
  - "2.7"
25
28
  - "2.6"
26
29
  - "2.5"
27
- - "jruby-9.4.3.0"
28
- - "jruby-9.2.14.0"
29
- - "truffleruby-23.0.0"
30
- - "truffleruby-22.1.0"
30
+ - "truffleruby"
31
31
 
32
32
  steps:
33
- - uses: actions/checkout@v2
33
+ - uses: actions/checkout@v7
34
34
 
35
35
  - name: Set up Ruby ${{ matrix.ruby-version }}
36
36
  uses: ruby/setup-ruby@v1
@@ -0,0 +1,28 @@
1
+ # Issues in this repo are synced with Linear. A GitHub closing keyword ("Closes #123",
2
+ # "Fixes owner/repo#123") closes the issue the moment the PR merges, while Linear's PR
3
+ # automation moves the linked Linear issue to Self QA at the same time. The two automations
4
+ # then fight: the GitHub issue is closed, reopened, and the Linear issue lands in Triage.
5
+ # Reference the issue with "Refs #123" instead and close it from Linear once the fix is
6
+ # released.
7
+ name: no closing keywords
8
+ on:
9
+ pull_request:
10
+ types: [opened, edited, reopened, synchronize]
11
+ permissions:
12
+ pull-requests: read
13
+ jobs:
14
+ check:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Reject GitHub closing keywords in the PR description
18
+ env:
19
+ BODY: ${{ github.event.pull_request.body }}
20
+ run: |
21
+ pattern='\b(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\b:?[[:space:]]+(#[0-9]+|[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+#[0-9]+|https?://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+/issues/[0-9]+)'
22
+ if matches=$(printf '%s' "$BODY" | grep -inoE "$pattern"); then
23
+ echo "::error::The PR description contains a GitHub closing keyword, which would close the issue on merge and desync it from Linear:"
24
+ echo "$matches"
25
+ echo "Use 'Refs #123' instead and close the issue from Linear once the fix is released."
26
+ exit 1
27
+ fi
28
+ echo "No closing keywords found."
@@ -0,0 +1,211 @@
1
+ # Publishes the gem to RubyGems.org from GitHub Actions, the way logtail-js and logtail-python
2
+ # release their packages. The publish job runs in the "rubygems" environment, which only deploys
3
+ # from main; anyone who can dispatch the workflow can release.
4
+ #
5
+ # Authentication: the repository secret RUBYGEMS_CREDENTIALS holds the contents of a gem
6
+ # credentials file for the shared rubygems.org account, i.e. ":rubygems_api_key: rubygems_…",
7
+ # the line the manual process kept in ~/.local/share/gem/credentials.
8
+ #
9
+ # Repository settings this relies on: the "rubygems" environment with deployment branches limited
10
+ # to main and no required reviewers (add reviewers there if releases should need an approval; a
11
+ # job that references a missing environment would create it WITHOUT protection), and the GitHub
12
+ # Actions app among the actors allowed to bypass the pull request requirement of main, which the
13
+ # version commit needs.
14
+ #
15
+ # Release: Actions → Release → Run workflow from main, pick patch or minor. The workflow runs the
16
+ # tests, bumps the version in lib/*/version.rb, builds the gem, commits "vX.Y.Z", tags it, pushes
17
+ # both, pushes the gem to RubyGems.org and creates a GitHub release with auto-generated notes for
18
+ # the tag; edit the notes afterwards if needed.
19
+ #
20
+ # Retry: if a release failed after the version commit was pushed, run "retry" right away from
21
+ # main. It bumps nothing, rebuilds the tagged commit, pushes the gem if RubyGems.org is still
22
+ # missing it and creates the GitHub release if it is still missing. Running patch or minor again
23
+ # would release the next version instead.
24
+ #
25
+ # Dry run: bumps in place without committing, builds the gem and checks the credentials secret,
26
+ # publishes nothing. Every push that touches this file is a dry run, so a change to the workflow
27
+ # proves itself on its pull request before it reaches main. A dry run can also be dispatched from
28
+ # any branch.
29
+ name: Release
30
+
31
+ on:
32
+ workflow_dispatch:
33
+ inputs:
34
+ release:
35
+ description: "patch or minor: bump, tag and publish. retry: finish a release that failed halfway."
36
+ type: choice
37
+ options: [patch, minor, retry]
38
+ required: true
39
+ dry_run:
40
+ description: "Dry run: bump and build, check the credentials, publish nothing"
41
+ type: boolean
42
+ default: false
43
+ push:
44
+ paths:
45
+ - .github/workflows/release.yml
46
+
47
+ permissions:
48
+ contents: read
49
+
50
+ concurrency:
51
+ group: release
52
+ cancel-in-progress: false
53
+
54
+ env:
55
+ DRY_RUN: ${{ github.event_name == 'push' || inputs.dry_run }}
56
+ RELEASE: ${{ inputs.release || 'patch' }}
57
+
58
+ jobs:
59
+ verify:
60
+ name: Test
61
+ runs-on: ubuntu-24.04
62
+ steps:
63
+ - uses: actions/checkout@v7
64
+
65
+ - name: Set up Ruby
66
+ uses: ruby/setup-ruby@v1
67
+ with:
68
+ ruby-version: "3"
69
+ bundler-cache: true
70
+
71
+ - name: Run tests
72
+ run: bundle exec rspec
73
+
74
+ build:
75
+ name: Bump and build
76
+ needs: verify
77
+ runs-on: ubuntu-24.04
78
+ permissions:
79
+ contents: write # pushes the version commit and the tag
80
+ outputs:
81
+ version: ${{ steps.version.outputs.version }}
82
+ gem: ${{ steps.build.outputs.gem }}
83
+
84
+ steps:
85
+ - name: Releases run from main only
86
+ if: ${{ env.DRY_RUN != 'true' && github.ref != 'refs/heads/main' }}
87
+ run: |
88
+ echo "::error::Dispatch the release from main, not from $GITHUB_REF_NAME."
89
+ exit 1
90
+
91
+ - uses: actions/checkout@v7
92
+ with:
93
+ fetch-depth: 0 # the version check looks at the tags on HEAD
94
+
95
+ - name: Set up Ruby
96
+ uses: ruby/setup-ruby@v1
97
+ with:
98
+ ruby-version: "3"
99
+
100
+ - name: Bump version
101
+ id: version
102
+ run: |
103
+ ruby - <<'EOF'
104
+ release, dry_run = ENV.fetch("RELEASE"), ENV["DRY_RUN"] == "true"
105
+ path = Dir["lib/**/version.rb"].fetch(0)
106
+ source = File.read(path)
107
+ current = source[/VERSION = "(\d+\.\d+\.\d+)"/, 1] || abort("no VERSION constant in #{path}")
108
+ tagged = `git tag --points-at HEAD`.split.include?("v#{current}")
109
+
110
+ if release == "retry"
111
+ abort("retry only finishes a release whose version commit v#{current} is HEAD") unless tagged
112
+ version = current
113
+ else
114
+ abort("HEAD is already released as v#{current}, there is nothing new to release") if tagged && !dry_run
115
+ major, minor, patch = current.split(".").map(&:to_i)
116
+ version = release == "minor" ? "#{major}.#{minor + 1}.0" : "#{major}.#{minor}.#{patch + 1}"
117
+ File.write(path, source.sub(%("#{current}"), %("#{version}")))
118
+ end
119
+
120
+ puts "#{current} -> #{version}"
121
+ File.open(ENV.fetch("GITHUB_OUTPUT"), "a") { |output| output.puts "version=#{version}" }
122
+ EOF
123
+
124
+ - name: Build the gem
125
+ id: build
126
+ env:
127
+ VERSION: ${{ steps.version.outputs.version }}
128
+ run: |
129
+ gem build *.gemspec
130
+ gem=$(ls *.gem)
131
+ case "$gem" in
132
+ *-"$VERSION".gem) ;;
133
+ *) echo "::error::Built $gem, expected version $VERSION."; exit 1 ;;
134
+ esac
135
+ echo "gem=$gem" >> "$GITHUB_OUTPUT"
136
+
137
+ - name: Dry run
138
+ if: ${{ env.DRY_RUN == 'true' }}
139
+ env:
140
+ RUBYGEMS_CREDENTIALS: ${{ secrets.RUBYGEMS_CREDENTIALS }}
141
+ run: |
142
+ git diff --stat
143
+ if ! grep -q '^:rubygems_api_key: [^ ]' <<< "$RUBYGEMS_CREDENTIALS"; then
144
+ echo "::error::The RUBYGEMS_CREDENTIALS secret must hold the contents of a gem credentials file: ':rubygems_api_key: rubygems_…'"
145
+ exit 1
146
+ fi
147
+ echo "RUBYGEMS_CREDENTIALS looks like a gem credentials file. A release pushes with it, nothing more to verify without pushing."
148
+
149
+ - name: Commit and tag
150
+ if: ${{ env.DRY_RUN != 'true' && env.RELEASE != 'retry' }}
151
+ env:
152
+ VERSION: ${{ steps.version.outputs.version }}
153
+ run: |
154
+ git config user.name "github-actions[bot]"
155
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
156
+ git commit -am "v$VERSION"
157
+ git tag -a "v$VERSION" -m "v$VERSION"
158
+ git push origin main "v$VERSION"
159
+
160
+ - uses: actions/upload-artifact@v7
161
+ with:
162
+ name: gem
163
+ path: "*.gem"
164
+ if-no-files-found: error
165
+
166
+ release:
167
+ name: Publish
168
+ needs: build
169
+ if: ${{ github.event_name == 'workflow_dispatch' && !inputs.dry_run }}
170
+ runs-on: ubuntu-24.04
171
+ environment: rubygems
172
+ permissions:
173
+ contents: write # creates the GitHub release
174
+ env:
175
+ VERSION: ${{ needs.build.outputs.version }}
176
+ GEM: ${{ needs.build.outputs.gem }}
177
+
178
+ steps:
179
+ - uses: actions/download-artifact@v8
180
+ with:
181
+ name: gem
182
+
183
+ - name: Set up Ruby
184
+ uses: ruby/setup-ruby@v1
185
+ with:
186
+ ruby-version: "3"
187
+
188
+ - name: Push to RubyGems.org
189
+ env:
190
+ RUBYGEMS_CREDENTIALS: ${{ secrets.RUBYGEMS_CREDENTIALS }}
191
+ run: |
192
+ name="${GEM%-$VERSION.gem}"
193
+ if gem specification --remote "$name" --version "$VERSION" > /dev/null 2>&1; then
194
+ echo "$name $VERSION is on rubygems.org already, finishing the release."
195
+ else
196
+ mkdir -p ~/.gem
197
+ (umask 077 && printf '%s\n' "$RUBYGEMS_CREDENTIALS" > ~/.gem/credentials)
198
+ gem push "$GEM"
199
+ fi
200
+
201
+ - name: Create GitHub release
202
+ env:
203
+ GH_TOKEN: ${{ github.token }}
204
+ GH_REPO: ${{ github.repository }}
205
+ run: |
206
+ if gh release view "v$VERSION" > /dev/null 2>&1; then
207
+ echo "Release v$VERSION already exists."
208
+ else
209
+ # --verify-tag: only ever attach to the tag the build job pushed, never create one here.
210
+ gh release create "v$VERSION" --verify-tag --generate-notes
211
+ fi
@@ -1,4 +1,3 @@
1
- require "base64"
2
1
  require "msgpack"
3
2
  require "net/https"
4
3
  require "zlib"
@@ -30,10 +29,8 @@ module Logtail
30
29
  # options control when the flush happens, `:batch_byte_size` and `:flush_interval`.
31
30
  # If either of these are surpassed, the buffer will be flushed.
32
31
  #
33
- # By default, the buffer will apply back pressure when the rate of log messages exceeds
34
- # the maximum delivery rate. If you don't want to sacrifice app performance in this case
35
- # you can drop the log messages instead by passing a {DroppingSizedQueue} via the
36
- # `:request_queue` option.
32
+ # By default, the buffer will drop log messages when the rate of log messages exceeds
33
+ # the maximum delivery rate. You can change this with the `:request_queue` option.
37
34
  #
38
35
  # @param source_token [String] The API key provided to you after you add your source to
39
36
  # [Better Stack](https://telemetry.betterstack.com).
@@ -1,3 +1,3 @@
1
1
  module Logtail
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
data/logtail.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  spec.add_dependency('msgpack', '~> 1.0')
29
+ spec.add_dependency('logger', '~> 1.0')
29
30
 
30
31
  spec.add_development_dependency('bundler-audit', '>= 0')
31
32
  spec.add_development_dependency('rails_stdout_logging', '>= 0')
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logtail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Better Stack
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: msgpack
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '1.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: logger
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: bundler-audit
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +135,6 @@ dependencies:
122
135
  - - "~>"
123
136
  - !ruby/object:Gem::Version
124
137
  version: '2.3'
125
- description:
126
138
  email:
127
139
  - hello@betterstack.com
128
140
  executables: []
@@ -130,6 +142,8 @@ extensions: []
130
142
  extra_rdoc_files: []
131
143
  files:
132
144
  - ".github/workflows/main.yml"
145
+ - ".github/workflows/no-closing-keywords.yml"
146
+ - ".github/workflows/release.yml"
133
147
  - ".gitignore"
134
148
  - ".rspec"
135
149
  - Gemfile
@@ -193,7 +207,6 @@ metadata:
193
207
  changelog_uri: https://github.com/logtail/logtail-ruby/tree/master/CHANGELOG.md
194
208
  homepage_uri: https://github.com/logtail/logtail-ruby
195
209
  source_code_uri: https://github.com/logtail/logtail-ruby
196
- post_install_message:
197
210
  rdoc_options: []
198
211
  require_paths:
199
212
  - lib
@@ -208,20 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
221
  - !ruby/object:Gem::Version
209
222
  version: '0'
210
223
  requirements: []
211
- rubygems_version: 3.3.7
212
- signing_key:
224
+ rubygems_version: 3.6.9
213
225
  specification_version: 4
214
226
  summary: Query logs like you query your database. https://logs.betterstack.com/
215
- test_files:
216
- - spec/README.md
217
- - spec/logtail/current_context_spec.rb
218
- - spec/logtail/events/controller_call_spec.rb
219
- - spec/logtail/events/error_spec.rb
220
- - spec/logtail/log_devices/http_spec.rb
221
- - spec/logtail/log_entry_spec.rb
222
- - spec/logtail/logger_spec.rb
223
- - spec/spec_helper.rb
224
- - spec/support/logtail.rb
225
- - spec/support/socket_hostname.rb
226
- - spec/support/timecop.rb
227
- - spec/support/webmock.rb
227
+ test_files: []