v1

package
v1.29.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexStorageMetricKey             = "index_storage"
	SegmentCountMetricKey             = "segment_count"
	DocCountMetricKey                 = "doc_count"
	DocsDeletedMetricKey              = "docs_deleted"
	QueryTimesMetricKey               = "query_times"
	FetchTimesMetricKey               = "fetch_times"
	ScrollTimesMetricKey              = "scroll_times"
	MergeTimesMetricKey               = "merge_times"
	RefreshTimesMetricKey             = "refresh_times"
	FlushTimesMetricKey               = "flush_times"
	IndexingRateMetricKey             = "indexing_rate"
	IndexingBytesMetricKey            = "indexing_bytes"
	IndexingLatencyMetricKey          = "indexing_latency"
	QueryLatencyMetricKey             = "query_latency"
	FetchLatencyMetricKey             = "fetch_latency"
	MergeLatencyMetricKey             = "merge_latency"
	RefreshLatencyMetricKey           = "refresh_latency"
	ScrollLatencyMetricKey            = "scroll_latency"
	FlushLatencyMetricKey             = "flush_latency"
	QueryCacheMetricKey               = "query_cache"
	RequestCacheMetricKey             = "request_cache"
	RequestCacheHitMetricKey          = "request_cache_hit"
	RequestCacheMissMetricKey         = "request_cache_miss"
	QueryCacheCountMetricKey          = "query_cache_count"
	QueryCacheHitMetricKey            = "query_cache_hit"
	QueryCacheMissMetricKey           = "query_cache_miss"
	FielddataCacheMetricKey           = "fielddata_cache"
	SegmentMemoryMetricKey            = "segment_memory"
	SegmentDocValuesMemoryMetricKey   = "segment_doc_values_memory"
	SegmentTermsMemoryMetricKey       = "segment_terms_memory"
	SegmentFieldsMemoryMetricKey      = "segment_fields_memory"
	SegmentIndexWriterMemoryMetricKey = "segment_index_writer_memory"
	SegmentTermVectorsMemoryMetricKey = "segment_term_vectors_memory"
	DocPercentMetricKey               = "doc_percent"
	SegmentNormsMetricKey             = "segment_norms_memory"
	SegmentPointsMetricKey            = "segment_points_memory"
	VersionMapMetricKey               = "segment_version_map"
	FixedBitSetMetricKey              = "segment_fixed_bit_set"
)
View Source
const (
	SystemGroupKey         = "system"
	OperationGroupKey      = "operations"
	LatencyGroupKey        = "latency"
	CacheGroupKey          = "cache"
	HttpGroupKey           = "http"
	MemoryGroupKey         = "memory"
	StorageGroupKey        = "storage"
	JVMGroupKey            = "JVM"
	TransportGroupKey      = "transport"
	DocumentGroupKey       = "document"
	IOGroupKey             = "io"
	CircuitBreakerGroupKey = "circuit_breaker"
)
View Source
const (
	ClusterStorageMetricKey   = "cluster_storage"
	ClusterDocumentsMetricKey = "cluster_documents"
	ClusterIndicesMetricKey   = "cluster_indices"
	ClusterNodeCountMetricKey = "node_count"
	ClusterHealthMetricKey    = "cluster_health"
	ShardCountMetricKey       = "shard_count"
	CircuitBreakerMetricKey   = "circuit_breaker"
)
View Source
const (
	RollupClusterHealthKey     = "rollup_cluster_health"
	RollupIndexHealthKey       = "rollup_index_health"
	RollupClusterStataKey      = "rollup_cluster_stats"
	RollupIndexStatsKey        = "rollup_index_stats"
	RollupNodeStatsKey         = "rollup_node_stats"
	RollupShardStatsMetricsKey = "rollup_shard_stats_metrics"
	RollupShardStatsStateKey   = "rollup_shard_stats_state"
)
View Source
const (
	IndexThroughputMetricKey  = "index_throughput"
	SearchThroughputMetricKey = "search_throughput"
	IndexLatencyMetricKey     = "index_latency"
	SearchLatencyMetricKey    = "search_latency"
)
View Source
const (
	MetricTypeClusterHealth = "cluster_health"
	MetricTypeClusterStats  = "cluster_stats"
	MetricTypeNodeStats     = "node_stats"
	MetricTypeIndexStats    = "index_stats"
)
View Source
const IndexHealthMetricKey = "index_health"

