utils

package
v0.0.0-...-974df98 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: AGPL-3.0 Imports: 24 Imported by: 41

Documentation

Overview

https://pkg.go.dev/container/heap#example-package-PriorityQueue

Index

Constants

View Source
const (
	ContentJson = "application/json; charset=utf-8"
)
View Source
const DAY_IN_MS = 86400_000
View Source
const HOUR_IN_MS = 3600_000
View Source
const MAX_HT_BUCKETS = 90
View Source
const MIN_IN_MS = 60_000
View Source
const TEN_YEARS_IN_SECS = 315_360_000
View Source
const UINT16_MAX = 65_535
View Source
const UINT32_MAX = 4_294_967_295
View Source
const UINT8_MAX = 255

Variables

View Source
var HT_STEPS = []uint64{60_000,
	300_000,
	600_000,
	1800_000,
	3600_000,
	10800_000,
	43200_000,
	86400_000,
	604800_000,
	2592000_000,
	7776000_000,
	31536000_000,
	315360000_000,
}
View Source
var MAX_SHARDS = int(1)
View Source
var UUID_GENERATOR *fastuuid.Generator

Functions

func BinarySearchUint16

func BinarySearchUint16(needle uint16, haystack []uint16) bool

func BoolToBytesLittleEndian

func BoolToBytesLittleEndian(b bool) []byte

func BytesToBoolLittleEndian

func BytesToBoolLittleEndian(bytes []byte) bool

func BytesToFloat64LittleEndian

func BytesToFloat64LittleEndian(bytes []byte) float64

func BytesToInt16LittleEndian

func BytesToInt16LittleEndian(bytes []byte) int16

func BytesToInt32LittleEndian

func BytesToInt32LittleEndian(bytes []byte) int32

func BytesToInt64LittleEndian

func BytesToInt64LittleEndian(bytes []byte) int64

func BytesToUint16LittleEndian

func BytesToUint16LittleEndian(bytes []byte) uint16

func BytesToUint32LittleEndian

func BytesToUint32LittleEndian(bytes []byte) uint32

func BytesToUint64LittleEndian

func BytesToUint64LittleEndian(bytes []byte) uint64

func CalculateStandardVariance

func CalculateStandardVariance(values []float64) float64

func ConvertTimestampToMillis

func ConvertTimestampToMillis(value string) (uint64, error)

func CreateStreamId

func CreateStreamId(indexName string, orgId uint64) string

func CreateStreamIdForMetrics

func CreateStreamIdForMetrics(mname *string) string

func CreateUniqueIndentifier

func CreateUniqueIndentifier() string

func DecodeGOB

func DecodeGOB(raw []byte, node any) error

func EncodeGOB

func EncodeGOB(node any) ([]byte, error)

func EpochIsSeconds

func EpochIsSeconds(epoch uint64) bool

func EscapeQuotes

func EscapeQuotes(s string) string

Converts a string like `This has "quotes"` to `This has \"quotes\"`

func ExtractBearerToken

func ExtractBearerToken(ctx *fasthttp.RequestCtx) (string, error)

func ExtractParamAsString

func ExtractParamAsString(_interface interface{}) string

func ExtractSeriesOfJsonObjects

func ExtractSeriesOfJsonObjects(body []byte) ([]map[string]interface{}, error)

This takes a group of JSON objects (not inside a JSON array) and splits them into individual JSON objects.

func ExtractTimeStamp

func ExtractTimeStamp(raw []byte, timestampKey *string) uint64

This function will extract the timestamp from the raw body. This will assume the timestamp key exists at the root level

func Flatten

func Flatten(m map[string]interface{}) map[string]interface{}

Flatten takes a map and returns a new one where nested maps are replaced by dot-delimited keys.

func FlattenSingleValue

func FlattenSingleValue(key string, m map[string]interface{}, child interface{})

func Float64ToBytesLittleEndian

func Float64ToBytesLittleEndian(val float64) []byte

func GetAllNodesInfo

func GetAllNodesInfo(hostname string, esVersion string) map[string]*NodeInfo

func GetCurrentTimeInMs

func GetCurrentTimeInMs() uint64

func GetDecodedBody

