Class: A2A::Monitoring::LoggingBackend
- Inherits:
-
Object
- Object
- A2A::Monitoring::LoggingBackend
- Defined in:
- lib/a2a/monitoring.rb
Overview
Logging metrics backend
Instance Method Summary collapse
-
#initialize(config) ⇒ LoggingBackend
constructor
A new instance of LoggingBackend.
-
#record(name, value, **labels) ⇒ Object
Record metric to logs.
Constructor Details
#initialize(config) ⇒ LoggingBackend
Returns a new instance of LoggingBackend.
374 375 376 377 |
# File 'lib/a2a/monitoring.rb', line 374 def initialize(config) @config = config @logger = config.logger end |
Instance Method Details
#record(name, value, **labels) ⇒ Object
Record metric to logs
383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/a2a/monitoring.rb', line 383 def record(name, value, **labels) return unless @logger metric_data = { metric_name: name, metric_value: value, metric_labels: labels, timestamp: Time.now.iso8601 } @logger.info("METRIC: #{metric_data.to_json}") end |