datadog-json_logger 0.3.0 → 0.3.2
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/.rubocop.yml +24 -2
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/README.md +7 -7
- data/lib/datadog/loggers/version.rb +1 -1
- data/lib/datadog/rack_middleware.rb +2 -2
- metadata +4 -9
- data/Dockerfile.nexus +0 -12
- data/Steepfile +0 -32
- data/nexus_release.sh +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1795ce6a0f5857647593b4de6a9322fd44ee473b5e222e8a8760b28c7f8bd9de
|
|
4
|
+
data.tar.gz: 74e3f24ef8d58ef52c99c97823f6304780f3780d24c765da6797d972b10eea6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06d847c872aee4a50c458c9a495c912e2018ff152660c2d8ebe9dc4b6c10da7ed4ee6eb14e77e4d11ab01d16a9e339a2a8a4cee3b3326f8f3a86c2bcadae9613
|
|
7
|
+
data.tar.gz: 45b77233fd3904cc27a43f151fd1f0c95f810aa5359ef92cbaba8a3e48a01fffa72215b80bddf293ce003745922fd287128d39dd0a896b65bd4ee16a1928db9c
|
data/.rubocop.yml
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
|
|
1
5
|
AllCops:
|
|
2
6
|
Exclude:
|
|
3
7
|
- 'sig/**/*'
|
|
@@ -5,7 +9,7 @@ AllCops:
|
|
|
5
9
|
- 'lib/datadog/tracing/contrib/bunny/patcher.rb'
|
|
6
10
|
- 'vendor/**/*'
|
|
7
11
|
NewCops: enable
|
|
8
|
-
TargetRubyVersion: 3.
|
|
12
|
+
TargetRubyVersion: 3.4
|
|
9
13
|
|
|
10
14
|
Style/StringLiterals:
|
|
11
15
|
Enabled: true
|
|
@@ -33,4 +37,22 @@ Metrics/BlockLength:
|
|
|
33
37
|
- 'spec/**/*'
|
|
34
38
|
|
|
35
39
|
Metrics/ParameterLists:
|
|
36
|
-
Max: 6
|
|
40
|
+
Max: 6
|
|
41
|
+
|
|
42
|
+
RSpec/MultipleMemoizedHelpers:
|
|
43
|
+
Max: 10
|
|
44
|
+
|
|
45
|
+
RSpec/MultipleExpectations:
|
|
46
|
+
Max: 5
|
|
47
|
+
|
|
48
|
+
RSpec/NestedGroups:
|
|
49
|
+
Max: 4
|
|
50
|
+
|
|
51
|
+
RSpec/ExampleLength:
|
|
52
|
+
Max: 15
|
|
53
|
+
|
|
54
|
+
RSpec/MessageChain:
|
|
55
|
+
Enabled: false
|
|
56
|
+
|
|
57
|
+
RSpec/VerifiedDoubles:
|
|
58
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.4.
|
|
1
|
+
3.4.7
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.4.7
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
## Requirements
|
|
22
22
|
|
|
23
23
|
- Ruby 3.0+
|
|
24
|
-
- [
|
|
24
|
+
- [datadog](https://github.com/DataDog/dd-trace-rb) properly configured in your application
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
@@ -62,12 +62,12 @@ logger.info('Hello World')
|
|
|
62
62
|
Datadog::JSONLogger.configure do |config|
|
|
63
63
|
# Function to extract current user from environment
|
|
64
64
|
config.current_user = ->(env) { { email: env['current_user']&.email } }
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
# Custom environment keys
|
|
67
67
|
config.controller_key = "sinatra.controller_name"
|
|
68
68
|
config.resource_key = "sinatra.resource_name"
|
|
69
69
|
config.action_key = "sinatra.action_name"
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
# Custom context for all logs
|
|
72
72
|
config.custom_context = -> { { environment: ENV['RACK_ENV'] } }
|
|
73
73
|
end
|
|
@@ -81,7 +81,7 @@ In your `config/initializers/datadog.rb`:
|
|
|
81
81
|
require 'datadog/json_logger'
|
|
82
82
|
|
|
83
83
|
Datadog::JSONLogger.configure do |config|
|
|
84
|
-
config.current_user = ->(env) { { email: env['warden']&.user&.email } }
|
|
84
|
+
config.current_user = ->(env) { { email: env['warden']&.user&.email } }
|
|
85
85
|
config.controller_key = "action_controller.instance"
|
|
86
86
|
config.action_key = "action_dispatch.request.path_parameters[:action]"
|
|
87
87
|
config.resource_key = "action_dispatch.request.path_parameters[:controller]"
|
|
@@ -103,14 +103,14 @@ class MyApp < Sinatra::Base
|
|
|
103
103
|
Datadog::JSONLogger.configure do |config|
|
|
104
104
|
config.current_user = ->(env) { { email: env['warden']&.user&.email } }
|
|
105
105
|
end
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
# Set up logger
|
|
108
108
|
set :logger, Datadog::JSONLogger.new
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
# Add Rack middleware
|
|
111
111
|
use Datadog::RackMiddleware, settings.logger
|
|
112
112
|
end
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
# Your routes here
|
|
115
115
|
end
|
|
116
116
|
```
|
|
@@ -12,7 +12,7 @@ module Rack
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
module Datadog
|
|
15
|
+
module Datadog # rubocop:disable Style/OneClassPerFile
|
|
16
16
|
class RackMiddleware
|
|
17
17
|
attr_reader :app, :logger
|
|
18
18
|
|
|
@@ -45,7 +45,7 @@ module Datadog
|
|
|
45
45
|
def safely_process_request(env)
|
|
46
46
|
app.call(env)
|
|
47
47
|
rescue StandardError => e
|
|
48
|
-
[500, { "Content-Type": "application/json" }, [e.class.name
|
|
48
|
+
[500, { "Content-Type": "application/json" }, ["#{e.class.name}: #{e.message}"]]
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def log_request(request, env, status, headers, start_time, end_time)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datadog-json_logger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eth3rnit3
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: datadog
|
|
@@ -36,13 +35,12 @@ files:
|
|
|
36
35
|
- ".rubocop.yml"
|
|
37
36
|
- ".ruby-version"
|
|
38
37
|
- ".rubycritic.yml"
|
|
38
|
+
- ".tool-versions"
|
|
39
39
|
- CHANGELOG.md
|
|
40
40
|
- CODE_OF_CONDUCT.md
|
|
41
|
-
- Dockerfile.nexus
|
|
42
41
|
- LICENSE.txt
|
|
43
42
|
- README.md
|
|
44
43
|
- Rakefile
|
|
45
|
-
- Steepfile
|
|
46
44
|
- datadog-json_logger.gemspec
|
|
47
45
|
- lib/datadog/configuration.rb
|
|
48
46
|
- lib/datadog/json_logger.rb
|
|
@@ -54,7 +52,6 @@ files:
|
|
|
54
52
|
- lib/datadog/tracing/contrib/bunny/integration.rb
|
|
55
53
|
- lib/datadog/tracing/contrib/bunny/patcher.rb
|
|
56
54
|
- lib/datadog/tracing/contrib/bunny/utils.rb
|
|
57
|
-
- nexus_release.sh
|
|
58
55
|
- sig/.keep
|
|
59
56
|
homepage: https://github.com/buyco/datadog-json-logger
|
|
60
57
|
licenses:
|
|
@@ -65,7 +62,6 @@ metadata:
|
|
|
65
62
|
source_code_uri: https://github.com/buyco/datadog-json-logger
|
|
66
63
|
changelog_uri: https://github.com/buyco/datadog-json-logger/blob/main/CHANGELOG.md
|
|
67
64
|
rubygems_mfa_required: 'true'
|
|
68
|
-
post_install_message:
|
|
69
65
|
rdoc_options: []
|
|
70
66
|
require_paths:
|
|
71
67
|
- lib
|
|
@@ -80,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
76
|
- !ruby/object:Gem::Version
|
|
81
77
|
version: '0'
|
|
82
78
|
requirements: []
|
|
83
|
-
rubygems_version: 3.
|
|
84
|
-
signing_key:
|
|
79
|
+
rubygems_version: 3.6.9
|
|
85
80
|
specification_version: 4
|
|
86
81
|
summary: Connect your ruby application to Datadog logging and tracing.
|
|
87
82
|
test_files: []
|
data/Dockerfile.nexus
DELETED
data/Steepfile
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# D = Steep::Diagnostic
|
|
4
|
-
#
|
|
5
|
-
target :lib do
|
|
6
|
-
signature "sig"
|
|
7
|
-
|
|
8
|
-
check "lib" # Directory name
|
|
9
|
-
# ignore "lib/templates/*.rb"
|
|
10
|
-
|
|
11
|
-
# library "pathname" # Standard libraries
|
|
12
|
-
# library "strong_json" # Gems
|
|
13
|
-
library "logger"
|
|
14
|
-
library "uri"
|
|
15
|
-
library "json"
|
|
16
|
-
|
|
17
|
-
# configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
|
|
18
|
-
# configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
|
19
|
-
# configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
|
20
|
-
# configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
|
|
21
|
-
# configure_code_diagnostics do |hash| # You can setup everything yourself
|
|
22
|
-
# hash[D::Ruby::NoMethod] = :information
|
|
23
|
-
# end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# target :test do
|
|
27
|
-
# signature "sig", "sig-private"
|
|
28
|
-
#
|
|
29
|
-
# check "test"
|
|
30
|
-
#
|
|
31
|
-
# # library "pathname" # Standard libraries
|
|
32
|
-
# end
|