func GetDecodedBody(ctx *fasthttp.RequestCtx) ([]byte, error)

func GetMetricsTimeRange

func GetMetricsTimeRange(startEpoch Epoch, endEpoch Epoch, now time.Time) (*dtypeutils.MetricsTimeRange, error)

func GetServerStartTime

func GetServerStartTime() time.Time

func GetSpecificIdentifier

func GetSpecificIdentifier() (string, error)

Use the MAC address as a computer-specific identifier. If it is not available, use the hostname instead.

func HashString

func HashString(x string) string

func Int16ToBytesLittleEndian

func Int16ToBytesLittleEndian(signedval int16) []byte

func Int32ToBytesLittleEndian

func Int32ToBytesLittleEndian(signedval int32) []byte

func Int64ToBytesLittleEndian

func Int64ToBytesLittleEndian(signedval int64) []byte

func IsSubWordPresent

func IsSubWordPresent(haystack []byte, needle []byte) bool

we are assumung that needleLen and haystackLen are both non zero

func IsTimeInMilli

func IsTimeInMilli(tval uint64) bool

func IsTimeInNano

func IsTimeInNano(tval uint64) bool

* * Check if the time value is in nano seconds * Time in Seconds: 1e9 * Time in Milli Seconds: 1e12 * Time in Micro Seconds: 1e15 * Time in Nano Seconds: 1e18

func Max

func Max(x, y uint64) uint64

func MaxInt64

func MaxInt64(x, y int64) int64

func MergeMaps

func MergeMaps[K comparable, V any](map1, map2 map[K]V) map[K]V

If there are duplicate keys, values from the second map will overwrite those from the first map.

func Min

func Min(x, y uint64) uint64

func MinInt64

func MinInt64(x, y int64) int64

func NearestThousandFormat

func NearestThousandFormat(num float64) string

func ParseAlphaNumTime

func ParseAlphaNumTime(nowTs uint64, inp string, defValue uint64) uint64

Supports "now-[Num][Unit]" Num ==> any positive integer Unit ==> m(minutes), h(hours), d(days)

func ParseTimeForPromQL

func ParseTimeForPromQL(timeParam string) (uint32, error)

Helper function that parses a time parameter for use in PromQL. The time parameter can be in either epoch time format or RFC3339 format. If the time parameter is an empty string, the function returns an error. The function returns the parsed time as a uint32 Unix timestamp and an error if the parsing fails.

func RandomStringWithCharset

func RandomStringWithCharset(length int) string

func ResizeSlice

func ResizeSlice[T any](slice []T, newLength int) []T

func SanitizeHistogramInterval

func SanitizeHistogramInterval(startEpochMs uint64, endEpochMs uint64,
	intervalMs uint64) (uint64, error)

Returns the size for histogram IntervalMillis.

func SearchStr

func SearchStr(needle string, haystack []string) bool

todo write a optimized version of this and replace all invocations of this func

func SelectIndicesFromSlice

func SelectIndicesFromSlice(slice []string, indices []int) []string

func SelectMatchingStringsWithWildcard

func SelectMatchingStringsWithWildcard(s string, slice []string) []string

Return all strings in `slice` that match `s`, which may have wildcards.

func SendError

func SendError(ctx *fasthttp.RequestCtx, messageToUser string, extraMessageToLog string, err error)

func SendInternalError

func SendInternalError(ctx *fasthttp.RequestCtx, messageToUser string, extraMessageToLog string, err error)

func SendUnauthorizedError

func SendUnauthorizedError(ctx *fasthttp.RequestCtx, messageToUser string, extraMessageToLog string, err error)

func SetBadMsg

func SetBadMsg(ctx *fasthttp.RequestCtx, msg string)

func SetServerStartTime

func SetServerStartTime(startTime time.Time)

func SliceContainsInt

func SliceContainsInt(slice []int, x int) bool

func SliceContainsString

func SliceContainsString(slice []string, s string) bool

func ToFixed

func ToFixed(num float64, precision int) float64

Function to truncate float64 to a given precision

func UInt64ToStringBytes

func UInt64ToStringBytes(val uint64) string

func Uint16ToBytesLittleEndian

