sqreen-kit 0.1.1 → 0.2.0

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: 67cce2a578e0176e7a85af0013cfb61f0e5f30ab1dcde1197c7c877acd90ecf3
4
- data.tar.gz: a18cbf0ab05f032f31d0f0344398707aaf62509ec1721577c53c18c78d09c245
3
+ metadata.gz: '09939c2b1e179a32121dafa7f96c9e1af87c40369894a8809bdd165aa2412388'
4
+ data.tar.gz: 59500cef9fd4048141ffca62431661150732575841e5c8a896c85d39c8f66279
5
5
  SHA512:
6
- metadata.gz: 2dfca3ba84d92439af41a71db9c50c6e0ee0d7d8cc2bc4a6b27edf02ec42f5ed706500bc3e5672363668afda771cbf78ba45b1ad1e5da91c1bd580e2f940c74f
7
- data.tar.gz: 27dbf1dab9407774ce58f2ba79d9a0d1adba95097ee086b31972b35c621d8b6e60bb555eb43021b1bf729d631a8236c8c87850164b8355542cb30c2d9a311177
6
+ metadata.gz: 74ffacce1b772023b8ee9fb460a4569ccd5865f91b4782ec04d0266aba3f4ccf1c8076afb405e752dc3bd82899347e7657f610b9d89ef44675b0f1bfb5d20ef7
7
+ data.tar.gz: a9a6ad2cd45e96689329bc6091a09015c50b6a55c6271c083f2f4ba47d75bf099fc504194ac26cfbfe4ddb07611e7e1a9081321ad028033b84e9ccecbbc2532b
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ * Add configurable source information
6
+ * Fix wire-level formats
7
+
3
8
  ## 0.1.1
4
9
 
5
10
  * Fixed a potential conflict prefenting agent startup
@@ -3,6 +3,7 @@
3
3
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
4
4
  # Please refer to our terms for more information: https://www.sqreen.com/terms.html
5
5
 
6
+ require 'sqreen/kit/version'
6
7
  require 'sqreen/kit/configuration'
7
8
  require 'sqreen/kit/retry_policy'
8
9
  require 'sqreen/kit/http_client'
@@ -17,10 +18,6 @@ module Sqreen
17
18
  module Kit
18
19
  # Factories using the global configuration
19
20
  class << self
20
- def version
21
- @version ||= Gem.loaded_specs['sqreen-kit'].version
22
- end
23
-
24
21
  def auth_signals_client
25
22
  @auth_signals_client ||=
26
23
  Signals::AuthSignalsClient.new(
@@ -4,6 +4,7 @@
4
4
  # Please refer to our terms for more information: https://www.sqreen.com/terms.html
5
5
 
6
6
  require 'logger'
7
+ require 'sqreen/kit/version'
7
8
 
8
9
  module Sqreen
9
10
  module Kit
@@ -34,6 +35,11 @@ module Sqreen
34
35
  :batch_flush_size,
35
36
  :batch_max_size
36
37
 
38
+ # Default value for source in signals taking a generic value
39
+ # Something like 'sqreen:agent:ruby:1.11.1'
40
+ # XXX: do not provide default and force user to explicitly set source?
41
+ attr_accessor :default_source
42
+
37
43
  # @param [String] url
38
44
  def proxy_url=(url)
39
45
  if url.nil?
@@ -64,6 +70,8 @@ module Sqreen
64
70
  logger.progname = 'sqreen-kit'
65
71
 
66
72
  self.ingestion_url = 'https://ingestion.sqreen.com/'
73
+
74
+ self.default_source = "sqreen:kit:#{Sqreen::Kit.version}"
67
75
  end
68
76
 
69
77
  set_defaults
@@ -14,6 +14,8 @@ module Sqreen
14
14
  NilClass, Hash, Array, Numeric, TrueClass, FalseClass
15
15
  ].freeze
16
16
 
17
+ RFC_3339_FMT = '%Y-%m-%dT%H:%M:%S.%3N%:z'.freeze
18
+
17
19
  module ClassMethods
18
20
  # method should have been defined initially in an ancestor
19
21
  def validate_str_attr(attr, regex)
@@ -54,8 +56,17 @@ module Sqreen
54
56
  @self_mandatory_attrs += args
55
57
  end
56
58
 
59
+ def readonly_attrs(*attrs)
60
+ attrs.each do |attr|
61
+ define_method :"#{attr}=" do |value|
62
+ raise "Attribute #{attr} is read-only" unless public_send(attr).nil?
63
+ super(value)
64
+ end
65
+ end
66
+ end
67
+
57
68
  def self_mandatory_attrs
58
- @self_mandatory_attrs || []
69
+ @self_mandatory_attrs ||= []
59
70
  end
60
71
 
61
72
  def mandatory_attrs
@@ -81,11 +92,14 @@ module Sqreen
81
92
  end
82
93
 
83
94
  define_method attr do
84
- cur_val = instance_variable_get("@#{attr}")
95
+ var = "@#{attr}"
96
+ return nil unless instance_variable_defined?(var)
97
+
98
+ cur_val = instance_variable_get(var)
85
99
 
86
100
  return nil if cur_val.nil?
87
101
  return cur_val if cur_val.is_a?(String)
88
- cur_val.strftime('%Y-%m-%dT%H:%M:%S.%L%z')
102
+ cur_val.strftime(RFC_3339_FMT)
89
103
  end
90
104
  end
91
105
 
@@ -133,7 +147,9 @@ module Sqreen
133
147
  end
134
148
 
135
149
  def to_json
136
- res = (@filters || []).reduce(to_h) { |accum, filter| filter[accum] }
150
+ return to_h.to_json unless instance_variable_defined?(:@filters)
151
+
152
+ res = @filters.reduce(to_h) { |accum, filter| filter[accum] }
137
153
  res.to_json
138
154
  end
139
155
 
@@ -100,8 +100,10 @@ module Sqreen
100
100
 
101
101
  def to_h
102
102
  {
103
- agent_type: 'ruby',
104
- }.merge(super())
103
+ infra: {
104
+ agent_type: 'ruby',
105
+ }.merge(super()),
106
+ }
105
107
  end
106
108
  end
107
109
  end # module Signals
@@ -0,0 +1,13 @@
1
+ # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
+ # Please refer to our terms for more information: https://www.sqreen.com/terms.html
3
+
4
+ # Split to avoid a circular dependency between kit.rb and configuration.rb
5
+ module Sqreen
6
+ module Kit
7
+ class << self
8
+ def version
9
+ @version ||= Gem.loaded_specs['sqreen-kit'].version
10
+ end
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loic Nageleisen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-12 00:00:00.000000000 Z
12
+ date: 2020-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqreen-backport
@@ -54,6 +54,7 @@ files:
54
54
  - lib/sqreen/kit/signals/stack_trace.rb
55
55
  - lib/sqreen/kit/signals/trace.rb
56
56
  - lib/sqreen/kit/string_sanitizer.rb
57
+ - lib/sqreen/kit/version.rb
57
58
  homepage: https://sqreen.com
58
59
  licenses:
59
60
  - Sqreen