Module: Datadog::Statsd::Schema
- Defined in:
- lib/datadog/statsd/schema.rb,
lib/datadog/statsd/schema/cli.rb,
lib/datadog/statsd/schema/errors.rb,
lib/datadog/statsd/schema/version.rb,
lib/datadog/statsd/schema/analyzer.rb,
lib/datadog/statsd/schema/commands.rb,
lib/datadog/statsd/schema/namespace.rb,
lib/datadog/statsd/schema/schema_builder.rb,
lib/datadog/statsd/schema/tag_definition.rb,
lib/datadog/statsd/schema/commands/analyze.rb,
lib/datadog/statsd/schema/metric_definition.rb
Overview
Schema definition and validation module for StatsD metrics
Defined Under Namespace
Modules: CLI, Commands Classes: Analyzer, Configuration, DuplicateMetricError, Error, InvalidMetricTypeError, InvalidNamespaceError, InvalidTagError, MetricDefinition, MissingRequiredTagError, Namespace, SchemaBuilder, SchemaError, TagDefinition, UnknownMetricError
Constant Summary collapse
- VERSION =
Current version of the datadog-statsd-schema gem
"0.2.1"
- AnalysisResult =
Result structure for schema analysis
Data.define( :total_unique_metrics, :metrics_analysis, :total_possible_custom_metrics )
- MetricAnalysis =
Analysis data for individual metrics
Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations )
Class Attribute Summary collapse
-
.in_test ⇒ Boolean
Controls whether the schema is in test mode When true, colored output is disabled for test environments.
Instance Attribute Summary collapse
-
#expanded_names ⇒ Array<String>
readonly
All expanded metric names (for gauge/distribution/histogram).
-
#metric_name ⇒ String
readonly
Full metric name.
-
#metric_type ⇒ Symbol
readonly
Type of metric (:counter, :gauge, etc.).
-
#metrics_analysis ⇒ Array<MetricAnalysis>
readonly
Analysis for each metric.
-
#total_combinations ⇒ Integer
readonly
Total possible tag value combinations for this metric.
-
#total_possible_custom_metrics ⇒ Integer
readonly
Total number of possible custom metric combinations.
-
#total_unique_metrics ⇒ Integer
readonly
Total number of unique metric names (including expansions).
-
#unique_tag_values ⇒ Integer
readonly
Total number of unique tag values across all tags.
-
#unique_tags ⇒ Integer
readonly
Number of unique tags for this metric.
Class Method Summary collapse
-
.configuration ⇒ Datadog::Statsd::Schema::Configuration
Get the global configuration object.
-
.configure {|Configuration| ... } ⇒ Object
Configure global schema settings.
-
.load_file(path) ⇒ Datadog::Statsd::Schema::Namespace
Load schema definition from a file.
-
.new ⇒ Datadog::Statsd::Schema::Namespace
Create a new schema definition using the provided block.
Class Attribute Details
.in_test ⇒ Boolean
Controls whether the schema is in test mode When true, colored output is disabled for test environments
70 71 72 |
# File 'lib/datadog/statsd/schema.rb', line 70 def in_test @in_test end |
Instance Attribute Details
#expanded_names ⇒ Array<String> (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
#metric_name ⇒ String (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
#metric_type ⇒ Symbol (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
#metrics_analysis ⇒ Array<MetricAnalysis> (readonly)
19 20 21 22 23 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 19 AnalysisResult = Data.define( :total_unique_metrics, :metrics_analysis, :total_possible_custom_metrics ) |
#total_combinations ⇒ Integer (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
#total_possible_custom_metrics ⇒ Integer (readonly)
19 20 21 22 23 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 19 AnalysisResult = Data.define( :total_unique_metrics, :metrics_analysis, :total_possible_custom_metrics ) |
#total_unique_metrics ⇒ Integer (readonly)
19 20 21 22 23 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 19 AnalysisResult = Data.define( :total_unique_metrics, :metrics_analysis, :total_possible_custom_metrics ) |
#unique_tag_values ⇒ Integer (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
#unique_tags ⇒ Integer (readonly)
38 39 40 41 42 43 44 45 |
# File 'lib/datadog/statsd/schema/analyzer.rb', line 38 MetricAnalysis = Data.define( :metric_name, :metric_type, :expanded_names, :unique_tags, :unique_tag_values, :total_combinations ) |
Class Method Details
.configuration ⇒ Datadog::Statsd::Schema::Configuration
Get the global configuration object
121 122 123 |
# File 'lib/datadog/statsd/schema.rb', line 121 def self.configuration @configuration ||= Configuration.new end |
.configure {|Configuration| ... } ⇒ Object
Configure global schema settings
115 116 117 |
# File 'lib/datadog/statsd/schema.rb', line 115 def self.configure yield configuration end |
.load_file(path) ⇒ Datadog::Statsd::Schema::Namespace
Load schema definition from a file
101 102 103 104 105 |
# File 'lib/datadog/statsd/schema.rb', line 101 def self.load_file(path) builder = SchemaBuilder.new builder.instance_eval(File.read(path), path) builder.build end |
.new ⇒ Datadog::Statsd::Schema::Namespace
Create a new schema definition using the provided block
89 90 91 92 93 |
# File 'lib/datadog/statsd/schema.rb', line 89 def self.new(&) builder = SchemaBuilder.new builder.instance_eval(&) if block_given? builder.build end |