func Uint16ToBytesLittleEndian(val uint16) []byte

func Uint32ToBytesLittleEndian

func Uint32ToBytesLittleEndian(val uint32) []byte

func Uint64ToBytesLittleEndian

func Uint64ToBytesLittleEndian(val uint64) []byte

func UnsafeByteSliceToString

func UnsafeByteSliceToString(haystack []byte) string

returns string using unsafe. This is zero-copy and uses unsafe

func VerifyBasicAuth

func VerifyBasicAuth(ctx *fasthttp.RequestCtx, usernameHash uint64, passwordHash uint64) bool

Reads the basic authorization from the request to extract the username and password. Then hashes the username and password and compares with the expected hash values. Returns true if the hashes match. Returns false if the hashes do not match or if basic authentication credentials are not provided in the request. The provided usernameHash and passwordHash fields should be hashed with the xxhash.Sum64 algorithm. Basic authentication is defined at https://www.rfc-editor.org/rfc/rfc2617#section-2

func WriteJsonResponse

func WriteJsonResponse(ctx *fasthttp.RequestCtx, httpResp interface{})

func WriteResponse

func WriteResponse(ctx *fasthttp.RequestCtx, httpResp HttpServerResponse)

Types

type AllIndicesInfoResponse

type AllIndicesInfoResponse []IndexInfo

type AllNodesInfoResponse

type AllNodesInfoResponse struct {
	Nodes map[string]*NodeInfo `json:"nodes"`
}

type AllResponseInfo

type AllResponseInfo struct {
	Primaries map[string]interface{} `json:"primaries"`
	Total     map[string]interface{} `json:"total"`
}

func NewAllResponseInfo

func NewAllResponseInfo() *AllResponseInfo

type AllSavedQueries

type AllSavedQueries map[string]map[string]interface{}

type AutoCompleteDataInfo

type AutoCompleteDataInfo struct {
	ColumnNames      []string `json:"colNames"`
	MeasureFunctions []string `json:"measureFunctions"`
}

func NewAutoCompleteDataInfo

func NewAutoCompleteDataInfo(columnNames []string, measureFunctions []string) *AutoCompleteDataInfo

type BucketWrapper

type BucketWrapper struct {
	Bucket []map[string]interface{} `json:"buckets"`
}

type BulkErrorResponse

type BulkErrorResponse struct {
	ErrorResponse BulkErrorResponseInfo `json:"error"`
}

type BulkErrorResponseInfo

type BulkErrorResponseInfo struct {
	Reason string `json:"reason"`
	Type   string `json:"type"`
}

func NewBulkErrorResponseInfo

func NewBulkErrorResponseInfo(reason string, typ string) *BulkErrorResponseInfo

type ClusterHealthResponseInfo

type ClusterHealthResponseInfo struct {
	ClusterName          string  `json:"cluster_name"`
	Status               string  `json:"status"`
	TimedOut             bool    `json:"timed_out"`
	NumberOfNodes        int     `json:"number_of_nodes"`
	NumberOfDataNodes    int     `json:"number_of_data_nodes"`
	ActivePrimaryShards  int     `json:"active_primary_shards"`
	ActiveShards         int     `json:"active_shards"`
	RelocatingShards     int     `json:"relocating_shards"`
	InitiliazeShards     int     `json:"initializing_shards"`
	UnassignedShards     int     `json:"unassigned_shards"`
	DelayedShards        int     `json:"delayed_unassigned_shards"`
	NumberOfPendingTasks int     `json:"number_of_pending_tasks"`
	NumberInFlightFetch  int     `json:"number_of_in_flight_fetch"`
	TaskMaxWaiting       int     `json:"task_max_waiting_in_queue_millis"`
	ActiveShardsPercent  float64 `json:"active_shards_percent_as_number"`
}

func NewClusterHealthResponseInfo

func NewClusterHealthResponseInfo() *ClusterHealthResponseInfo

type ClusterNode

type ClusterNode struct {
	NodeIP     string         `json:"NodeIp"`
	RaftPort   string         `json:"RaftPort"`
	GRPCPort   string         `json:"GRPCPort"`
	NodeTypes  []NodeTypeEnum `json:"NodeTypes"`
	NodeStatus string         `json:"NodeStatus"`
}

