api

package
v0.0.0-...-b8b0e3c Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintRoutes

func PrintRoutes(echoServer *echo.Echo)

PrintRoutes prints routes in the server

func Setup

Setup sets up the application API

func SetupDetailAPI

func SetupDetailAPI(g *echo.Group, ds service.DetailService)

SetupDetailAPI sets up the API

func SetupInfoAPI

func SetupInfoAPI(info *config.Info, g *echo.Group)

SetupInfoAPI sets up the info endpoint

func SetupProjectAPI

func SetupProjectAPI(g *echo.Group, ps service.ProjectService)

SetupProjectAPI sets up the API

func SetupRawAPI

SetupRawAPI sets up the API

func SetupRunAPI

func SetupRunAPI(g *echo.Group, rs service.RunService, ds service.DetailService)

SetupRunAPI sets up the API

func SetupTestAPI

func SetupTestAPI(g *echo.Group, ts service.TestService, rs service.RunService)

SetupTestAPI sets up the API

Types

type BucketExport

type BucketExport struct {
	// The Mark for histogram bucket in seconds
	Mark float64 `json:"mark"`

	// The count in the bucket
	Count int `json:"count"`

	// The frequency of results in the bucket as a decimal percentage
	Frequency float64 `json:"frequency"`
}

BucketExport holds histogram data

type Detail

type Detail struct {
	Model

	// Run id
	RunID uint `json:"runID" example:"321"`

	// Timestamp for the detail
	Timestamp time.Time `json:"timestamp"`

	// Latency of the call
	Latency float64 `json:"latency" validate:"required"`

	// Error details
	Error string `json:"error"`

	// Status of the call
	Status string `json:"status"`
}

Detail is a detail object

type DetailAPI

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

DetailAPI provides the api

type DetailExport

type DetailExport struct {
	Latency float64 `json:"latency" validate:"required"`
	Error   string  `json:"error"`
	Status  string  `json:"status"`
}

DetailExport is detail for export

type DetailListRequest

type DetailListRequest struct {
	// The property by which to sort the results
	Sort string `json:"sort" query:"sort" validate:"omitempty,oneof=id"`

	// The sort order
	Order string `json:"order" query:"order" validate:"omitempty,oneof=asc desc"`

	// The page to view
	Page uint `json:"page" query:"page"`
}

DetailListRequest request

type DetailListResponse

type DetailListResponse struct {
	Listable

	// List of detail objects
	Data []*Detail `json:"data"`
}

DetailListResponse response holds a list of details

type DetailsCreated

type DetailsCreated struct {
	// Number of successfully created detail objects
	Success uint `json:"success"`

	// Number of failed detail objects
	Fail uint `json:"fail"`
}

DetailsCreated summary of how many details got created and how many failed

type InfoAPI

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

InfoAPI struct for info api

type InfoResponse

type InfoResponse struct {
	// Version of the application
	Version string `json:"version"`

	// Go runtime version
	RuntimeVersion string `json:"runtimeVersion"`

	// Uptime of the server
	Uptime string `json:"uptime"`

	// Memory info
	MemoryInfo *MemoryInfo `json:"memoryInfo,omitempty"`
}

InfoResponse is the info response

type JSONExportRespose

type JSONExportRespose struct {
	Date    time.Time     `json:"date"`
	Count   uint64        `json:"count"`
	Total   time.Duration `json:"total"`
	Average time.Duration `json:"average"`
	Fastest time.Duration `json:"fastest"`
	Slowest time.Duration `json:"slowest"`
	Rps     float64       `json:"rps"`

	Options *model.Options `json:"options,omitempty"`

	LatencyDistribution []*LatencyExport `json:"latencyDistribution"`
	Histogram           []*BucketExport  `json:"histogram"`

	Details []*DetailExport `json:"details"`
}

JSONExportRespose is the response to JSON export

type LatencyExport

type LatencyExport struct {
	Percentage int           `json:"percentage"`
	Latency    time.Duration `json:"latency"`
}

LatencyExport holds latency distribution data

type Listable

type Listable struct {
	// The total number of items
	Total uint `json:"total" example:"10"`
}