Variables

This section is empty.

Functions

func CalcBucketSize added in v1.29.6

func CalcBucketSize(hours float64, targetPointCount int) int

CalcBucketSize calculates a suitable bucket size in seconds with finer granularity.

func ConvertBucketItemsToAggQuery

func ConvertBucketItemsToAggQuery(bucketItems []*common.BucketItem, metricItems []*common.MetricItem) util.MapStr

func ConvertMetricItemsToAggQuery

func ConvertMetricItemsToAggQuery(metricItems []*common.MetricItem) map[string]interface{}

func GetIndicesCount added in v1.29.6

func GetIndicesCount(clusterID string) int

index name top search need index count for partition

func GetMetricMinBucketSize added in v1.28.0

func GetMetricMinBucketSize(clusterID, metricType string) (int, error)

GetMetricMinBucketSize returns twice the metrics collection interval based on the cluster ID and metric type

func GetMetricRangeAndBucketSize

func GetMetricRangeAndBucketSize(minStr string, maxStr string, bucketSize int, metricCount int, minBucketSize int) (int, int64, int64, error)

func GetMinBucketSize

func GetMinBucketSize() int

func IsRollupSearch added in v1.29.8

func IsRollupSearch(response *elastic.SearchResponse) bool

Types

type APIHandler

type APIHandler struct {
	core.Handler
	Config common.ModuleConfig
}

func (*APIHandler) Client

func (h *APIHandler) Client() elastic.API

func (*APIHandler) FetchClusterInfo

func (h *APIHandler) FetchClusterInfo(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) FetchIndexInfo

func (h *APIHandler) FetchIndexInfo(w http.ResponseWriter, ctx context.Context, indexIDs []interface{})

func (*APIHandler) FetchNodeInfo

