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 ¶
- func CustomEndpoint(filter bson.M) []bson.M
- func CustomGroup(filter bson.M) []bson.M
- func CustomSuperGroup(filter bson.M) []bson.M
- func DailyEndpoint(filter bson.M) []bson.M
- func DailyGroup(filter bson.M) []bson.M
- func DailySuperGroup(filter bson.M) []bson.M
- func HandleSubrouter(s *mux.Router, confhandler *respond.ConfHandler)
- func ListEndpointARByID(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func ListGroupAR(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func MonthlyEndpoint(filter bson.M) []bson.M
- func MonthlyGroup(filter bson.M) []bson.M
- func MonthlySuperGroup(filter bson.M) []bson.M
- func Options(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- type Availability
- type Endpoint
- type EndpointInterface
- type ErrorResponse
- type Group
- type GroupInterface
- type GroupResultQuery
- type SuperGroup
- type SuperGroupInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomEndpoint ¶
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 ¶
CustomGroup query to aggregate custom results from mongodb
func CustomSuperGroup ¶
CustomSuperGroup function to build the MongoDB aggregation query for monthly calculations
func DailyEndpoint ¶
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 ¶
DailyGroup query to aggregate daily results from mongodb
func DailySuperGroup ¶
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 ¶
ListEndpointARByID lists endpoints a/r results for a specific resource id
func ListGroupAR ¶
ListGroupAR lists supergroup and group availabilities according to the http request
func MonthlyEndpoint ¶
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 ¶
MonthlyGroup query to aggregate monthly results from mongodb
func MonthlySuperGroup ¶
MonthlySuperGroup function to build the MongoDB aggregation query for monthly calculations
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