util

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareMetricsResponse

func PrepareMetricsResponse(
	batches int, metrics map[string][]checker.Metric,
) httpserver.PageMetricsResponse

PrepareMetricsResponse creates a page metrics response for each of the check after serializing the metrics.

func SerializeMetrics

func SerializeMetrics(
	batches int, metrics []checker.Metric,
) (serialized []httpserver.MetricResponse, uptime int)

SerializeMetrics breaks the metrics into multiple batches and retains one metric from each batch.

The following rules are applied to each batch:

  • Failed metric is prioritized over successful.
  • Metric with highest latency is considered.
  • If number of batches are more than number of metrics, this is probably recent addition of check. In this case, The first metric should be appended at the front of list.
  • The first (latest) metric is remains the same.

Minimum number of batches accepted is 2 since only 1 would mean just getting the latest metric which doesn't reflect any history.

Types

This section is empty.

Directories

Path Synopsis
Package appcontext implements the app context.
Package appcontext implements the app context.
Package controller implements controller and manager.
Package controller implements controller and manager.
Package httpserver implements some utilities for HTTP servers.
Package httpserver implements some utilities for HTTP servers.
Package jwt implements the JavaScript Web Token that can be used for authentication of users.
Package jwt implements the JavaScript Web Token that can be used for authentication of users.
Package static includes the blob for generated files that lie in `static` directory of the project and other utilities to access them.
Package static includes the blob for generated files that lie in `static` directory of the project and other utilities to access them.

Jump to

Keyboard shortcuts

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