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)


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

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

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

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

Parameters:

Returns:



73
74
75
76
77
78
79
80
81
82
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 73

def self.create(*args)
  if args[0].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(args[0].j_del),::VertxDropwizard::MetricsService)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]})"
  end
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (String) getBaseName(measured)

Returns the base name of the measured object

Parameters:

Returns:

  • (String)
    the base name of the measured object


59
60
61
62
63
64
65
66
67
68
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 59

def get_base_name(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:getBaseName, [Java::IoVertxCoreMetrics::Measured.java_class]).call(args[0].j_del)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_base_name(#{args[0]})"
  end
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


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

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

- (Set<String>) metricsNames

Returns the known metrics names by this service

Returns:

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


85
86
87
88
89
90
91
92
93
94
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-dropwizard/metrics_service.rb', line 85

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