func (h *APIHandler) FetchNodeInfo(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetClusterClient

func (h *APIHandler) GetClusterClient(id string) (bool, elastic.API, error)

TODO use prefered client

func (*APIHandler) GetClusterHealth

func (h *APIHandler) GetClusterHealth(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetClusterIndexMetrics

func (h *APIHandler) GetClusterIndexMetrics(ctx context.Context, id string, bucketSize int, min, max int64, metricKey string) (map[string]*common.MetricItem, error)

func (*APIHandler) GetClusterIndices

func (h *APIHandler) GetClusterIndices(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetClusterInfo

func (h *APIHandler) GetClusterInfo(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetClusterMetrics

func (h *APIHandler) GetClusterMetrics(ctx context.Context, id string, bucketSize int, min, max int64, metricKey string) (map[string]*common.MetricItem, error)

func (*APIHandler) GetClusterNodes

func (h *APIHandler) GetClusterNodes(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetClusterStatusAction

func (h *APIHandler) GetClusterStatusAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetHosts

func (h *APIHandler) GetHosts(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetIndexHealthMetric added in v1.27.0

func (h *APIHandler) GetIndexHealthMetric(ctx context.Context, id, indexName string, min, max int64, bucketSize int) (*common.MetricItem, error)

func (*APIHandler) GetIndexInfo

func (h *APIHandler) GetIndexInfo(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetIndexShards

func (h *APIHandler) GetIndexShards(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetIndexStatusOfRecentDay added in v1.27.0

func (h *APIHandler) GetIndexStatusOfRecentDay(clusterID, indexName string) (map[string][]interface{}, error)

func (*APIHandler) GetMetadata

func (h *APIHandler) GetMetadata(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetMetadataByID

func (h *APIHandler) GetMetadataByID(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetMetricRangeAndBucketSize added in v1.28.0

func (h *APIHandler) GetMetricRangeAndBucketSize(req *http.Request, clusterID, metricType string, defaultMetricCount int) (int, int64, int64, error)

defaultBucketSize 也就是每次聚合的时间间隔

func (*APIHandler) GetNodeInfo

func (h *APIHandler) GetNodeInfo(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetNodeShards

func (h *APIHandler) GetNodeShards(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetRealtimeClusterIndices

func (h *APIHandler) GetRealtimeClusterIndices(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetSingleIndexMetrics

func (h *APIHandler) GetSingleIndexMetrics(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) GetSingleNodeMetrics

func (h *APIHandler) GetSingleNodeMetrics(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleClusterMetricsAction

func (h *APIHandler) HandleClusterMetricsAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

new

func (*APIHandler) HandleCreateClusterAction

func (h *APIHandler) HandleCreateClusterAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleDeleteClusterAction

func (h *APIHandler) HandleDeleteClusterAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleGetClusterAction

func (h *APIHandler) HandleGetClusterAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleGetNodesAction

func (h *APIHandler) HandleGetNodesAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleGetStorageMetricAction

func (h *APIHandler) HandleGetStorageMetricAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleIndexMetricsAction

func (h *APIHandler) HandleIndexMetricsAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleMetricsSummaryAction

func (h *APIHandler) HandleMetricsSummaryAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleSearchClusterAction

func (h *APIHandler) HandleSearchClusterAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) HandleUpdateClusterAction

func (h *APIHandler) HandleUpdateClusterAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (APIHandler) ListIndex

func (h APIHandler) ListIndex(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) QueryQPS

func (h *APIHandler) QueryQPS(query util.MapStr, bucketSizeInSeconds int) (map[string]util.MapStr, error)

func (*APIHandler) SearchClusterMetadata

func (h *APIHandler) SearchClusterMetadata(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*APIHandler) SearchNodeMetadata

func (h *APIHandler) SearchNodeMetadata(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

type Bucket

type Bucket struct {
	BucketBase //子 buckets

	KeyAsString             string      `json:"key_as_string,omitempty"`
	Key                     interface{} `json:"key,omitempty"`
	DocCount                int64       `json:"doc_count,omitempty"`
	DocCountErrorUpperBound int64       `json:"doc_count_error_upper_bound,omitempty"`
	SumOtherDocCount        int64       `json:"sum_other_doc_count,omitempty"`

	Buckets []Bucket `json:"buckets,omitempty"` //本 buckets
}

type BucketBase

type BucketBase map[string]interface{}

func (BucketBase) GetChildBucket

func (receiver BucketBase) GetChildBucket(name string) (map[string]interface{}, bool)

type CatNodeResponse

type CatNodeResponse elastic.CatNodeResponse

type GroupMetricItem

type GroupMetricItem struct {
	Key          string
	Field        string
	ID           string
	IsDerivative bool
	Units        string
	FormatType   string
	MetricItem   *common.MetricItem
	Field2       string
	Calc         func(value, value2 float64) float64
}

type IndexInfo

type IndexInfo elastic.IndexInfo

type MetricData

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

func ParseAggregationBucketResult

func ParseAggregationBucketResult(bucketSize int, aggsData util.MapStr, groupKey, resultLabelKey, resultValueKey string, resultItemHandle func()) MetricData

func ParseAggregationResult

func ParseAggregationResult(bucketSize int, aggsData util.MapStr, groupKey, metricLabelKey, metricValueKey string) MetricData

type RealtimeIndexInfo

type RealtimeIndexInfo struct {
	IndexQPS      interface{} `json:"index_qps"`
	QueryQPS      interface{} `json:"query_qps"`
	IndexBytesQPS interface{} `json:"index_bytes_qps"`
	IndexInfo
}

type RealtimeNodeInfo

type RealtimeNodeInfo struct {
	IndexQPS      interface{} `json:"index_qps"`
	QueryQPS      interface{} `json:"query_qps"`
	IndexBytesQPS interface{} `json:"index_bytes_qps"`
	CatNodeResponse
}

type SearchResponse

type SearchResponse struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Hits     struct {
		Total    interface{} `json:"total"`
		MaxScore float32     `json:"max_score"`
	} `json:"hits"`
	Aggregations util.MapStr `json:"aggregations,omitempty"`
}

type TopTerm

type TopTerm struct {
	Key   string
	Value float64
}

type TopTermOrder

type TopTermOrder []TopTerm

func (TopTermOrder) Len

func (t TopTermOrder) Len() int

func (TopTermOrder) Less

func (t TopTermOrder) Less(i, j int) bool

func (TopTermOrder) Swap

func (t TopTermOrder) Swap(i, j int)

type TreeMapNode

type TreeMapNode struct {
	Name     string         `json:"name"`
	Value    float64        `json:"value,omitempty"`
	Children []*TreeMapNode `json:"children,omitempty"`
	SubKeys  map[string]int `json:"-"`
}

Jump to

Keyboard shortcuts

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