type ClusterNodeStr

type ClusterNodeStr struct {
	NodeIP     string   `json:"NodeIp"`
	RaftPort   string   `json:"RaftPort"`
	GRPCPort   string   `json:"GRPCPort"`
	NodeTypes  []string `json:"NodeTypes"`
	NodeStatus string   `json:"NodeStatus"`
}

type ClusterStateBlocksInfo

type ClusterStateBlocksInfo struct {
	ClusterName string                 `json:"cluster_name"`
	ClusterUUID string                 `json:"cluster_uuid"`
	Blocks      map[string]interface{} `json:"blocks"`
}

func NewClusterStateBlocksInfo

func NewClusterStateBlocksInfo(uuidVal string) *ClusterStateBlocksInfo

type ClusterStateResponseInfo

type ClusterStateResponseInfo struct {
	ClusterName  string                 `json:"cluster_name"`
	ClusterUUID  string                 `json:"cluster_uuid"`
	MasterNode   string                 `json:"master_node"`
	Blocks       map[string]interface{} `json:"blocks"`
	RoutingTable map[string]interface{} `json:"routing_table"`
}

func NewClusterStateResponseInfo

func NewClusterStateResponseInfo(uuidVal string, indicesResponse map[string]interface{}) *ClusterStateResponseInfo

type ClusterStatsResponseInfo

type ClusterStatsResponseInfo struct {
	IngestionStats map[string]interface{}            `json:"ingestionStats"`
	QueryStats     map[string]interface{}            `json:"queryStats"`
	MetricsStats   map[string]interface{}            `json:"metricsStats"`
	IndexStats     []ResultPerIndex                  `json:"indexStats"`
	ChartStats     map[string]map[string]interface{} `json:"chartStats"`
}

type DeleteIndexErrorResponseInfo

type DeleteIndexErrorResponseInfo struct {
	Type         string `json:"type"`
	Reason       string `json:"reason"`
	ResourceType string `json:"resource.type"`
	ResourceId   string `json:"resource.id"`
	IndexUUID    string `json:"index.uuid"`
	Index        string `json:"index"`
}

func NewDeleteIndexErrorResponseInfo

func NewDeleteIndexErrorResponseInfo(indexName string) *DeleteIndexErrorResponseInfo

type DocIndexedResponse

type DocIndexedResponse struct {
	Index          string                        `json:"_index"`
	Type           string                        `json:"_type"`
	Id             string                        `json:"_id"`
	Version        int                           `json:"_version"`
	SequenceNumber int                           `json:"_seq_no"`
	Result         string                        `json:"result"`
	PrimaryTerm    int                           `json:"_primary_term"`
	Shards         map[string]interface{}        `json:"_shards"`
	Get            DocIndexedResponseSubFieldGet `json:"get"`
}

type DocIndexedResponseSubFieldGet

type DocIndexedResponseSubFieldGet struct {
	SequenceNumber int                    `json:"_seq_no"`
	PrimaryTerm    int                    `json:"_primary_term"`
	Found          bool                   `json:"found"`
	Source         map[string]interface{} `json:"_source"`
}

type DocsResponse

type DocsResponse struct {
	Count   int `json:"count"`
	Deleted int `json:"deleted"`
}

func NewDocsResponse

func NewDocsResponse(evenCount int) *DocsResponse

type Epoch

type Epoch struct {
	IntValue    uint64
	StringValue string
	IsString    bool
	IsInt       bool
}

Should either be a unix epoch in seconds or a string like "now-1h".

func (*Epoch) UnixSeconds

func (e *Epoch) UnixSeconds(now time.Time) (uint64, error)

func (*Epoch) UnmarshalJSON

func (e *Epoch) UnmarshalJSON(rawJson []byte) error

Implement https://pkg.go.dev/encoding/json#Unmarshaler

type GetMasterResponse

type GetMasterResponse struct {
	Id   string `json:"id"`
	Host string `json:"host"`
	IP   string `json:"ip"`
	Node string `json:"node"`
}

func NewGetMasterResponse

