sqreen 1.24.0 → 1.24.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b43caee6a7702bfde6a56f9a3d9ad735de10b5a214ce5d097c3c26c3527f5918
4
- data.tar.gz: 803451b19b5277384c9e74b186e00e0a1d0d8a8a77cb5483cf486088a1705b0d
3
+ metadata.gz: 5af6f04955c963eed44fee974e349c98af97865f27106d636a094f57bf2894f1
4
+ data.tar.gz: 88ddda4d964661c6f9dd39ad980ee3be46787eb1e9ba31656d7c6ec0d1b60047
5
5
  SHA512:
6
- metadata.gz: 2d35106412544c74a99bcf5eb39b1bc33d95720efbce196e139c15f40c1259b1aaf4646cab127849b9235d3f1cf0ce421c01859eb1c4bc6076683d3f7beeef33
7
- data.tar.gz: b0f5452dda0d2702397968e103313bf910bb996c09064354be78fcabb6492dbb15d898aa1caf5835307a5f21b878550fae59826fbc347382772cba1823cefea2
6
+ metadata.gz: fbbfc447bfb415cfed1c476907387c5d347810985f2b82a10a28c3f836c25fcc863244d164503a7220e0e6f38d598918331c0f802a2465b1f0a3f7407d895c74
7
+ data.tar.gz: ba08edf7f68cd16ee70a688a9d9437e41ecbb1f5504750fdd5c791ff3e993f65b80c27f443f44e97e7250d733b25605e7753023dc09367210fc67ca7bcd4e489
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.24.1
2
+
3
+ * Add Datadog trace keeping through sampling
4
+ * Improve Datadog correlation compatibility with Sinatra
5
+ * Improve attack event correlation with Datadog spans
6
+
1
7
  ## 1.24.0
2
8
 
3
9
  * Add Sqreen event correlation with Datadog traces
@@ -61,6 +61,26 @@ module Sqreen
61
61
  u.append(p)
62
62
  end
63
63
  end
64
+
65
+ insert_datadog_middleware(builder, *args, &block)
66
+ end
67
+
68
+ def insert_datadog_middleware(builder, *args, &block)
69
+ return unless defined?(Datadog) && Datadog.respond_to?(:configuration) && Datadog.configuration.instrumented_integrations.key?(:sinatra)
70
+
71
+ Datadog.configure do |c|
72
+ sinatra_config = Datadog.configuration[:sinatra]
73
+
74
+ c.use(
75
+ :rack,
76
+ service_name: sinatra_config[:service_name],
77
+ distributed_tracing: sinatra_config[:distributed_tracing],
78
+ ) unless Datadog.configuration.instrumented_integrations.key?(:rack)
79
+ end
80
+
81
+ insert_middleware(builder, Datadog::Contrib::Rack::TraceMiddleware, args, block) do |p, u|
82
+ u.insert(0, p)
83
+ end
64
84
  end
65
85
 
66
86
  def wrap_middleware(middleware, *args, &block)
@@ -70,6 +70,15 @@ module Sqreen
70
70
  if payload_tpl.include?('context')
71
71
  payload[:backtrace] = Sqreen::Context.new.bt
72
72
  end
73
+ if framework.respond_to?(:datadog_span) && (datadog_span = framework.datadog_span)
74
+ Sqreen::Weave.logger.debug { "attack datadog:true span_id:#{datadog_span.span_id} parent_id:#{datadog_span.parent_id} trace_id:#{datadog_span.trace_id}" }
75
+ payload.merge!(
76
+ :datadog_trace_id => datadog_span.trace_id,
77
+ :datadog_span_id => datadog_span.span_id,
78
+ )
79
+ datadog_span.set_tag(Datadog::Ext::ManualTracing::TAG_KEEP, true)
80
+ datadog_span.set_tag('sqreen.event', true)
81
+ end
73
82
  framework.observe(:attacks, payload, payload_tpl)
74
83
  end
75
84
 
@@ -4,5 +4,5 @@
4
4
  # Please refer to our terms for more information: https://www.sqreen.com/terms.html
5
5
 
6
6
  module Sqreen
7
- VERSION = '1.24.0'.freeze
7
+ VERSION = '1.24.1'.freeze
8
8
  end
@@ -244,8 +244,7 @@ class Sqreen::Weave::Legacy::Instrumentation
244
244
 
245
245
  # shrinkwrap_timer = Sqreen::Graft::Timer.new('weave,shrinkwrap')
246
246
  # shrinkwrap_timer.start
247
- if defined?(Datadog)
248
- datadog_span = Datadog.tracer.active_root_span
247
+ if defined?(Datadog) && Datadog.tracer && (datadog_span = Datadog.tracer.active_root_span)
249
248
  Sqreen::Weave.logger.debug { "request datadog:true span_id:#{datadog_span.span_id} parent_id:#{datadog_span.parent_id} trace_id:#{datadog_span.trace_id}" }
250
249
  end
251
250
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.24.0
4
+ version: 1.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-30 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqreen-backport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.3
33
+ version: 0.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.3
40
+ version: 0.2.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sq_mini_racer
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
354
  - !ruby/object:Gem::Version
355
355
  version: '0'
356
356
  requirements: []
357
- rubygems_version: 3.2.3
357
+ rubygems_version: 3.2.16
358
358
  signing_key:
359
359
  specification_version: 4
360
360
  summary: Sqreen Ruby agent