datadog-statsd-schema 0.1.1 → 0.2.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/.envrc +2 -0
- data/.rspec +2 -1
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +32 -47
- data/FUTURE_DIRECTION.md +32 -0
- data/README.md +309 -258
- data/Rakefile +7 -7
- data/examples/schema/example_marathon.rb +29 -0
- data/examples/shared.rb +1 -1
- data/exe/dss +8 -0
- data/lib/datadog/statsd/emitter.rb +102 -21
- data/lib/datadog/statsd/schema/analyzer.rb +397 -0
- data/lib/datadog/statsd/schema/cli.rb +16 -0
- data/lib/datadog/statsd/schema/commands/analyze.rb +52 -0
- data/lib/datadog/statsd/schema/commands.rb +14 -0
- data/lib/datadog/statsd/schema/errors.rb +54 -1
- data/lib/datadog/statsd/schema/metric_definition.rb +86 -3
- data/lib/datadog/statsd/schema/namespace.rb +91 -5
- data/lib/datadog/statsd/schema/schema_builder.rb +162 -4
- data/lib/datadog/statsd/schema/tag_definition.rb +66 -6
- data/lib/datadog/statsd/schema/version.rb +6 -1
- data/lib/datadog/statsd/schema.rb +91 -13
- metadata +25 -4
- data/exe/datadog-statsd-schema +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ecccf4d0e55d1139596eca6ecfc41cf25a4bcd637aebdb4cb963150aa10ce7
|
4
|
+
data.tar.gz: 002504ebc4073bb7b34a5d979cb49f89d86e8eff5356594046bd3e1e223c8ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8f866b339297e39236ba1e546f50aff716f46e74d6856386a5de95ace0dfea5e62f060aec4e5e61320dd352a5d0bf971c38be4c7e9ee15ff17ea4b0083ad389
|
7
|
+
data.tar.gz: ff341e1836eebc261125c6cbd42103e359286bcb1bed0ed47fc96df9c2727f8873f6cd31e6e3591ca991b4b977fb9bdae42d5ef228eeebda7847da9129635ea9
|
data/.envrc
ADDED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -6,6 +6,7 @@ plugins:
|
|
6
6
|
AllCops:
|
7
7
|
TargetRubyVersion: 3.1
|
8
8
|
NewCops: enable
|
9
|
+
SuggestExtensions: false
|
9
10
|
|
10
11
|
Style/StringLiterals:
|
11
12
|
EnforcedStyle: double_quotes
|
@@ -18,3 +19,12 @@ Metrics/MethodLength:
|
|
18
19
|
|
19
20
|
Metrics/BlockLength:
|
20
21
|
Enabled: false
|
22
|
+
|
23
|
+
Layout/LineLength:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Metrics/MethodLength:
|
30
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,19 +1,11 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2025-
|
3
|
+
# on 2025-06-06 22:59:19 UTC using RuboCop version 1.75.8.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
11
|
-
# SupportedStyles: Gemfile, gems.rb, gemspec
|
12
|
-
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
13
|
-
Gemspec/DevelopmentDependencies:
|
14
|
-
Exclude:
|
15
|
-
- 'datadog-statsd-schema.gemspec'
|
16
|
-
|
17
9
|
# Offense count: 4
|
18
10
|
Lint/DuplicateMethods:
|
19
11
|
Exclude:
|
@@ -24,20 +16,20 @@ Lint/FloatComparison:
|
|
24
16
|
Exclude:
|
25
17
|
- 'lib/datadog/statsd/emitter.rb'
|
26
18
|
|
27
|
-
# Offense count:
|
19
|
+
# Offense count: 14
|
28
20
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
29
21
|
Metrics/AbcSize:
|
30
|
-
Max:
|
22
|
+
Max: 54
|
31
23
|
|
32
|
-
# Offense count:
|
24
|
+
# Offense count: 5
|
33
25
|
# Configuration parameters: CountComments, CountAsOne.
|
34
26
|
Metrics/ClassLength:
|
35
|
-
Max:
|
27
|
+
Max: 369
|
36
28
|
|
37
|
-
# Offense count:
|
29
|
+
# Offense count: 8
|
38
30
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
39
31
|
Metrics/CyclomaticComplexity:
|
40
|
-
Max:
|
32
|
+
Max: 20
|
41
33
|
|
42
34
|
# Offense count: 5
|
43
35
|
# Configuration parameters: CountComments, CountAsOne.
|
@@ -47,12 +39,12 @@ Metrics/ModuleLength:
|
|
47
39
|
# Offense count: 2
|
48
40
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
49
41
|
Metrics/ParameterLists:
|
50
|
-
Max:
|
42
|
+
Max: 8
|
51
43
|
|
52
|
-
# Offense count:
|
44
|
+
# Offense count: 6
|
53
45
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
54
46
|
Metrics/PerceivedComplexity:
|
55
|
-
Max:
|
47
|
+
Max: 19
|
56
48
|
|
57
49
|
# Offense count: 3
|
58
50
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
@@ -78,7 +70,6 @@ Naming/MethodParameterName:
|
|
78
70
|
# MethodDefinitionMacros: define_method, define_singleton_method
|
79
71
|
Naming/PredicateName:
|
80
72
|
Exclude:
|
81
|
-
- 'spec/**/*'
|
82
73
|
- 'lib/datadog/statsd/schema/namespace.rb'
|
83
74
|
|
84
75
|
# Offense count: 4
|
@@ -88,10 +79,10 @@ RSpec/ContextWording:
|
|
88
79
|
Exclude:
|
89
80
|
- 'spec/datadog/statsd/schema/namespace_spec.rb'
|
90
81
|
|
91
|
-
# Offense count:
|
82
|
+
# Offense count: 19
|
92
83
|
# Configuration parameters: CountAsOne.
|
93
84
|
RSpec/ExampleLength:
|
94
|
-
Max:
|
85
|
+
Max: 36
|
95
86
|
|
96
87
|
# Offense count: 4
|
97
88
|
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
@@ -105,9 +96,9 @@ RSpec/IndexedLet:
|
|
105
96
|
RSpec/MessageSpies:
|
106
97
|
EnforcedStyle: receive
|
107
98
|
|
108
|
-
# Offense count:
|
99
|
+
# Offense count: 9
|
109
100
|
RSpec/MultipleExpectations:
|
110
|
-
Max:
|
101
|
+
Max: 24
|
111
102
|
|
112
103
|
# Offense count: 39
|
113
104
|
# Configuration parameters: AllowSubject.
|
@@ -134,19 +125,20 @@ RSpec/VerifiedDoubles:
|
|
134
125
|
- 'spec/datadog/statsd/schema/metric_definition_spec.rb'
|
135
126
|
- 'spec/datadog/statsd/schema_spec.rb'
|
136
127
|
|
137
|
-
# Offense count:
|
138
|
-
#
|
139
|
-
|
128
|
+
# Offense count: 1
|
129
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
130
|
+
# Configuration parameters: MinBranchesCount.
|
131
|
+
Style/CaseLikeIf:
|
140
132
|
Exclude:
|
141
|
-
- '
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
- 'lib/datadog/statsd/schema/
|
133
|
+
- 'lib/datadog/statsd/schema/analyzer.rb'
|
134
|
+
|
135
|
+
# Offense count: 5
|
136
|
+
# This cop supports safe autocorrection (--autocorrect).
|
137
|
+
# Configuration parameters: EnforcedStyle.
|
138
|
+
# SupportedStyles: format, sprintf, percent
|
139
|
+
Style/FormatString:
|
140
|
+
Exclude:
|
141
|
+
- 'lib/datadog/statsd/schema/analyzer.rb'
|
150
142
|
|
151
143
|
# Offense count: 1
|
152
144
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
@@ -154,8 +146,7 @@ Style/Documentation:
|
|
154
146
|
# SupportedStyles: always, always_true, never
|
155
147
|
Style/FrozenStringLiteralComment:
|
156
148
|
Exclude:
|
157
|
-
- '
|
158
|
-
- 'exe/datadog-statsd-schema'
|
149
|
+
- 'examples/schema/example_marathon.rb'
|
159
150
|
|
160
151
|
# Offense count: 3
|
161
152
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
@@ -171,10 +162,11 @@ Style/HashLikeCase:
|
|
171
162
|
Exclude:
|
172
163
|
- 'spec/datadog/statsd/schema/schema_builder_spec.rb'
|
173
164
|
|
174
|
-
# Offense count:
|
165
|
+
# Offense count: 4
|
175
166
|
# This cop supports safe autocorrection (--autocorrect).
|
176
167
|
Style/IfUnlessModifier:
|
177
168
|
Exclude:
|
169
|
+
- 'examples/shared.rb'
|
178
170
|
- 'lib/datadog/statsd/emitter.rb'
|
179
171
|
|
180
172
|
# Offense count: 1
|
@@ -210,18 +202,11 @@ Style/SlicingWithRange:
|
|
210
202
|
Exclude:
|
211
203
|
- 'lib/datadog/statsd/schema/namespace.rb'
|
212
204
|
|
213
|
-
# Offense count:
|
205
|
+
# Offense count: 4
|
214
206
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
215
207
|
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
216
|
-
# AllowedMethods: define_method
|
208
|
+
# AllowedMethods: define_method, mail, respond_to
|
217
209
|
Style/SymbolProc:
|
218
210
|
Exclude:
|
219
211
|
- 'spec/datadog/statsd/schema/schema_builder_spec.rb'
|
220
212
|
- 'spec/datadog/statsd/schema_spec.rb'
|
221
|
-
|
222
|
-
# Offense count: 4
|
223
|
-
# This cop supports safe autocorrection (--autocorrect).
|
224
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
225
|
-
# URISchemes: http, https
|
226
|
-
Layout/LineLength:
|
227
|
-
Max: 140
|
data/FUTURE_DIRECTION.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Future Direction
|
2
|
+
|
3
|
+
## Small Features & Improvements
|
4
|
+
|
5
|
+
* Validation mode: raise or log the error, but send the non-compliant metric anyway (good for migrations from raw statsd to `emitter`)
|
6
|
+
|
7
|
+
## Large Features / Stories
|
8
|
+
|
9
|
+
<dt>"The Service Registry" gem — <code>datadog-statsd-registry</code></dt>
|
10
|
+
<dd>The gem would use <code>self.inherited</code> hook to auto-register each emitter and each schema in the global registry, to be recallable and searchable anywhere in the application code. This would encourage possible pre-declaration of most key emitters in a single initializer file, while still allowing ad-hoc creation, that does not get attached to the registry and will be garbage collected. Emitters are largely just a pre-determined combination of tags and a metric prefix, with a schema of allowable metrics and tags. It could be beneficial to reuse say <code>@email_stats_emitter</code> among multiple mailers in the system, but how to you get then to share an instance without some sort of a registry or IoC? Have schema and emmitter instances register by name in the global application space.<br/><br />
|
11
|
+
|
12
|
+
Example:
|
13
|
+
<pre>
|
14
|
+
emitter = Datadog::Statsd.registry[:email_emitter]
|
15
|
+
emitter.increment('total')
|
16
|
+
</pre>
|
17
|
+
</dd>
|
18
|
+
|
19
|
+
<dt>Ensure Thread Safety for Emitter</dt>
|
20
|
+
<dd>If emitters are to be shared, they necessarily must be thread safe, as should be the underlying <code>Datadog::Statsd</code></dd>
|
21
|
+
|
22
|
+
### Multi-Gem Design
|
23
|
+
|
24
|
+
* Split `Datadog::Statsd::Emitter` class into its own gem, eg `datadog-statsd-emitter` without the schema. Allow emitter to receive a validator proc for extensions.
|
25
|
+
* Make this schema gem a validation extension to the emitter gem.
|
26
|
+
|
27
|
+
Allow in the end a mix-match of:
|
28
|
+
* `datadog-statsd-emitter`
|
29
|
+
* `datadog-statsd-registry`
|
30
|
+
* `datadog-statsd-schema`
|
31
|
+
|
32
|
+
|