func NewGetMasterResponse(id string, host string, node string) *GetMasterResponse

type GreetResponse

type GreetResponse struct {
	Name        string       `json:"name"`
	ClusterName string       `json:"cluster_name"`
	ClusterUUID string       `json:"cluster_uuid"`
	Version     GreetVersion `json:"version"`
}

func NewGreetResponse

func NewGreetResponse(host string, uuidVal string, esVersion string) GreetResponse

type GreetVersion

type GreetVersion struct {
	Number                           string `json:"number"`
	BuildFlavour                     string `json:"build_flavor"`
	BuildType                        string `json:"build_type"`
	BuildDate                        string `json:"build_date"`
	BuildHash                        string `json:"build_hash"`
	BuildSnapshot                    bool   `json:"build_snapshot"`
	LuceneVersion                    string `json:"lucene_version"`
	MinimumWireCompatibilityVersion  string `json:"minimum_wire_compatibility_version"`
	MinimumIndexCompatibilityVersion string `json:"minimum_index_compatibility_version"`
}

func NewGreetVersion

func NewGreetVersion(esVersion string) GreetVersion

type Hits

type Hits struct {
	Index   string                 `json:"_index"`
	Type    string                 `json:"_type"`
	Id      string                 `json:"_id"`
	Version int                    `json:"_version"`
	Score   int                    `json:"_score"`
	Source  map[string]interface{} `json:"_source"`
}

type HitsCount

type HitsCount struct {
	Value    uint64 `json:"value"`
	Relation string `json:"relation"`
}

type HttpServerESResponse

type HttpServerESResponse struct {
	Hits      []Hits      `json:"hits"`
	Max_score int         `json:"max_score"`
	Total     interface{} `json:"total"`
}

func (*HttpServerESResponse) GetHits

func (eo *HttpServerESResponse) GetHits() uint64

type HttpServerESResponseOuter

type HttpServerESResponseOuter struct {
	Hits       HttpServerESResponse     `json:"hits"`
	Aggs       map[string]BucketWrapper `json:"aggregations"`
	Took       int64                    `json:"took"`
	Timed_out  bool                     `json:"timed_out"`
	StatusCode int                      `json:"status"`
	Shards     map[string]interface{}   `json:"_shards"`
}

type HttpServerESResponseScroll

type HttpServerESResponseScroll struct {
	Hits       HttpServerESResponse     `json:"hits"`
	Aggs       map[string]BucketWrapper `json:"aggregations"`
	Took       int64                    `json:"took"`
	Timed_out  bool                     `json:"timed_out"`
	StatusCode int                      `json:"status"`
	Scroll_id  string                   `json:"_scroll_id"`
}

type HttpServerResponse

type HttpServerResponse struct {
	Message    string `json:"message"`
	StatusCode int    `json:"status"`
}

type HttpServerSettingsResponse

type HttpServerSettingsResponse struct {
	Persistent map[string]string `json:"persistent"`
	Transient  map[string]string `json:"transient"`
}

type IndexInfo

type IndexInfo struct {
	Name            string `json:"index"`
	Health          string `json:"health"`
	Status          string `json:"status"`
	UUID            string `json:"uuid"`
	Rep             int    `json:"rep"`
	Pri             uint64 `json:"pri"`
	DocsDeleted     int    `json:"docs.deleted"`
	DocsCount       int    `json:"docs.count"`
	StoreSize       uint64 `json:"store.size"`
	OnDiskStoreSize uint64 `json:"store.onDiskBytes"`
	PriStoreSize    uint64 `json:"pri.store.size"`
}

func CreateIndexInfo

func CreateIndexInfo(name string, uuid string, docsCount int, storeSize uint64, onDiskBytesCount uint64) *IndexInfo

type IndexNameInfoResponse

type IndexNameInfoResponse struct {
	Aliases  map[string]bool        `json:"aliases"`
	Mappings map[string]interface{} `json:"mappings"`
	Settings SettingsInfo           `json:"settings"`
}

type Item

type Item struct {
	Value    string  // The value of the item; arbitrary.
	Priority float64 // The priority of the item in the queue.
	// The index is needed by update and is maintained by the heap.Interface methods.
	Index int // The index of the item in the heap.
}

