analytics

package
v0.0.0-...-44e4a4a Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeGeneral string = "general"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventStats

type EventStats struct {
	Feature     string    `json:"feature_name"`
	Type        string    `json:"type_name"`
	ProjectID   string    `ch:"ProjectId" json:"project_id"`
	NamespaceID int64     `ch:"NamespaceId" json:"namespace_id"`
	AggTimeUnix time.Time `ch:"AggTimeUnix" json:"agg_time_unix"`
	Count       uint64    `ch:"Count" json:"count"`
}

type EventStatsGetFn

type EventStatsGetFn func(context.Context, clickhouse.Conn) ([]EventStats, error)

type FeatureName

type FeatureName string
const (
	FeatureET      FeatureName = "errortracking"
	FeatureMetrics FeatureName = "metrics"
	FeatureTraces  FeatureName = "tracing"
	FeatureLogs    FeatureName = "logging"
)

type Generator

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

func NewGenerator

func NewGenerator(
	db clickhouse.Conn,
	logger *zap.Logger,
	reg prometheus.Registerer,
	opts *GeneratorOpts,
) (*Generator, error)

func (*Generator) Start

func (g *Generator) Start(ctx context.Context)

func (*Generator) Stop

func (g *Generator) Stop()

type GeneratorOpts

type GeneratorOpts struct {
	SyncFrequencySeconds int
}

type ProjectAnalyticsData

type ProjectAnalyticsData struct {
	Interval           int64            `json:"interval"`
	TotalEventsCount   int64            `json:"total_events_count"`
	FeatureEventsCount map[string]int64 `json:"feature_events_count"`
}

type ProjectAnalyticsDataTS

type ProjectAnalyticsDataTS []ProjectAnalyticsData

func (ProjectAnalyticsDataTS) Len

func (a ProjectAnalyticsDataTS) Len() int

func (ProjectAnalyticsDataTS) Less

func (a ProjectAnalyticsDataTS) Less(i, j int) bool

func (ProjectAnalyticsDataTS) Swap

func (a ProjectAnalyticsDataTS) Swap(i, j int)

type ProjectAnalyticsResponse

type ProjectAnalyticsResponse struct {
	ProjectID   string                 `json:"project_id"`
	NamespaceID int64                  `json:"namespace_id"`
	Results     ProjectAnalyticsDataTS `json:"results"`
}

type Querier

type Querier interface {
	Close()
	GetProjectAnalytics(
		context.Context,
		string,
		time.Time,
		time.Time,
	) (interface{}, error)
}

func NewQuerier

func NewQuerier(
	clickHouseDSN string,
	clickHouseCloudDSN string,
	opts *clickhouse.Options,
	logger *zap.Logger,
	reg prometheus.Registerer,
) (Querier, error)

Jump to

Keyboard shortcuts

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