Class: VertxDropwizard::MetricsService

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb

Overview

The metrics service mainly allows to return a snapshot of measured objects.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 19

def @@j_api_type.accept?(obj)
  obj.class == MetricsService
end

+ (::VertxDropwizard::MetricsService) create(vertx = nil)

Creates a metric service for a given Vertx::Vertx instance.

Parameters:

Returns:

Raises:

  • (ArgumentError)


37
38
39
40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 37

def self.create(vertx=nil)
  if vertx.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtDropwizard::MetricsService.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxDropwizard::MetricsService)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{vertx})"
end

+ (Object) j_api_type



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 31

def self.j_class
  Java::IoVertxExtDropwizard::MetricsService.java_class
end

+ (Object) unwrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 25

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 22

def @@j_api_type.wrap(obj)
  MetricsService.new(obj)
end

Instance Method Details

- (String) get_base_name(measured = nil)

Returns the base name of the measured object

Parameters:

Returns:

  • (String)
    the base name of the measured object

Raises:

  • (ArgumentError)


45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 45

def get_base_name(measured=nil)
  if measured.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:getBaseName, [Java::IoVertxCoreMetrics::Measured.java_class]).call(measured.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling get_base_name(#{measured})"
end

- (Hash{String => Object}) getMetricsSnapshot(measured) - (Hash{String => Object}) getMetricsSnapshot(baseName)

Will return the metrics that begins with the baseName, null if no metrics is available.

Note: in the case of scaled servers, the JsonObject returns an aggregation of the metrics as the dropwizard backend reports to a single server.

Overloads:

  • - (Hash{String => Object}) getMetricsSnapshot(measured)

    Parameters:

  • - (Hash{String => Object}) getMetricsSnapshot(baseName)

    Parameters:

    • baseName (String)

Returns:

  • (Hash{String => Object})
    the map of metrics where the key is the name of the metric and the value is the json data representing that metric

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 67

def get_metrics_snapshot(param_1=nil)
  if param_1.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:getMetricsSnapshot, [Java::IoVertxCoreMetrics::Measured.java_class]).call(param_1.j_del) != nil ? JSON.parse(@j_del.java_method(:getMetricsSnapshot, [Java::IoVertxCoreMetrics::Measured.java_class]).call(param_1.j_del).encode) : nil
  elsif param_1.class == String && !block_given?
    return @j_del.java_method(:getMetricsSnapshot, [Java::java.lang.String.java_class]).call(param_1) != nil ? JSON.parse(@j_del.java_method(:getMetricsSnapshot, [Java::java.lang.String.java_class]).call(param_1).encode) : nil
  end
  raise ArgumentError, "Invalid arguments when calling get_metrics_snapshot(#{param_1})"
end

- (Set<String>) metrics_names

Returns the known metrics names by this service

Returns:

  • (Set<String>)
    the known metrics names by this service

Raises:

  • (ArgumentError)


52
53
54
55
56
57
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 52

def metrics_names
  if !block_given?
    return ::Vertx::Util::Utils.to_set(@j_del.java_method(:metricsNames, []).call()).map! { |elt| elt }
  end
  raise ArgumentError, "Invalid arguments when calling metrics_names()"
end