Max Heap An Item is something we manage in a priority queue.

type LoadAverageResponseInfo

type LoadAverageResponseInfo struct {
	LoadResponse float64 `json:"1m"`
}

func NewLoadAverageResponseInfo

func NewLoadAverageResponseInfo(loadAverage float64) *LoadAverageResponseInfo

type MemResponseInfo

type MemResponseInfo struct {
	Total        string `json:"total"`
	TotalInBytes uint64 `json:"total_in_bytes"`
	Free         string `json:"free"`
	FreeInBytes  uint64 `json:"free_in_bytes"`
	Used         string `json:"used"`
	UsedInBytes  uint64 `json:"used_in_bytes"`
	FreePercent  uint64 `json:"free_percent"`
	UsedPercent  uint64 `json:"used_percent"`
}

func NewMemResponseInfo

func NewMemResponseInfo(total string, totalInBytes uint64, free string, freeInBytes uint64, used string, usedInBytes uint64, freePercent float64, usedPercent float64) *MemResponseInfo

type MemberInfo

type MemberInfo struct {
	ClusterId      uint64                     `json:"ClusterId"`
	ConfigChangeId uint64                     `json:"ConfigChangeId"`
	Nodes          map[uint64]*ClusterNodeStr `json:"ClusterNode"`
	Observers      map[uint64]string          `json:"Observers"`
	Witnesses      map[uint64]string          `json:"Witnesses"`
	Removed        map[uint64]struct{}        `json:"Removed"`
	LeaderId       uint64                     `json:"LeaderId"`
	LeaderValid    bool                       `json:"LeaderValid"`
}

type MetricStatsResponse

type MetricStatsResponse struct {
	Series      []string     `json:"series"`
	Timestamps  []uint32     `json:"timestamps"`
	Values      [][]*float64 `json:"values"`
	StartTime   uint32       `json:"startTime"`
	IntervalSec uint32       `json:"intervalSec"`
}

type MetricsStatsResponseInfo

type MetricsStatsResponseInfo struct {
	AggStats map[string]map[string]interface{} `json:"aggStats"`
}

type MgetESResponse

type MgetESResponse struct {
	Docs []SingleESResponse `json:"docs"`
}

type MultiNodesInfoResponse

type MultiNodesInfoResponse []*MemberInfo

type MultiSearchESResponse

type MultiSearchESResponse struct {
	Results []HttpServerESResponseOuter `json:"responses"`
}

type NodeInfo

type NodeInfo struct {
	IP                         string `json:"ip"`
	BuildHash                  string `json:"build_hash"`
	TotalIndexingBuffer        int64  `json:"total_indexing_buffer"`
	TotalIndexingBufferInBytes string `json:"total_indexing_buffer_in_bytes"`
	Version                    string `json:"version"`
	HttpPublishAddress         string `json:"http.publish_address"`
}

func NewNodeInfo

func NewNodeInfo(esVersion string) *NodeInfo

type NodeStatusEnum

type NodeStatusEnum int
const (
	GREEN NodeStatusEnum = iota
	YELLOW
	RED
	UNKNOWN_NODESTATUS
)

func (NodeStatusEnum) String

func (s NodeStatusEnum) String() string

type NodeTypeEnum

type NodeTypeEnum int
const (
	INGEST NodeTypeEnum = iota
	QUERY
	SEED
	SEGREADER
	METAREADER
)

func (NodeTypeEnum) String

func (s NodeTypeEnum) String() string

type NodesAllResponseInfo

type NodesAllResponseInfo struct {
	Name             string              `json:"name"`
	TransportAddress string              `json:"transport_address"`
	HostName         string              `json:"host"`
	IP               string              `json:"ip"`
	Version          string              `json:"version"`
	BuildFlavor      string              `json:"build_flavor"`
	BuildType        string              `json:"build_type"`
	BuildHash        string              `json:"build_hash"`
	OSResponse       NodesOSResponseInfo `json:"os"`
}

func NewNodesAllResponseInfo

func NewNodesAllResponseInfo(host string, addressPort string, version string, osResponse NodesOSResponseInfo) *NodesAllResponseInfo

