Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LatencyReport

type LatencyReport struct {
	Endpoint  string
	TimeTaken time.Duration
	URL       string
	Target    Target
}

    LatencyReport defines the time taken for a report to 3scale Endpoint should be set as "Authorize" or "Report" for backend requests Target must be one of "Backend" or "System" for a report to be processed

    func NewLatencyReport

    func NewLatencyReport(endpoint string, duration time.Duration, url string, target Target) LatencyReport

      NewLatencyReport creates a LatencyReport

      type Reporter

      type Reporter struct {
      	// contains filtered or unexported fields
      }

        Reporter holds configuration for the Prometheus metrics implementation

        func NewMetricsReporter

        func NewMetricsReporter(reportMetrics bool, serveOnPort int) *Reporter

          NewMetricsReporter creates a new Reporter

          func (*Reporter) IncrementCacheHits

          func (r *Reporter) IncrementCacheHits()

            IncrementCacheHits increments proxy configurations that have been read from the cache

            func (*Reporter) ObserveLatency

            func (r *Reporter) ObserveLatency(l LatencyReport) error

              ObserveLatency reports a metric to a latency histogram. Logs and returns an error in cases where the metric has not been reported.

              func (*Reporter) ReportMetrics

              func (r *Reporter) ReportMetrics(serviceID string, l LatencyReport, s StatusReport)

                ReportMetrics reports a LatencyReport and StatusReport to Prometheus. It ignores errors from creating metrics so if the error needs to be handled outside of being logged, the metrics should be reported directly.

                func (*Reporter) ReportStatus

                func (r *Reporter) ReportStatus(serviceID string, s StatusReport) error

                  ReportStatus reports a hit to 3scale backend and reports status code of the result Logs and returns an error in cases where the metric has not been reported.

                  func (*Reporter) Serve

                  func (r *Reporter) Serve()

                    Serve starts a HTTP server and publishes metrics for scraping at the /metrics endpoint

                    type StatusReport

                    type StatusReport struct {
                    	Endpoint string
                    	Code     int
                    	URL      string
                    	Target   Target
                    }

                      StatusReport defines a HTTP status code report from 3scale Endpoint should be set as "Authorize" or "Report" for backend requests Currently only "Backend" Target supported

                      func NewStatusReport

                      func NewStatusReport(endpoint string, code int, url string, target Target) StatusReport

                        NewStatusReport creates a StatusReport

                        type Target

                        type Target string

                          Target is a legitimate target to report 3scale metrics from

                          const Backend Target = "Backend"

                            Backend target should be used when reporting latency or status codes from 3scale backend

                            const System Target = "System"

                              System target should be used when reporting latency or status codes from 3scale system

                              Source Files