github.com/Financial-Times/publish-availability-monitor@v1.12.0/metrics/publish_metric.go (about)

     1  package metrics
     2  
     3  import (
     4  	"fmt"
     5  	"net/url"
     6  	"time"
     7  
     8  	"github.com/Financial-Times/publish-availability-monitor/config"
     9  )
    10  
    11  // PublishMetric holds the information about the metric we are measuring.
    12  type PublishMetric struct {
    13  	UUID            string
    14  	PublishOK       bool      //did it meet the SLA?
    15  	PublishDate     time.Time //the time WE get the message
    16  	Platform        string
    17  	PublishInterval Interval //the interval it was actually published in, ex. (10,20)
    18  	Config          config.MetricConfig
    19  	Endpoint        url.URL
    20  	TID             string
    21  	IsMarkedDeleted bool
    22  	Capability      *config.Capability
    23  }
    24  
    25  func (pm PublishMetric) String() string {
    26  	return fmt.Sprintf("Tid: %s, UUID: %s, Platform: %s, Endpoint: %s, PublishDate: %s, Duration: %d, Succeeded: %t.",
    27  		pm.TID,
    28  		pm.UUID,
    29  		pm.Platform,
    30  		pm.Config.Alias,
    31  		pm.PublishDate.String(),
    32  		pm.PublishInterval.UpperBound,
    33  		pm.PublishOK,
    34  	)
    35  }
    36  
    37  // Interval is a simple representation of an interval of time, with a lower and
    38  // upper boundary
    39  type Interval struct {
    40  	LowerBound int
    41  	UpperBound int
    42  }