type NodesOSResponseInfo

type NodesOSResponseInfo struct {
	RefreshInterval     string `json:"refresh_interval"`
	RefreshIntervalInMS int    `json:"refresh_interval_in_millis"`
	Name                string `json:"name"`
	PrettyName          string `json:"pretty_name"`
	Arch                string `json:"arch"`
	Version             string `json:"version"`
	AvailableProcessors int    `json:"available_processors"`
	AllocatedProcessors int    `json:"allocated_processors"`
}

func NewNodesOSResponseInfo

func NewNodesOSResponseInfo() *NodesOSResponseInfo

type NodesResponseInfo

type NodesResponseInfo struct {
	Timestamp        int64                  `json:"timestamp"`
	Name             string                 `json:"name"`
	TransportAddress string                 `json:"transport_address"`
	HostName         string                 `json:"host"`
	IP               string                 `json:"ip"`
	OSResponse       map[string]interface{} `json:"os"`
	JVMResponse      map[string]interface{} `json:"jvm"`
	FSResponse       map[string]interface{} `json:"fs"`
	ProcessResponse  map[string]interface{} `json:"process"`
}

func NewNodesResponseInfo

func NewNodesResponseInfo(timestamp int64, host string, addressPort string, ipAddress string, osResponse map[string]interface{}, jvmResponse map[string]interface{}, fsResponse map[string]interface{}, processResponse map[string]interface{}) *NodesResponseInfo

type NodesStatsIdInfo

type NodesStatsIdInfo struct {
	Timestamp        int64  `json:"timestamp"`
	Name             string `json:"name"`
	TransportAddress string `json:"transport_address"`
	Host             string `json:"host"`
	IP               string `json:"ip"`
}

func NewNodesStatsIdInfo

func NewNodesStatsIdInfo(timestamp int64, hostname string, addressPort string, ipAddress string) *NodesStatsIdInfo

type NodesStatsIngestInfo

type NodesStatsIngestInfo struct {
	Name             string                 `json:"name"`
	TransportAddress string                 `json:"transport_address"`
	Host             string                 `json:"host"`
	IP               string                 `json:"ip"`
	Version          string                 `json:"version"`
	BuildFlavour     string                 `json:"build_flavor"`
	BuildType        string                 `json:"build_type"`
	BuildHash        string                 `json:"build_hash"`
	Roles            []string               `json:"roles"`
	Ingest           map[string]interface{} `json:"ingest"`
}

func NewNodesStatsIngestInfo

func NewNodesStatsIngestInfo(hostname string, addressPort string,
	ipAddress string, version string, ingestFeats map[string]interface{}) *NodesStatsIngestInfo

type NodesStatsMemResponse

type NodesStatsMemResponse struct {
	HeapCommitted           string `json:"heap_committed"`
	HeapCommittedInBytes    uint64 `json:"heap_committed_in_bytes"`
	HeapMax                 string `json:"heap_max"`
	HeapMaxInBytes          uint64 `json:"heap_max_in_bytes"`
	HeapUsed                string `json:"heap_used"`
	HeapUsedInBytes         uint64 `json:"heap_used_in_bytes"`
	HeapUsedPercent         int    `json:"heap_used_percent"`
	NonHeapCommitted        string `json:"non_heap_committed"`
	NonHeapCommittedInBytes int    `json:"non_heap_committed_in_bytes"`
	NonHeapUsed             string `json:"non_heap_used"`
	NonHeapUsedInBytes      int    `json:"non_heap_used_bytes"`
}

func NewNodesStatsMemResponse

func NewNodesStatsMemResponse(heapcommitted string, heapCommittedBytes uint64, heapMax string, heapMaxBytes uint64, heapUsed string, heapUsedBytes uint64) *NodesStatsMemResponse

type NodesStatsResponseInfo

type NodesStatsResponseInfo struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

func NewNodesStatsResponseInfo

func NewNodesStatsResponseInfo(total int, successful int, failed int) *NodesStatsResponseInfo

type NodesTransportResponseInfo

