rest

package
v0.0.0-...-986d81d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2018 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rest contains the structs and logic to handle exposing internal metrics via a simple REST api for consumption by a myriad of different collection mechanisms.

The rest api is exposed by default at 'http://127.0.0.1:1099/metrics', but the ip, port, and uri are configurable at run time.

The statistics structure that is exposed is the following with both the links and queues objects being variable based on usage:

{
  "TxMetrics": {
    "droppedPackets": 0,
    "packets": 2,
    "droppedBytes": 0,
    "bytes": 40,
    "links": {
      "10.99.0.1": {
        "droppedPackets": 0,
        "packets": 2,
        "droppedBytes": 0,
        "bytes": 40
      }
    },
    "queues": [
      {
        "droppedPackets": 0,
        "packets": 2,
        "droppedBytes": 0,
        "bytes": 40
      }
    ]
  },
  "RxMetrics": {
    "droppedPackets": 1,
    "packets": 1,
    "droppedBytes": 20,
    "bytes": 20,
    "links": {
      "10.99.0.1": {
        "droppedPackets": 0,
        "packets": 1,
        "droppedBytes": 0,
        "bytes": 20
      }
    },
    "queues": [
      {
        "droppedPackets": 1,
        "packets": 1,
        "droppedBytes": 20,
        "bytes": 20
      }
    ]
  }
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rest

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

Rest is a generic rest api struct for exporting internal information and general purpose api settings.

func New

func New(cfg *common.Config, aggregator *metric.Aggregator) *Rest

New generates an Rest instance exposing metrics and general purpose routes via a REST api interface.

func (*Rest) Start

func (rest *Rest) Start()

Start will start the rest api up on the specified address and routes.

func (*Rest) Stop

func (rest *Rest) Stop() error

Stop will stop the rest api.

Source Files

  • doc.go
  • rest.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL