ar

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

* Copyright (c) 2022 GRNET S.A. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an "AS * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language * governing permissions and limitations under the License. * * The views and conclusions contained in the software and * documentation are those of the authors and should not be * interpreted as representing official policies, either expressed * or implied, of GRNET S.A. *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomEndpoint

func CustomEndpoint(filter bson.M) []bson.M

CustomEndpoint query to aggregate a/r results from over a custom periodmongoDB Mongo aggregation pipeline Select all the records that match q Group them by their name, their supergroup, their service, etc... from that group find the average of the uptime, u, downtime Project the result to a better format and do this computation availability = (avgup/(1.00000001 - avgu))*100 reliability = (avgup/((1.00000001 - avgu)-avgd))*100 Sort the results by name->service->supergroup

func CustomGroup

func CustomGroup(filter bson.M) []bson.M

CustomGroup query to aggregate custom results from mongodb

func CustomSuperGroup

func CustomSuperGroup(filter bson.M) []bson.M

CustomSuperGroup function to build the MongoDB aggregation query for monthly calculations

func DailyEndpoint

func DailyEndpoint(filter bson.M) []bson.M

DailyEndpoint query to aggregate daily endpoint a/r results from mongoDB Mongo aggregation pipeline Select all the records that match q Project to select just the first 8 digits of the date YYYYMMDD Sort by name->service->supergroup->date

func DailyGroup

func DailyGroup(filter bson.M) []bson.M

DailyGroup query to aggregate daily results from mongodb

func DailySuperGroup

func DailySuperGroup(filter bson.M) []bson.M

DailySuperGroup function to build the MongoDB aggregation query for daily calculations

func HandleSubrouter

func HandleSubrouter(s *mux.Router, confhandler *respond.ConfHandler)

HandleSubrouter uses the subrouter for a specific calls and creates a tree of sorts handling each route with a different subrouter

func ListEndpointARByID

func ListEndpointARByID(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListEndpointARByID lists endpoints a/r results for a specific resource id

func ListGroupAR

func ListGroupAR(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListGroupAR lists supergroup and group availabilities according to the http request

func MonthlyEndpoint

func MonthlyEndpoint(filter bson.M) []bson.M

MonthlyEndpoint query to aggregate monthly a/r results from mongoDB Mongo aggregation pipeline Select all the records that match q Group them by the first six digits of their date (YYYYMM), their name, their supergroup, their service, etc... from that group find the average of the uptime, u, downtime Project the result to a better format and do this computation availability = (avgup/(1.00000001 - avgu))*100 reliability = (avgup/((1.00000001 - avgu)-avgd))*100 Sort the results by name->service->supergroup->date

func MonthlyGroup

func MonthlyGroup(filter bson.M) []bson.M

MonthlyGroup query to aggregate monthly results from mongodb

func MonthlySuperGroup

func MonthlySuperGroup(filter bson.M) []bson.M

MonthlySuperGroup function to build the MongoDB aggregation query for monthly calculations

func Options

func Options(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Types

type Availability

type Availability struct {
	Date         string `json:"date,omitempty"`
	Availability string `json:"availability"`
	Reliability  string `json:"reliability"`
	Unknown      string `json:"unknown,omitempty"`
	Uptime       string `json:"uptime,omitempty"`
	Downtime     string `json:"downtime,omitempty"`
}

Availability struct for formating json

type Endpoint

type Endpoint struct {
	Name       string            `json:"name"`
	Service    string            `json:"service"`
	Supergroup string            `json:"supergroup"`
	Info       map[string]string `json:"info"`
	Results    []Availability    `json:"results,omitempty"`
}

endpoint holds a/r information about a specific endpoint

type EndpointInterface

type EndpointInterface struct {
	Name         string            `bson:"name"`
	Report       string            `bson:"report"`
	Date         string            `bson:"date"`
	Type         string            `bson:"type"`
	Up           float64           `bson:"up"`
	Down         float64           `bson:"down"`
	Unknown      float64           `bson:"unknown"`
	Availability float64           `bson:"availability"`
	Reliability  float64           `bson:"reliability"`
	Service      string            `bson:"service"`
	SuperGroup   string            `bson:"supergroup"`
	Info         map[string]string `bson:"info"`
}

EndpointInterface used to hold mongodb group information about endpoints

type ErrorResponse

type ErrorResponse respond.ErrorResponse

ErrorResponse shortcut to respond.ErrorResponse

type Group

type Group struct {
	Name         string         `json:"name"`
	Type         string         `json:"type"`
	Availability []Availability `json:"results"`
}

Group struct for formating json

type GroupInterface

type GroupInterface struct {
	Name         string  `bson:"name"`
	Report       string  `bson:"report"`
	Date         string  `bson:"date"`
	Type         string  `bson:"type"`
	Up           float64 `bson:"up"`
	Down         float64 `bson:"down"`
	Unknown      float64 `bson:"unknown"`
	Availability float64 `bson:"availability"`
	Reliability  float64 `bson:"reliability"`
	Weights      string  `bson:"weights"`
	SuperGroup   string  `bson:"supergroup"`
}

GroupInterface used to hold mongodb group information such as SITES, SERVICEGROUPS etc

type GroupResultQuery

type GroupResultQuery struct {
	Group string `bson:"supergroup"`
	// contains filtered or unexported fields
}

func (*GroupResultQuery) Validate

func (query *GroupResultQuery) Validate() []ErrorResponse

type SuperGroup

type SuperGroup struct {
	Name    string         `json:"name"`
	Type    string         `json:"type"`
	Results []Availability `json:"results,omitempty"`
	Groups  []*Group       `json:"groups,omitempty"`
}

SuperGroup struct for formating json

type SuperGroupInterface

type SuperGroupInterface struct {
	Report       string  `bson:"report"`
	Date         string  `bson:"date"`
	Type         string  `bson:"type"`
	Up           float64 `bson:"uptime"`
	Down         float64 `bson:"downtime"`
	Unknown      float64 `bson:"unknown"`
	Availability float64 `bson:"availability"`
	Reliability  float64 `bson:"reliability"`
	Weights      string  `bson:"weight"`
	SuperGroup   string  `bson:"supergroup"`
}

GroupInterface used to hold mongodb supergroup information such as NGIs, PROJETS etc

Jump to

Keyboard shortcuts

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