lumberjack_data_dog_device 1.0.1 → 1.1.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 +4 -4
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/continuous_integration.yml +46 -0
- data/.standard.yml +8 -0
- data/CHANGE_LOG.md +28 -5
- data/README.md +35 -3
- data/VERSION +1 -1
- data/lib/lumberjack_data_dog_device.rb +10 -10
- data/lumberjack_data_dog_device.gemspec +11 -12
- metadata +14 -39
- /data/{MIT_LICENSE → MIT_LICENSE.txt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: addf5b5690d7de27ea3f61b97f0df001a6f8315b6b47cc5252a013ab3dfa9036
|
4
|
+
data.tar.gz: db399010d354397291f19a9173691b875939e33e2db33152dd932d4969371856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7c71c685bc86d831d346911cde9dfd6d101a61b7ff1c5df244c13252446628ca10e186a5107de16c12d9aff79848b820ce183ebaec26b6067a7b37ff3eecb1
|
7
|
+
data.tar.gz: 17c5c871ded8343cb7f8ba1b21162f3eeca41244a313932b0c1f3a3328edc74b449ea23cc79bdf87bae4ff5559bd30ba613568f50375efb96ce6d2fe7eadd38e
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Dependabot update strategy
|
2
|
+
version: 2
|
3
|
+
updates:
|
4
|
+
- package-ecosystem: bundler
|
5
|
+
directory: "/"
|
6
|
+
schedule:
|
7
|
+
interval: daily
|
8
|
+
allow:
|
9
|
+
# Automatically keep all runtime dependencies updated
|
10
|
+
- dependency-name: "*"
|
11
|
+
dependency-type: "production"
|
12
|
+
versioning-strategy: lockfile-only
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
- actions-*
|
8
|
+
tags:
|
9
|
+
- v*
|
10
|
+
pull_request:
|
11
|
+
branches-ignore:
|
12
|
+
- actions-*
|
13
|
+
workflow_dispatch:
|
14
|
+
|
15
|
+
env:
|
16
|
+
BUNDLE_CLEAN: "true"
|
17
|
+
BUNDLE_PATH: vendor/bundle
|
18
|
+
BUNDLE_JOBS: 3
|
19
|
+
BUNDLE_RETRY: 3
|
20
|
+
|
21
|
+
jobs:
|
22
|
+
build:
|
23
|
+
name: ${{ matrix.ruby }} build
|
24
|
+
runs-on: ubuntu-latest
|
25
|
+
strategy:
|
26
|
+
matrix:
|
27
|
+
include:
|
28
|
+
- ruby: "ruby"
|
29
|
+
standardrb: true
|
30
|
+
- ruby: "3.0"
|
31
|
+
- ruby: "2.7"
|
32
|
+
- ruby: "2.5"
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby}}
|
39
|
+
- name: Install gems
|
40
|
+
run: |
|
41
|
+
bundle install
|
42
|
+
- name: Run Tests
|
43
|
+
run: bundle exec rake
|
44
|
+
- name: standardrb
|
45
|
+
if: matrix.standardrb
|
46
|
+
run: bundle exec standardrb
|
data/.standard.yml
ADDED
data/CHANGE_LOG.md
CHANGED
@@ -1,8 +1,31 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
6
|
|
6
|
-
|
7
|
+
## 1.1.0
|
7
8
|
|
8
|
-
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Fixed the stack trace on errors to be logged in the correct `error.stack` tag rather than `error.trace`.
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
|
15
|
+
- Removed support for Ruby 2.4.
|
16
|
+
|
17
|
+
## 1.0.1
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- Add optional max_message_length to limit the length of message payload.
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- Format non-hashes in log messages as strings to prevent stack overflow on objects that cannot be serialized to JSON.
|
26
|
+
|
27
|
+
## 1.0.0
|
28
|
+
|
29
|
+
### Added
|
30
|
+
|
31
|
+
- Initial release
|
data/README.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# Lumberjack DataDog Device
|
2
2
|
|
3
|
-
[](https://github.com/bdurand/lumberjack_data_dog_device/actions/workflows/continuous_integration.yml)
|
4
|
+
[](https://github.com/testdouble/standard)
|
5
|
+
[](https://badge.fury.io/rb/lumberjack_data_dog_device)
|
5
6
|
|
6
7
|
This gem provides a logging device that produces JSON output that matches the standard fields defined for [DataDog logging](https://docs.datadoghq.com/logs/processing/attributes_naming_convention/).
|
7
8
|
|
9
|
+
> [!WARNING]
|
10
|
+
> This gem is no longer being maintained. It has been replaced by the [`lumberjack_data_dog`](https://github.com/bdurand/lumberjack_data_dog) gem.
|
11
|
+
|
8
12
|
* The time will be sent as "timestamp" with a precision in microseconds.
|
9
13
|
|
10
14
|
* The severity will be sent as "status" with a string label (DEBUG, INFO, WARN, ERROR, FATAL).
|
@@ -21,7 +25,7 @@ This gem provides a logging device that produces JSON output that matches the st
|
|
21
25
|
|
22
26
|
* All other tags are sent as is. If a tag name includes a dot, it will be sent as a nested JSON structure.
|
23
27
|
|
24
|
-
This device extends from [`Lumberjack::JsonDevice`](). It is not tied to Data Dog in any way other than that it is opinionated about how to map and format some log tags. It can be used with other services or pipelines without issue.
|
28
|
+
This device extends from [`Lumberjack::JsonDevice`](https://github.com/bdurand/lumberjack_json_device). It is not tied to Data Dog in any way other than that it is opinionated about how to map and format some log tags. It can be used with other services or pipelines without issue.
|
25
29
|
|
26
30
|
You can optionally specify a maximum message length with the `max_message_length` option on the device. Doing so will trucate the message payload to keep it under this number of characters. This option is provided because JSON payloads get messed up and cannot be parsed if they get too big.
|
27
31
|
|
@@ -37,3 +41,31 @@ logger.tag("http.method" => request.method, "http.url" => request.url) do
|
|
37
41
|
)
|
38
42
|
end
|
39
43
|
```
|
44
|
+
|
45
|
+
## Installation
|
46
|
+
|
47
|
+
Add this line to your application's Gemfile:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
gem "lumberjack_data_dog_device"
|
51
|
+
```
|
52
|
+
|
53
|
+
And then execute:
|
54
|
+
```bash
|
55
|
+
$ bundle install
|
56
|
+
```
|
57
|
+
|
58
|
+
Or install it yourself as:
|
59
|
+
```bash
|
60
|
+
$ gem install lumberjack_data_dog_device
|
61
|
+
```
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
Open a pull request on GitHub.
|
66
|
+
|
67
|
+
Please use the [standardrb](https://github.com/testdouble/standard) syntax and lint your code with `standardrb --fix` before submitting.
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
@@ -8,19 +8,19 @@ module Lumberjack
|
|
8
8
|
#
|
9
9
|
# See https://docs.datadoghq.com/logs/log_collection
|
10
10
|
class DataDogDevice < JsonDevice
|
11
|
-
|
12
11
|
module ExceptionHash
|
13
|
-
|
14
12
|
protected
|
15
13
|
|
16
14
|
def exception_hash(exception, device)
|
17
15
|
hash = {"kind" => exception.class.name}
|
18
16
|
hash["message"] = exception.message unless exception.message.nil?
|
17
|
+
|
19
18
|
trace = exception.backtrace
|
20
|
-
if trace && device
|
19
|
+
if trace && device&.respond_to?(:backtrace_cleaner) && device.backtrace_cleaner
|
21
20
|
trace = device.backtrace_cleaner.call(trace)
|
22
21
|
end
|
23
|
-
hash["
|
22
|
+
hash["stack"] = trace if trace
|
23
|
+
|
24
24
|
hash
|
25
25
|
end
|
26
26
|
end
|
@@ -40,16 +40,16 @@ module Lumberjack
|
|
40
40
|
"error" => exception_hash(object, @device)
|
41
41
|
}
|
42
42
|
elsif object.is_a?(Hash)
|
43
|
-
{
|
43
|
+
{"message" => object}
|
44
44
|
elsif object.nil?
|
45
|
-
{
|
45
|
+
{"message" => nil}
|
46
46
|
else
|
47
47
|
message = object.to_s
|
48
48
|
max_message_length = @device.max_message_length
|
49
49
|
if max_message_length && message.length > max_message_length
|
50
50
|
message = message[0, max_message_length]
|
51
51
|
end
|
52
|
-
{
|
52
|
+
{"message" => message}
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -124,7 +124,7 @@ module Lumberjack
|
|
124
124
|
if value.is_a?(Numeric)
|
125
125
|
value = (value.to_f * @multiplier).round
|
126
126
|
end
|
127
|
-
{
|
127
|
+
{"duration" => value}
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -138,8 +138,8 @@ module Lumberjack
|
|
138
138
|
# log entries to prevent overflowing the limit on message size which makes the log entries unparseable.
|
139
139
|
attr_accessor :max_message_length
|
140
140
|
|
141
|
-
def initialize(stream_or_device, backtrace_cleaner: nil, max_message_length: nil)
|
142
|
-
super(stream_or_device, mapping: data_dog_mapping)
|
141
|
+
def initialize(stream_or_device, backtrace_cleaner: nil, max_message_length: nil, **args)
|
142
|
+
super(stream_or_device, mapping: data_dog_mapping, **args)
|
143
143
|
self.backtrace_cleaner = backtrace_cleaner
|
144
144
|
self.max_message_length = max_message_length
|
145
145
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
|
-
spec.name =
|
3
|
-
spec.version = File.read(File.
|
4
|
-
spec.authors = [
|
5
|
-
spec.email = [
|
2
|
+
spec.name = "lumberjack_data_dog_device"
|
3
|
+
spec.version = File.read(File.join(__dir__, "VERSION")).strip
|
4
|
+
spec.authors = ["Brian Durand"]
|
5
|
+
spec.email = ["bbdurand@gmail.com"]
|
6
6
|
|
7
7
|
spec.summary = "A logging device for sending logs to DataDog in JSON format."
|
8
8
|
spec.homepage = "https://github.com/bdurand/lumberjack_data_dog_device"
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
# Specify which files should be added to the gem when it is released.
|
12
12
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
13
|
-
ignore_files = %w
|
13
|
+
ignore_files = %w[
|
14
14
|
.gitignore
|
15
15
|
.travis.yml
|
16
16
|
Appraisals
|
@@ -19,15 +19,14 @@ Gem::Specification.new do |spec|
|
|
19
19
|
Rakefile
|
20
20
|
gemfiles/
|
21
21
|
spec/
|
22
|
-
|
23
|
-
spec.files = Dir.chdir(
|
24
|
-
`git ls-files -z`.split("\x0").reject{ |f| ignore_files.any?{ |path| f.start_with?(path) } }
|
22
|
+
]
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| ignore_files.any? { |path| f.start_with?(path) } }
|
25
25
|
end
|
26
26
|
|
27
|
-
spec.require_paths = [
|
27
|
+
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
spec.
|
29
|
+
spec.required_ruby_version = ">= 2.5"
|
30
30
|
|
31
|
-
spec.
|
32
|
-
spec.add_development_dependency "rake"
|
31
|
+
spec.add_dependency "lumberjack_json_device", ">=2.0"
|
33
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lumberjack_data_dog_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lumberjack_json_device
|
@@ -16,51 +16,26 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
description:
|
26
|
+
version: '2.0'
|
27
|
+
description:
|
56
28
|
email:
|
57
29
|
- bbdurand@gmail.com
|
58
30
|
executables: []
|
59
31
|
extensions: []
|
60
32
|
extra_rdoc_files: []
|
61
33
|
files:
|
34
|
+
- ".github/dependabot.yml"
|
35
|
+
- ".github/workflows/continuous_integration.yml"
|
36
|
+
- ".standard.yml"
|
62
37
|
- CHANGE_LOG.md
|
63
|
-
- MIT_LICENSE
|
38
|
+
- MIT_LICENSE.txt
|
64
39
|
- README.md
|
65
40
|
- VERSION
|
66
41
|
- lib/lumberjack_data_dog_device.rb
|
@@ -69,7 +44,7 @@ homepage: https://github.com/bdurand/lumberjack_data_dog_device
|
|
69
44
|
licenses:
|
70
45
|
- MIT
|
71
46
|
metadata: {}
|
72
|
-
post_install_message:
|
47
|
+
post_install_message:
|
73
48
|
rdoc_options: []
|
74
49
|
require_paths:
|
75
50
|
- lib
|
@@ -77,15 +52,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
52
|
requirements:
|
78
53
|
- - ">="
|
79
54
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
55
|
+
version: '2.5'
|
81
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
57
|
requirements:
|
83
58
|
- - ">="
|
84
59
|
- !ruby/object:Gem::Version
|
85
60
|
version: '0'
|
86
61
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
88
|
-
signing_key:
|
62
|
+
rubygems_version: 3.4.10
|
63
|
+
signing_key:
|
89
64
|
specification_version: 4
|
90
65
|
summary: A logging device for sending logs to DataDog in JSON format.
|
91
66
|
test_files: []
|
File without changes
|