api

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package api provides the REST API for cc-metric-store.

@title cc-metric-store REST API @version 1.0.0 @description API for cc-metric-store

@contact.name ClusterCockpit Project @contact.url https://clustercockpit.org @contact.email support@clustercockpit.org

@license.name MIT License @license.url https://opensource.org/licenses/MIT

@host localhost:8082 @basePath /api/

@securityDefinitions.apikey ApiKeyAuth @in header @name X-Auth-Token

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

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)

Types

type APIMetricData added in v1.5.0

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

func (*APIMetricData) AddStats added in v1.5.0

func (data *APIMetricData) AddStats()

TODO: Optimize this, just like the stats endpoint!

func (*APIMetricData) PadDataWithNull added in v1.5.0

func (data *APIMetricData) PadDataWithNull(ms *metricstore.MemoryStore, from, to int64, metric string)

func (*APIMetricData) ScaleBy added in v1.5.0

func (data *APIMetricData) ScaleBy(f schema.Float)

type APIQuery added in v1.5.0

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 schema.Float `json:"scale-by,omitempty" swaggertype:"number"`
	Aggregate   bool         `json:"aggreg"`
}

type APIQueryRequest added in v1.5.0

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 added in v1.5.0

type APIQueryResponse struct {
	Queries []APIQuery        `json:"queries,omitempty"`
	Results [][]APIMetricData `json:"results"`
}

type BackendNodeProvider added in v1.5.0

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

BackendNodeProvider implements metricstore.NodeProvider by querying the cc-backend /api/jobs/used_nodes endpoint.

func NewBackendNodeProvider added in v1.5.0

func NewBackendNodeProvider(backendURL string) *BackendNodeProvider

NewBackendNodeProvider creates a new BackendNodeProvider that queries the given cc-backend URL for used nodes information.

func (*BackendNodeProvider) GetUsedNodes added in v1.5.0

func (p *BackendNodeProvider) GetUsedNodes(ts int64) (map[string][]string, error)

GetUsedNodes returns a map of cluster names to sorted lists of unique hostnames that are currently in use by jobs that started before the given timestamp.

type DefaultAPIResponse added in v1.5.0

type DefaultAPIResponse struct {
	Message string `json:"msg"`
}

DefaultAPIResponse model

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