api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Package api Code generated by swaggo/swag. DO NOT EDIT

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var SwaggerInfo = &swag.Spec{
	Version:          "1.0.0",
	Host:             "localhost:8082",
	BasePath:         "/api/",
	Schemes:          []string{},
	Title:            "cc-metric-store REST API",
	Description:      "API for cc-metric-store",
	InfoInstanceName: "swagger",
	SwaggerTemplate:  docTemplate,
	LeftDelim:        "{{",
	RightDelim:       "}}",
}

SwaggerInfo holds exported Swagger Info so clients can modify it

Functions

func MountRoutes

func MountRoutes(r *http.ServeMux)

func ReceiveNats

func ReceiveNats(conf *config.NatsConfig,
	ms *memorystore.MemoryStore,
	workers int,
	ctx context.Context,
) error

Connect to a nats server and subscribe to "updates". This is a blocking function. handleLine will be called for each line recieved via nats. Send `true` through the done channel for gracefull termination.

func ReceiveRaw

func ReceiveRaw(ctx context.Context,
	listener net.Listener,
	handleLine func(*lineprotocol.Decoder, string) error,
) error

Each connection is handled in it's own goroutine. This is a blocking function.

Types

type ApiMetricData

type ApiMetricData struct {
	Error      *string         `json:"error,omitempty"`
	Data       util.FloatArray `json:"data,omitempty"`
	From       int64           `json:"from"`
	To         int64           `json:"to"`
	Resolution int64           `json:"resolution"`
	Avg        util.Float      `json:"avg"`
	Min        util.Float      `json:"min"`
	Max        util.Float      `json:"max"`
}

func (*ApiMetricData) AddStats

func (data *ApiMetricData) AddStats()

TODO: Optimize this, just like the stats endpoint!

func (*ApiMetricData) PadDataWithNull

func (data *ApiMetricData) PadDataWithNull(ms *memorystore.MemoryStore, from, to int64, metric string)

func (*ApiMetricData) ScaleBy

func (data *ApiMetricData) ScaleBy(f util.Float)

type ApiQuery

type ApiQuery struct {
	Type        *string    `json:"type,omitempty"`
	SubType     *string    `json:"subtype,omitempty"`
	Metric      string     `json:"metric"`
	Hostname    string     `json:"host"`
	Resolution  int64      `json:"resolution"`
	TypeIds     []string   `json:"type-ids,omitempty"`
	SubTypeIds  []string   `json:"subtype-ids,omitempty"`
	ScaleFactor util.Float `json:"scale-by,omitempty"`
	Aggregate   bool       `json:"aggreg"`
}

type ApiQueryRequest

type ApiQueryRequest struct {
	Cluster     string     `json:"cluster"`
	Queries     []ApiQuery `json:"queries"`
	ForAllNodes []string   `json:"for-all-nodes"`
	From        int64      `json:"from"`
	To          int64      `json:"to"`
	WithStats   bool       `json:"with-stats"`
	WithData    bool       `json:"with-data"`
	WithPadding bool       `json:"with-padding"`
}

type ApiQueryResponse

type ApiQueryResponse struct {
	Queries []ApiQuery        `json:"queries,omitempty"`
	Results [][]ApiMetricData `json:"results"`
}

type ErrorResponse

type ErrorResponse struct {
	// Statustext of Errorcode
	Status string `json:"status"`
	Error  string `json:"error"` // Error Message
}

ErrorResponse model

Jump to

Keyboard shortcuts

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