decoder

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUFFER_SIZE    = 128 // An prometheus message is usually very large, so use a smaller value than usual
	PROMETHEUS_POD = "pod"
)
View Source
const (
	METRICID_OFFSET = 32 // when generate columnIndexKey/metricTargetPairKey, high32 is metricID, low32 can be labelNameID/targetID

	POD_CLUSTER_ID_OFFSET = 16
	JOBID_OFFSET          = 32
)

Variables

This section is empty.

Functions

func DecodeWriteRequest

func DecodeWriteRequest(compressed []byte, decodeBuffer *[]byte, req *prompb.WriteRequest) error

func RegisterClientPrometheusLabelCommand

func RegisterClientPrometheusLabelCommand() *cobra.Command

func ReleaseSlowItem

func ReleaseSlowItem(s *SlowItem)

Types

type BuilderCounter

type BuilderCounter struct {
	TimeSeriesIn      int64 `statsd:"time-series-in"`
	TimeSeriesInvaild int64 `statsd:"time-series-invalid"`
	EpcMiss           int64 `statsd:"epc-miss"`
	LabelCount        int64 `statsd:"label-in"`
	MetricMiss        int64 `statsd:"metirc-miss"`
	NameMiss          int64 `statsd:"name-miss"`
	ValueMiss         int64 `statsd:"value-miss"`
	NameValueMiss     int64 `statsd:"name-value-miss"`
	ColumnMiss        int64 `statsd:"column-miss"`
	TargetMiss        int64 `statsd:"target-miss"`
	MetricTargetMiss  int64 `statsd:"metric-target-miss"`
	Sample            int64 `statsd:"sample-out"`
}

type Counter

type Counter struct {
	InCount        int64 `statsd:"in-count"`
	OutCount       int64 `statsd:"out-count"`
	ErrCount       int64 `statsd:"err-count"`
	TimeSeriesIn   int64 `statsd:"time-series-in"`
	TimeSeriesErr  int64 `statsd:"time-series-err"`
	TimeSeriesSlow int64 `statsd:"time-series-slow"`
	TimeSeriesOut  int64 `statsd:"time-series-out"` // count the number of TimeSeries (not Samples)
}

type Decoder

