Class: Conversant::V3::Services::CDN::Monitoring

Inherits:
Object
  • Object
show all
Defined in:
lib/conversant/v3/services/cdn/monitoring.rb

Overview

Monitoring service for CDN performance tracking

Provides real-time monitoring data and performance metrics for CDN infrastructure and service health.

Examples:

Monitor CDN health

cdn = Conversant::V3.cdn(12345)

spots = cdn.monitoring.spots({
  startTime: "2025-01-01T00:00:00Z",
  endTime: "2025-01-01T01:00:00Z",
  domains: ["example.com"]
})

spots.each do |spot|
  puts "#{spot['location']}: #{spot['status']}"
end

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Monitoring

Initialize monitoring service

Parameters:

  • parent (CDN)

    the parent CDN service instance

Since:

  • 1.0.0



33
34
35
# File 'lib/conversant/v3/services/cdn/monitoring.rb', line 33

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#parentCDN (readonly)

Returns the parent CDN service instance.

Returns:

  • (CDN)

    the parent CDN service instance

Since:

  • 1.0.0



28
29
30
# File 'lib/conversant/v3/services/cdn/monitoring.rb', line 28

def parent
  @parent
end

Instance Method Details

#spots(payload) ⇒ Array

Get monitoring spot data

Examples:

Get monitoring data

spots = cdn.monitoring.spots({
  startTime: "2025-01-01T00:00:00Z",
  endTime: "2025-01-01T01:00:00Z",
  domains: ["example.com"]
})
spots.each { |spot| puts "#{spot['location']}: #{spot['status']}" }

Parameters:

  • payload (Hash)

    monitoring parameters

Options Hash (payload):

  • :startTime (String)

    start time in ISO 8601 format

  • :endTime (String)

    end time in ISO 8601 format

  • :domains (Array<String>)

    array of domains to monitor

Returns:

  • (Array)

    array of monitoring spots data, or empty array on error

Since:

  • 1.0.0



55
56
57
58
59
60
# File 'lib/conversant/v3/services/cdn/monitoring.rb', line 55

def spots(payload)
  JSON.parse(@parent.send(:call, 'POST', '/api/monitoring', payload))&.[]('spots') || []
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  []
end