Documentation ¶
Index ¶
- Constants
- Variables
- func ReadFileListCache(p string, version FLCVersion, writer io.Writer) error
- func TraceContextToZap(ctx context.Context, logger *zap.Logger) *zap.Logger
- func TraceHandler(h http.HandlerFunc, globalStatusCodes, handlerStatusCodes []uint64, ...) http.HandlerFunc
- type ApiPerPathRatelimiter
- type CarbonserverListener
- func (listener *CarbonserverListener) CurrentFileIndex() *fileIndex
- func (listener *CarbonserverListener) Find(ctx context.Context, req *protov2.GlobRequest) (*protov2.GlobResponse, error)
- func (listener *CarbonserverListener) Info(ctx context.Context, req *protov2.InfoRequest) (*protov2.InfoResponse, error)
- func (c *CarbonserverListener) InitPrometheus(reg prom.Registerer)
- func (listener *CarbonserverListener) Listen(listen string) error
- func (listener *CarbonserverListener) ListenGRPC(listen string) error
- func (listener *CarbonserverListener) RegisterInternalInfoHandler(name string, f func() map[string]interface{})
- func (listener *CarbonserverListener) Render(req *protov2.MultiFetchRequest, stream grpcv2.CarbonV2_RenderServer) (rpcErr error)
- func (listener *CarbonserverListener) SetAPIPerPathRateLimiter(rls map[string]*ApiPerPathRatelimiter)
- func (listener *CarbonserverListener) SetBuckets(buckets int)
- func (listener *CarbonserverListener) SetCacheGetMetricsFunc(recentMetricsFunc func() []map[string]struct{})
- func (listener *CarbonserverListener) SetCompressed(compressed bool)
- func (listener *CarbonserverListener) SetConcurrentIndex(enabled bool)
- func (listener *CarbonserverListener) SetConfigRetriever(retriever configRetriever)
- func (listener *CarbonserverListener) SetDoNotLog404s(doNotLog404s bool)
- func (listener *CarbonserverListener) SetEmptyResultOk(emptyResultOk bool)
- func (listener *CarbonserverListener) SetEstimateSize(f func(metric string) (logicalSize, physicalSize, dataPoints int64))
- func (listener *CarbonserverListener) SetFLock(flock bool)
- func (listener *CarbonserverListener) SetFailOnMaxGlobs(failOnMaxGlobs bool)
- func (listener *CarbonserverListener) SetFileListCache(path string)
- func (listener *CarbonserverListener) SetFileListCacheVersion(version int)
- func (listener *CarbonserverListener) SetFindCacheEnabled(enabled bool)
- func (listener *CarbonserverListener) SetFindCacheSizeMB(size int)
- func (listener *CarbonserverListener) SetGlobCacheEnabled(enabled bool)
- func (listener *CarbonserverListener) SetGlobCacheSizeMB(size int)
- func (listener *CarbonserverListener) SetHeavyGlobQueryRateLimiters(rls []*GlobQueryRateLimiter)
- func (listener *CarbonserverListener) SetIdleTimeout(idleTimeout time.Duration)
- func (listener *CarbonserverListener) SetInternalStatsDir(dbPath string)
- func (listener *CarbonserverListener) SetMaxCreatesPerSecond(maxCreatesPerSecond int)
- func (listener *CarbonserverListener) SetMaxFetchDataGoroutines(max int)
- func (listener *CarbonserverListener) SetMaxGlobs(maxGlobs int)
- func (listener *CarbonserverListener) SetMaxInflightRequests(max uint64)
- func (listener *CarbonserverListener) SetMaxMetricsGlobbed(max int)
- func (listener *CarbonserverListener) SetMaxMetricsRendered(max int)
- func (listener *CarbonserverListener) SetMetricsAsCounters(metricsAsCounters bool)
- func (listener *CarbonserverListener) SetNoServiceWhenIndexIsNotReady(no bool)
- func (listener *CarbonserverListener) SetPercentiles(percentiles []int)
- func (listener *CarbonserverListener) SetQueryCacheEnabled(enabled bool)
- func (listener *CarbonserverListener) SetQueryCacheSizeMB(size int)
- func (listener *CarbonserverListener) SetQuotaUsageReportFrequency(quotaUsageReportFrequency time.Duration)
- func (listener *CarbonserverListener) SetQuotas(quotas []*Quota)
- func (listener *CarbonserverListener) SetReadTimeout(readTimeout time.Duration)
- func (listener *CarbonserverListener) SetRealtimeIndex(num int) chan string
- func (listener *CarbonserverListener) SetRemoveEmptyFile(remove bool)
- func (listener *CarbonserverListener) SetRenderTraceLoggingEnabled(enabled bool)
- func (listener *CarbonserverListener) SetRequestTimeout(requestTimeout time.Duration)
- func (listener *CarbonserverListener) SetScanFrequency(scanFrequency time.Duration)
- func (listener *CarbonserverListener) SetStreamingQueryCacheEnabled(enabled bool)
- func (listener *CarbonserverListener) SetTrieIndex(enabled bool)
- func (listener *CarbonserverListener) SetTrigramIndex(enabled bool)
- func (listener *CarbonserverListener) SetWhisperData(whisperData string)
- func (listener *CarbonserverListener) SetWriteTimeout(writeTimeout time.Duration)
- func (listener *CarbonserverListener) ShouldThrottleMetric(ps *points.Points, inCache bool) bool
- func (listener *CarbonserverListener) Stat(send helper.StatCallback)
- func (listener *CarbonserverListener) Stop() error
- func (listener *CarbonserverListener) StreamServerRatelimitHandler() grpc.StreamServerInterceptor
- func (listener *CarbonserverListener) UnaryServerRatelimitHandler() grpc.UnaryServerInterceptor
- func (listener *CarbonserverListener) UpdateFileIndex(fidx *fileIndex)
- func (listener *CarbonserverListener) UpdateMetricsAccessTimes(metrics map[string]int64, initial bool)
- func (listener *CarbonserverListener) UpdateMetricsAccessTimesByRequest(metrics []string)
- type ExpandedGlobResponse
- type FLCEntry
- type FLCVersion
- type FileListCache
- type GlobQueryRateLimiter
- type IntervalSet
- type ListMetricInfo
- type ListQueryResult
- type Metadata
- type QueryItem
- type Quota
- type QuotaDroppingPolicy
- type QuotaUsage
- type RatelimiterError
Constants ¶
View Source
const ( QueryIsPending uint64 = 1 << iota DataIsAvailable )
Variables ¶
View Source
var (
BlockedRatelimitError = RatelimiterError("blocked by api per path rate limiter")
)
View Source
var TraceGrpcMetadata = map[string]string{
"carponapi_uuid": "carbonapi_uuid",
}
View Source
var TraceHeaders = map[headerName]string{
{"X-CTX-CarbonAPI-UUID"}: "carbonapi_uuid",
{"X-CTX-CarbonZipper-UUID"}: "carbonzipper_uuid",
{"X-Request-ID"}: "request_id",
}
Functions ¶
func ReadFileListCache ¶ added in v0.17.0
func ReadFileListCache(p string, version FLCVersion, writer io.Writer) error
ReadFileListCache dumps cache data in csv to writer.
func TraceContextToZap ¶ added in v0.10.0
func TraceHandler ¶ added in v0.10.0
func TraceHandler(h http.HandlerFunc, globalStatusCodes, handlerStatusCodes []uint64, promRequest func(string, int)) http.HandlerFunc
Types ¶
type ApiPerPathRatelimiter ¶ added in v0.17.0
type ApiPerPathRatelimiter struct {
// contains filtered or unexported fields
}
func NewApiPerPathRatelimiter ¶ added in v0.17.0
func NewApiPerPathRatelimiter(maxInflightRequests uint, timeout time.Duration) *ApiPerPathRatelimiter
func (*ApiPerPathRatelimiter) Enter ¶ added in v0.17.0
func (a *ApiPerPathRatelimiter) Enter() error
func (*ApiPerPathRatelimiter) Exit ¶ added in v0.17.0
func (a *ApiPerPathRatelimiter) Exit()
type CarbonserverListener ¶
type CarbonserverListener struct { grpcv2.UnimplementedCarbonV2Server helper.Stoppable // resource control MaxInflightRequests uint64 // TODO: to deprecate NoServiceWhenIndexIsNotReady bool // contains filtered or unexported fields }
func NewCarbonserverListener ¶
func NewCarbonserverListener(cacheGetFunc func(key string) []points.Point) *CarbonserverListener
func (*CarbonserverListener) CurrentFileIndex ¶
func (listener *CarbonserverListener) CurrentFileIndex() *fileIndex
skipcq: RVV-B0011
func (*CarbonserverListener) Find ¶ added in v0.17.0
func (listener *CarbonserverListener) Find(ctx context.Context, req *protov2.GlobRequest) (*protov2.GlobResponse, error)
func (*CarbonserverListener) Info ¶ added in v0.17.0
func (listener *CarbonserverListener) Info(ctx context.Context, req *protov2.InfoRequest) (*protov2.InfoResponse, error)
func (*CarbonserverListener) InitPrometheus ¶ added in v0.14.0
func (c *CarbonserverListener) InitPrometheus(reg prom.Registerer)
func (*CarbonserverListener) Listen ¶
func (listener *CarbonserverListener) Listen(listen string) error
func (*CarbonserverListener) ListenGRPC ¶ added in v0.17.0
func (listener *CarbonserverListener) ListenGRPC(listen string) error
func (*CarbonserverListener) RegisterInternalInfoHandler ¶ added in v0.16.0
func (listener *CarbonserverListener) RegisterInternalInfoHandler(name string, f func() map[string]interface{})
func (*CarbonserverListener) Render ¶ added in v0.17.0
func (listener *CarbonserverListener) Render(req *protov2.MultiFetchRequest, stream grpcv2.CarbonV2_RenderServer) (rpcErr error)
Render implements Render rpc of CarbonV2 gRPC service
func (*CarbonserverListener) SetAPIPerPathRateLimiter ¶ added in v0.17.0
func (listener *CarbonserverListener) SetAPIPerPathRateLimiter(rls map[string]*ApiPerPathRatelimiter)
func (*CarbonserverListener) SetBuckets ¶
func (listener *CarbonserverListener) SetBuckets(buckets int)
func (*CarbonserverListener) SetCacheGetMetricsFunc ¶ added in v0.15.0
func (listener *CarbonserverListener) SetCacheGetMetricsFunc(recentMetricsFunc func() []map[string]struct{})
func (*CarbonserverListener) SetCompressed ¶ added in v0.15.0
func (listener *CarbonserverListener) SetCompressed(compressed bool)
func (*CarbonserverListener) SetConcurrentIndex ¶ added in v0.15.1
func (listener *CarbonserverListener) SetConcurrentIndex(enabled bool)
func (*CarbonserverListener) SetConfigRetriever ¶ added in v0.15.0
func (listener *CarbonserverListener) SetConfigRetriever(retriever configRetriever)
func (*CarbonserverListener) SetDoNotLog404s ¶ added in v0.17.2
func (listener *CarbonserverListener) SetDoNotLog404s(doNotLog404s bool)
func (*CarbonserverListener) SetEmptyResultOk ¶ added in v0.17.0
func (listener *CarbonserverListener) SetEmptyResultOk(emptyResultOk bool)
func (*CarbonserverListener) SetEstimateSize ¶ added in v0.16.0
func (listener *CarbonserverListener) SetEstimateSize(f func(metric string) (logicalSize, physicalSize, dataPoints int64))
func (*CarbonserverListener) SetFLock ¶ added in v0.12.0
func (listener *CarbonserverListener) SetFLock(flock bool)
func (*CarbonserverListener) SetFailOnMaxGlobs ¶ added in v0.12.0
func (listener *CarbonserverListener) SetFailOnMaxGlobs(failOnMaxGlobs bool)
func (*CarbonserverListener) SetFileListCache ¶ added in v0.15.1
func (listener *CarbonserverListener) SetFileListCache(path string)
func (*CarbonserverListener) SetFileListCacheVersion ¶ added in v0.17.0
func (listener *CarbonserverListener) SetFileListCacheVersion(version int)
func (*CarbonserverListener) SetFindCacheEnabled ¶ added in v0.10.0
func (listener *CarbonserverListener) SetFindCacheEnabled(enabled bool)
func (*CarbonserverListener) SetFindCacheSizeMB ¶ added in v0.18.0
func (listener *CarbonserverListener) SetFindCacheSizeMB(size int)
func (*CarbonserverListener) SetGlobCacheEnabled ¶ added in v0.18.0
func (listener *CarbonserverListener) SetGlobCacheEnabled(enabled bool)
func (*CarbonserverListener) SetGlobCacheSizeMB ¶ added in v0.18.0
func (listener *CarbonserverListener) SetGlobCacheSizeMB(size int)
func (*CarbonserverListener) SetHeavyGlobQueryRateLimiters ¶ added in v0.17.0
func (listener *CarbonserverListener) SetHeavyGlobQueryRateLimiters(rls []*GlobQueryRateLimiter)
func (*CarbonserverListener) SetIdleTimeout ¶ added in v0.10.0
func (listener *CarbonserverListener) SetIdleTimeout(idleTimeout time.Duration)
func (*CarbonserverListener) SetInternalStatsDir ¶ added in v0.11.0
func (listener *CarbonserverListener) SetInternalStatsDir(dbPath string)
func (*CarbonserverListener) SetMaxCreatesPerSecond ¶ added in v0.17.0
func (listener *CarbonserverListener) SetMaxCreatesPerSecond(maxCreatesPerSecond int)
func (*CarbonserverListener) SetMaxFetchDataGoroutines ¶ added in v0.18.0
func (listener *CarbonserverListener) SetMaxFetchDataGoroutines(max int)
func (*CarbonserverListener) SetMaxGlobs ¶
func (listener *CarbonserverListener) SetMaxGlobs(maxGlobs int)
func (*CarbonserverListener) SetMaxInflightRequests ¶ added in v0.16.0
func (listener *CarbonserverListener) SetMaxInflightRequests(max uint64)
func (*CarbonserverListener) SetMaxMetricsGlobbed ¶ added in v0.15.0
func (listener *CarbonserverListener) SetMaxMetricsGlobbed(max int)
func (*CarbonserverListener) SetMaxMetricsRendered ¶ added in v0.15.0
func (listener *CarbonserverListener) SetMaxMetricsRendered(max int)
func (*CarbonserverListener) SetMetricsAsCounters ¶
func (listener *CarbonserverListener) SetMetricsAsCounters(metricsAsCounters bool)
func (*CarbonserverListener) SetNoServiceWhenIndexIsNotReady ¶ added in v0.16.0
func (listener *CarbonserverListener) SetNoServiceWhenIndexIsNotReady(no bool)
func (*CarbonserverListener) SetPercentiles ¶ added in v0.11.0
func (listener *CarbonserverListener) SetPercentiles(percentiles []int)
func (*CarbonserverListener) SetQueryCacheEnabled ¶ added in v0.10.0
func (listener *CarbonserverListener) SetQueryCacheEnabled(enabled bool)
func (*CarbonserverListener) SetQueryCacheSizeMB ¶ added in v0.10.0
func (listener *CarbonserverListener) SetQueryCacheSizeMB(size int)
func (*CarbonserverListener) SetQuotaUsageReportFrequency ¶ added in v0.16.0
func (listener *CarbonserverListener) SetQuotaUsageReportFrequency(quotaUsageReportFrequency time.Duration)
func (*CarbonserverListener) SetQuotas ¶ added in v0.16.0
func (listener *CarbonserverListener) SetQuotas(quotas []*Quota)
func (*CarbonserverListener) SetReadTimeout ¶
func (listener *CarbonserverListener) SetReadTimeout(readTimeout time.Duration)
func (*CarbonserverListener) SetRealtimeIndex ¶ added in v0.15.1
func (listener *CarbonserverListener) SetRealtimeIndex(num int) chan string
func (*CarbonserverListener) SetRemoveEmptyFile ¶ added in v0.15.0
func (listener *CarbonserverListener) SetRemoveEmptyFile(remove bool)
func (*CarbonserverListener) SetRenderTraceLoggingEnabled ¶ added in v0.17.0
func (listener *CarbonserverListener) SetRenderTraceLoggingEnabled(enabled bool)
func (*CarbonserverListener) SetRequestTimeout ¶ added in v0.17.0
func (listener *CarbonserverListener) SetRequestTimeout(requestTimeout time.Duration)
func (*CarbonserverListener) SetScanFrequency ¶
func (listener *CarbonserverListener) SetScanFrequency(scanFrequency time.Duration)
func (*CarbonserverListener) SetStreamingQueryCacheEnabled ¶ added in v0.17.0
func (listener *CarbonserverListener) SetStreamingQueryCacheEnabled(enabled bool)
func (*CarbonserverListener) SetTrieIndex ¶ added in v0.15.0
func (listener *CarbonserverListener) SetTrieIndex(enabled bool)
func (*CarbonserverListener) SetTrigramIndex ¶ added in v0.10.0
func (listener *CarbonserverListener) SetTrigramIndex(enabled bool)
func (*CarbonserverListener) SetWhisperData ¶
func (listener *CarbonserverListener) SetWhisperData(whisperData string)
func (*CarbonserverListener) SetWriteTimeout ¶
func (listener *CarbonserverListener) SetWriteTimeout(writeTimeout time.Duration)
func (*CarbonserverListener) ShouldThrottleMetric ¶ added in v0.16.0
func (listener *CarbonserverListener) ShouldThrottleMetric(ps *points.Points, inCache bool) bool
func (*CarbonserverListener) Stat ¶
func (listener *CarbonserverListener) Stat(send helper.StatCallback)
func (*CarbonserverListener) Stop ¶
func (listener *CarbonserverListener) Stop() error
func (*CarbonserverListener) StreamServerRatelimitHandler ¶ added in v0.17.0
func (listener *CarbonserverListener) StreamServerRatelimitHandler() grpc.StreamServerInterceptor
func (*CarbonserverListener) UnaryServerRatelimitHandler ¶ added in v0.17.0
func (listener *CarbonserverListener) UnaryServerRatelimitHandler() grpc.UnaryServerInterceptor
func (*CarbonserverListener) UpdateFileIndex ¶
func (listener *CarbonserverListener) UpdateFileIndex(fidx *fileIndex)
func (*CarbonserverListener) UpdateMetricsAccessTimes ¶ added in v0.10.0
func (listener *CarbonserverListener) UpdateMetricsAccessTimes(metrics map[string]int64, initial bool)
skipcq: RVV-A0005
func (*CarbonserverListener) UpdateMetricsAccessTimesByRequest ¶ added in v0.11.0
func (listener *CarbonserverListener) UpdateMetricsAccessTimesByRequest(metrics []string)
type ExpandedGlobResponse ¶ added in v0.15.0
type ExpandedGlobResponse struct { Name string Files []string Leafs []bool TrieNodes []*trieNode Lookups uint32 Err error }
TODO merge with globs struct
type FLCEntry ¶ added in v0.17.0
type FLCEntry struct { // Shared by both v1 and v2 Path string // V2 only fields LogicalSize, PhysicalSize, DataPoints int64 // Caveat: this is a best effort feature, please treat it with caution. // In theory, this value could be interpreted as file/metric creation time. FirstSeenAt int64 }
FLCEntry is an entry in the file list cache.
type FLCVersion ¶ added in v0.17.0
type FLCVersion int
FLC: file list cache
const ( // All currently supported flc version numbers. FLCVersionUnspecified FLCVersion = 0 FLCVersion1 FLCVersion = 1 FLCVersion2 FLCVersion = 2 )
type FileListCache ¶ added in v0.17.0
type FileListCache interface { GetVersion() FLCVersion Write(*FLCEntry) error Read() (*FLCEntry, error) Close() error }
FileListCache lets users interact with the file list cache file.
func NewFileListCache ¶ added in v0.17.0
func NewFileListCache(p string, version FLCVersion, mode byte) (FileListCache, error)
NewFileListCache returns a FileListCache.
Supported mode values are: 'r' for read only, 'w' for write only.
type GlobQueryRateLimiter ¶ added in v0.17.0
type GlobQueryRateLimiter struct {
// contains filtered or unexported fields
}
func NewGlobQueryRateLimiter ¶ added in v0.17.0
func NewGlobQueryRateLimiter(pattern string, max uint) (*GlobQueryRateLimiter, error)
type IntervalSet ¶
Fake single interval set for graphite
func (*IntervalSet) MarshalPickle ¶
func (i *IntervalSet) MarshalPickle() ([]byte, error)
type ListMetricInfo ¶ added in v0.16.0
TODO: move it to protocol/carbaonapi_v{2,3}
type ListQueryResult ¶ added in v0.16.0
type ListQueryResult struct { Count int PhysicalSize int64 LogicalSize int64 Metrics []ListMetricInfo }
type QueryItem ¶ added in v0.10.0
type QueryItem struct { Data atomic.Value Flags uint64 // DataIsAvailable or QueryIsPending QueryFinished chan struct{} }
func (*QueryItem) FetchOrLock ¶ added in v0.10.0
func (*QueryItem) StoreAbort ¶ added in v0.10.0
func (q *QueryItem) StoreAbort()
func (*QueryItem) StoreAndUnlock ¶ added in v0.10.0
func (q *QueryItem) StoreAndUnlock(data interface{})
type Quota ¶ added in v0.16.0
type QuotaDroppingPolicy ¶ added in v0.16.0
type QuotaDroppingPolicy int8
const ( QDPNew QuotaDroppingPolicy = iota QDPNone )
func ParseQuotaDroppingPolicy ¶ added in v0.16.0
func ParseQuotaDroppingPolicy(policy string) QuotaDroppingPolicy
func (QuotaDroppingPolicy) String ¶ added in v0.16.0
func (qdp QuotaDroppingPolicy) String() string
type QuotaUsage ¶ added in v0.16.0
type QuotaUsage struct { Namespaces int64 // top level subdirectories Metrics int64 // files LogicalSize int64 PhysicalSize int64 DataPoints int64 // inferred from retention policy Throttled int64 }
NOTE: Throughput is checked separately by throughputQuotaManager
func (*QuotaUsage) String ¶ added in v0.16.0
func (q *QuotaUsage) String() string
type RatelimiterError ¶ added in v0.17.0
type RatelimiterError string
func (RatelimiterError) Error ¶ added in v0.17.0
func (re RatelimiterError) Error() string
Click to show internal directories.
Click to hide internal directories.