type NodesTransportResponseInfo struct {
	Name             string `json:"name"`
	TransportAddress string `json:"transport_address"`
	HostName         string `json:"host"`
	IP               string `json:"ip"`
	Version          string `json:"version"`
	BuildFlavor      string `json:"build_flavor"`
	BuildType        string `json:"build_type"`
	BuildHash        string `json:"build_hash"`
}

func NewNodesTransportResponseInfo

func NewNodesTransportResponseInfo(host string, addressPort string, version string) *NodesTransportResponseInfo

type PriorityQueue

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() any

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type ProcessCpuResponse

type ProcessCpuResponse struct {
	Percent       int    `json:"percent"`
	Total         string `json:"total"`
	TotalInMillis uint64 `json:"total_in_millis"`
}

func NewProcessCpuResponse

func NewProcessCpuResponse(percent int) *ProcessCpuResponse

type ResultPerIndex

type ResultPerIndex map[string]map[string]interface{} // maps index name to index stats

type SettingsIndexInfo

type SettingsIndexInfo struct {
	NumberOfShards   int    `json:"number_of_shards"`
	NumberOfReplicas int    `json:"number_of_replicas"`
	ProvidedName     string `json:"provided_name"`
}

func NewSettingsIndexInfo

func NewSettingsIndexInfo(providedName string) *SettingsIndexInfo

type SettingsInfo

type SettingsInfo struct {
	Index SettingsIndexInfo `json:"index"`
}

type ShardsItemsResponse

type ShardsItemsResponse struct {
	State          string                 `json:"state"`
	Primary        bool                   `json:"primary"`
	Node           string                 `json:"node"`
	RelocatingNode *string                `json:"relocating_node"`
	Shard          int                    `json:"shard"`
	Index          string                 `json:"index"`
	AllocationId   map[string]interface{} `json:"allocation_id"`
}

func NewShardsItemsResponse

func NewShardsItemsResponse(indexName string, allocationResponse map[string]interface{}) *ShardsItemsResponse

type SingleESResponse

type SingleESResponse struct {
	Index          string                 `json:"_index"`
	Type           string                 `json:"_type"`
	Id             string                 `json:"_id"`
	Version        int                    `json:"_version"`
	SequenceNumber int                    `json:"_seq_no"`
	Source         map[string]interface{} `json:"_source"`
	Found          bool                   `json:"found"`
	PrimaryTerm    int                    `json:"_primary_term"`
}

func NewSingleESResponse

func NewSingleESResponse() *SingleESResponse

type StatResponse

type StatResponse struct {
	Value interface{} `json:"value"`
}

type StoreResponse

type StoreResponse struct {
	SizeInBytes     uint64 `json:"size_in_bytes"`
	ReservedInBytes int    `json:"reservec_in_bytes"`
}

func NewStoreResponse

func NewStoreResponse(bytesReceivedCount uint64) *StoreResponse

type SwapResponseInfo

type SwapResponseInfo struct {
	Total        string `json:"total"`
	TotalInBytes int64  `json:"total_in_bytes"`
	Free         string `json:"free"`
	FreeInBytes  int64  `json:"free_in_bytes"`
	Used         string `json:"used"`
	UsedInBytes  int64  `json:"used_in_bytes"`
}

func NewSwapResponseInfo

func NewSwapResponseInfo() *SwapResponseInfo

type TotalFsResponse

type TotalFsResponse struct {
	Total            string `json:"total"`
	TotalInBytes     uint64 `json:"total_in_bytes"`
	Free             string `json:"free"`
	FreeInBytes      uint64 `json:"free_in_bytes"`
	Available        string `json:"available"`
	AvailableInBytes uint64 `json:"available_in_bytes"`
}

func NewTotalFsResponse

func NewTotalFsResponse(total string, totalInBytes uint64, free string, freeInBytes uint64, available string, availableInBytes uint64) *TotalFsResponse

type VirtualMemResponse

type VirtualMemResponse struct {
	TotalVirtual        string `json:"total_virtual"`
	TotalVirtualInBytes uint64 `json:"total_virtual_in_bytes"`
}

func NewVirtualMemResponse

func NewVirtualMemResponse(totalVirtual string, totalVirtualBytes uint64) *VirtualMemResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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