type Decoder struct {
	utils.Closable
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(
	index int,
	platformData *grpc.PlatformInfoTable,
	prometheusLabelTable *PrometheusLabelTable,
	inQueue queue.QueueReader,
	slowDecodeQueue queue.QueueWriter,
	prometheusWriter *dbwriter.PrometheusWriter,
	config *config.Config,
) *Decoder

func (*Decoder) GetCounter

func (d *Decoder) GetCounter() interface{}

func (*Decoder) Run

func (d *Decoder) Run()

type PrometheusLabelTable

type PrometheusLabelTable struct {
	GrpcSession *grpc.GrpcSession

	utils.Closable
	// contains filtered or unexported fields
}

func NewPrometheusLabelTable

func NewPrometheusLabelTable(controllerIPs []string, port, rpcMaxMsgSize, cacheExpiration int) *PrometheusLabelTable

func (*PrometheusLabelTable) GetCounter

func (t *PrometheusLabelTable) GetCounter() interface{}

func (*PrometheusLabelTable) GetMaxAppLabelColumnIndex

func (t *PrometheusLabelTable) GetMaxAppLabelColumnIndex() int

func (*PrometheusLabelTable) HandleSimpleCommand

func (t *PrometheusLabelTable) HandleSimpleCommand(op uint16, arg string) string

func (*PrometheusLabelTable) QueryColumnIndex

func (t *PrometheusLabelTable) QueryColumnIndex(metricID, labelNameID uint32) (uint32, bool)

func (*PrometheusLabelTable) QueryLabelNameID

func (t *PrometheusLabelTable) QueryLabelNameID(labelName string) (uint32, bool)

func (*PrometheusLabelTable) QueryLabelNameValue

func (t *PrometheusLabelTable) QueryLabelNameValue(nameId, valueId uint32) bool

func (*PrometheusLabelTable) QueryLabelValueID

func (t *PrometheusLabelTable) QueryLabelValueID(labelValue string) (uint32, bool)

func (*PrometheusLabelTable) QueryMetricID

func (t *PrometheusLabelTable) QueryMetricID(metricName string) (uint32, bool)

func (*PrometheusLabelTable) QueryMetricTargetPair

func (t *PrometheusLabelTable) QueryMetricTargetPair(metricID, targetID uint32) bool

func (*PrometheusLabelTable) QueryTargetID

func (t *PrometheusLabelTable) QueryTargetID(epcId, podClusterId uint16, jobID, instanceID uint32) (uint32, bool)

func (*PrometheusLabelTable) RequestAllLabelIDs

func (t *PrometheusLabelTable) RequestAllLabelIDs()

func (*PrometheusLabelTable) RequestAllTargetIDs

func (t *PrometheusLabelTable) RequestAllTargetIDs()

func (*PrometheusLabelTable) RequestLabelIDs

func (*PrometheusLabelTable) UpdateTargetIdsRegularIntervals

func (t *PrometheusLabelTable) UpdateTargetIdsRegularIntervals()

type PrometheusSamplesBuilder

type PrometheusSamplesBuilder struct {
	utils.Closable
	// contains filtered or unexported fields
}

func NewPrometheusSamplesBuilder

func NewPrometheusSamplesBuilder(name string, index int, platformData *grpc.PlatformInfoTable, labelTable *PrometheusLabelTable, appLabelColumnAlign int, ignoreUniversalTag bool) *PrometheusSamplesBuilder

func (*PrometheusSamplesBuilder) GetCounter

func (d *PrometheusSamplesBuilder) GetCounter() interface{}

func (*PrometheusSamplesBuilder) GetEpcPodClusterId

func (b *PrometheusSamplesBuilder) GetEpcPodClusterId(vtapID uint16) (uint16, uint16, error)

func (*PrometheusSamplesBuilder) TimeSeriesToStore

func (b *PrometheusSamplesBuilder) TimeSeriesToStore(vtapID, epcId, podClusterId uint16, ts *prompb.TimeSeries, extraLabels []prompb.Label) (bool, error)

if success,return false,nil if failed, return false,err if isSlow, return true,slowReason

type RequestCounter

type RequestCounter struct {
	RequestCount        int64  `statsd:"request-count"`
	RequestTotalDelayNs int64  `statsd:"request-total-delay-ns"`
	ResponseFailed      int64  `statsd:"response-failed"`
	RequestLabelsCount  int64  `statsd:"request-labels-count"`
	ResponseLabelsCount int64  `statsd:"response-labels-count"`
	MetricUnknown       uint64 `statsd:"metric-unknown"`
	TargetIdZero        uint64 `statsd:"target-id-zero"`
	LabelNameUnknown    uint64 `statsd:"label-name-unknown"`
	LabelValueUnknown   uint64 `statsd:"label-value-unknown"`
	CacheExpiration     uint64 `statsd:"cache-expiration-count"`
}

type SlowCounter

type SlowCounter struct {
	// count the number of TimeSeries (not Samples)
	TimeSeriesIn   int64 `statsd:"time-series-in"`
	TimeSeriesErr  int64 `statsd:"time-series-err"`
	TimeSeriesDrop int64 `statsd:"time-series-drop"`
	TimeSeriesOut  int64 `statsd:"time-series-out"`

	SampleOut    int64 `statsd:"sample-out"` // count the number of Samples (not TimeSeries)
	RequestCount int64 `statsd:"request-count"`
}

type SlowDecoder

type SlowDecoder struct {
	utils.Closable
	// contains filtered or unexported fields
}

func NewSlowDecoder

func NewSlowDecoder(
	index int,
	platformData *grpc.PlatformInfoTable,
	prometheusLabelTable *PrometheusLabelTable,
	inQueue queue.QueueReader,
	prometheusWriter *dbwriter.PrometheusWriter,
	config *config.Config,
) *SlowDecoder

func (*SlowDecoder) GetCounter

func (d *SlowDecoder) GetCounter() interface{}

func (*SlowDecoder) Run

func (d *SlowDecoder) Run()

func (*SlowDecoder) TimeSeriesToLableIDRequest

func (d *SlowDecoder) TimeSeriesToLableIDRequest(ts *prompb.TimeSeries, epcId, podClusterId uint16) (*trident.MetricLabelRequest, *trident.TargetRequest)

type SlowItem

type SlowItem struct {
	// contains filtered or unexported fields
}

func AcquireSlowItem

func AcquireSlowItem(vtapId, epcId, podClusterId uint16, ts *prompb.TimeSeries, extraLabels []prompb.Label) *SlowItem

type TargetIdKey

type TargetIdKey struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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