Class: Tracekit::Metrics::MetricDataPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/tracekit/metrics/metric_data_point.rb

Overview

Represents a single metric data point for export

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:, value:, tags:) ⇒ MetricDataPoint

Returns a new instance of MetricDataPoint.



9
10
11
12
13
14
15
# File 'lib/tracekit/metrics/metric_data_point.rb', line 9

def initialize(name:, type:, value:, tags:)
  @name = name
  @type = type  # "counter", "gauge", "histogram"
  @value = value
  @tags = tags
  @timestamp_nanos = (Time.now.to_f * 1_000_000_000).to_i
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/tracekit/metrics/metric_data_point.rb', line 7

def name
  @name
end

#tagsObject (readonly)

Returns the value of attribute tags.



7
8
9
# File 'lib/tracekit/metrics/metric_data_point.rb', line 7

def tags
  @tags
end

#timestamp_nanosObject (readonly)

Returns the value of attribute timestamp_nanos.



7
8
9
# File 'lib/tracekit/metrics/metric_data_point.rb', line 7

def timestamp_nanos
  @timestamp_nanos
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/tracekit/metrics/metric_data_point.rb', line 7

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/tracekit/metrics/metric_data_point.rb', line 7

def value
  @value
end