Listable is list

type MemoryInfo

type MemoryInfo struct {
	// Bytes of allocated heap objects.
	Alloc uint64 `json:"allocated"`

	// Cumulative bytes allocated for heap objects.
	TotalAlloc uint64 `json:"totalAllocated"`

	// The total bytes of memory obtained from the OS.
	System uint64 `json:"system"`

	// The number of pointer lookups performed by the runtime.
	Lookups uint64 `json:"lookups"`

	// The cumulative count of heap objects allocated.
	// The number of live objects is Mallocs - Frees.
	Mallocs uint64 `json:"mallocs"`

	// The cumulative count of heap objects freed.
	Frees uint64 `json:"frees"`

	// The number of completed GC cycles.
	NumGC uint32 `json:"numGC"`
}

MemoryInfo some memory stats

type Model

type Model struct {
	// The id
	ID uint `json:"id" example:"123"`

	// The creation time
	CreatedAt time.Time `json:"createdAt"`

	// The updated time
	UpdatedAt time.Time `json:"updatedAt"`

	// The deleted time
	DeletedAt *time.Time `json:"deletedAt"`
}

Model for common api objects

type ProjectAPI

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

ProjectAPI provides the api

type ProjectList

type ProjectList struct {
	Total uint             `json:"total"`
	Data  []*model.Project `json:"data"`
}

ProjectList response

type RawAPI

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

RawAPI provides the api

type RawBucket

type RawBucket struct {
	// The Mark for histogram bucket in seconds
	Mark float64 `json:"mark"`

	// The count in the bucket
	Count int `json:"count"`

	// The frequency of results in the bucket as a decimal percentage
	Frequency float64 `json:"frequency"`
}

RawBucket holds histogram data

type RawLatencyDistribution

type RawLatencyDistribution struct {
	// Percentage of the dictribution
	Percentage int `json:"percentage"`

	// Latency of this distributoin
	Latency time.Duration `json:"latency"`
}

RawLatencyDistribution holds latency distribution data

type RawRequest

type RawRequest struct {
	// Date of the test
	Date time.Time `json:"date"`

	// Options for the test
	Options *model.Options `json:"options,omitempty"`

	// Count is the number for calls
	Count uint64 `json:"count"`

	// Total duration of the test
	Total time.Duration `json:"total"`

	// Acerage duration of a call
	Average time.Duration `json:"average"`

	// Fastest call duration
	Fastest time.Duration `json:"fastest"`

	// Slowest call duration
	Slowest time.Duration `json:"slowest"`

	// Rps is the requests per second metric
	Rps float64 `json:"rps"`

	// ErrorDist is the error distribution
	ErrorDist map[string]int `json:"errorDistribution,omitempty"`

	// Status code distribution
	StatusCodeDist map[string]int `json:"statusCodeDistribution,omitempty"`

	// Details of all the calls
	Details []*model.Detail `json:"details"`

	// Latency distribution
	LatencyDistribution []*RawLatencyDistribution `json:"latencyDistribution"`

	// Histogram is the latency histrogram
	Histogram []*RawBucket `json:"histogram"`
}

RawRequest request to the create raw api

func (RawRequest) MarshalJSON

func (rr RawRequest) MarshalJSON() ([]byte, error)

MarshalJSON for RawRequest

func (*RawRequest) UnmarshalJSON

func (rr *RawRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON for RawRequest

type RawResponse

type RawResponse struct {
	// Created project
	Project *model.Project `json:"project"`

	// Created test
	Test *model.Test `json:"test"`

	// Created run
	Run *model.Run `json:"run"`

	// The summary of created details
	Details *DetailsCreated `json:"details"`
}

RawResponse is the response to the raw endpoint

type RunAPI

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

RunAPI provides the api

type RunList

type RunList struct {
	Total uint         `json:"total"`
	Data  []*model.Run `json:"data"`
}

RunList response

type TestAPI

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

TestAPI provides the api

type TestList

type TestList struct {
	Total uint          `json:"total"`
	Data  []*model.Test `json:"data"`
}

TestList response

Jump to

Keyboard shortcuts

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