pumps

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MPL-2.0 Imports: 66 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LogzioPumpPrefix = "logzio-pump"
	LogzioPumpName   = "Logzio Pump"
)
View Source
const (
	KiB = 1 << (10 * iota)
	MiB
	GiB
	TiB
)
View Source
const PUMPS_ENV_META_PREFIX = "_META"
View Source
const PUMPS_ENV_PREFIX = "TYK_PMP_PUMPS"

Variables

View Source
var AvailablePumps map[string]Pump
View Source
var COMMON_TAGS_COUNT = 5
View Source
var SQLAggregateDefaultENV = PUMPS_ENV_PREFIX + "_SQLAGGREGATE" + PUMPS_ENV_META_PREFIX
View Source
var SQLAggregatePumpPrefix = "SQL-aggregate-pump"
View Source
var SQLDefaultENV = PUMPS_ENV_PREFIX + "_SQL" + PUMPS_ENV_META_PREFIX
View Source
var SQLDefaultQueryBatchSize = 1000
View Source
var SQLPrefix = "SQL-pump"
View Source
var THRESHOLD_LEN_TAG_LIST = 1000

Functions

func Dialect added in v1.5.0

func Dialect(cfg *SQLConf) (gorm.Dialector, error)

func NewLogzioClient

func NewLogzioClient(conf *LogzioPumpConfig) (*lg.LogzioSender, error)

Types

type ApiKeyTransport added in v1.2.0

type ApiKeyTransport struct {
	APIKey   string
	APIKeyID string
}

func (*ApiKeyTransport) RoundTrip added in v1.2.0

func (t *ApiKeyTransport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip for ApiKeyTransport auth

type BaseMongoConf added in v1.0.0

type BaseMongoConf struct {
	EnvPrefix                     string    `mapstructure:"meta_env_prefix"`
	MongoURL                      string    `json:"mongo_url" mapstructure:"mongo_url"`
	MongoUseSSL                   bool      `json:"mongo_use_ssl" mapstructure:"mongo_use_ssl"`
	MongoSSLInsecureSkipVerify    bool      `json:"mongo_ssl_insecure_skip_verify" mapstructure:"mongo_ssl_insecure_skip_verify"`
	MongoSSLAllowInvalidHostnames bool      `json:"mongo_ssl_allow_invalid_hostnames" mapstructure:"mongo_ssl_allow_invalid_hostnames"`
	MongoSSLCAFile                string    `json:"mongo_ssl_ca_file" mapstructure:"mongo_ssl_ca_file"`
	MongoSSLPEMKeyfile            string    `json:"mongo_ssl_pem_keyfile" mapstructure:"mongo_ssl_pem_keyfile"`
	MongoDBType                   MongoType `json:"mongo_db_type" mapstructure:"mongo_db_type"`
}

func (*BaseMongoConf) GetBlurredURL added in v1.2.0

func (b *BaseMongoConf) GetBlurredURL() string

type CSVConf

type CSVConf struct {
	EnvPrefix string `mapstructure:"meta_env_prefix"`
	CSVDir    string `mapstructure:"csv_dir"`
}

type CSVPump

type CSVPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*CSVPump) GetEnvPrefix added in v1.3.0

func (c *CSVPump) GetEnvPrefix() string

func (*CSVPump) GetName

func (c *CSVPump) GetName() string

func (*CSVPump) Init

func (c *CSVPump) Init(conf interface{}) error

func (*CSVPump) New

func (c *CSVPump) New() Pump

func (*CSVPump) WriteData

func (c *CSVPump) WriteData(ctx context.Context, data []interface{}) error

type CommonPumpConfig added in v1.2.0

type CommonPumpConfig struct {
	OmitDetailedRecording bool
	// contains filtered or unexported fields
}

func (*CommonPumpConfig) GetEnvPrefix added in v1.3.0

func (p *CommonPumpConfig) GetEnvPrefix() string

func (*CommonPumpConfig) GetFilters added in v1.2.0

func (*CommonPumpConfig) GetMaxRecordSize added in v1.5.0

func (p *CommonPumpConfig) GetMaxRecordSize() int

func (*CommonPumpConfig) GetOmitDetailedRecording added in v1.2.0

func (p *CommonPumpConfig) GetOmitDetailedRecording() bool

func (*CommonPumpConfig) GetTimeout added in v1.2.0

func (p *CommonPumpConfig) GetTimeout() int

func (*CommonPumpConfig) SetFilters added in v1.2.0

func (p *CommonPumpConfig) SetFilters(filters analytics.AnalyticsFilters)

func (*CommonPumpConfig) SetMaxRecordSize added in v1.5.0

func (p *CommonPumpConfig) SetMaxRecordSize(size int)

func (*CommonPumpConfig) SetOmitDetailedRecording added in v1.2.0

func (p *CommonPumpConfig) SetOmitDetailedRecording(OmitDetailedRecording bool)

func (*CommonPumpConfig) SetTimeout added in v1.2.0

func (p *CommonPumpConfig) SetTimeout(timeout int)

func (*CommonPumpConfig) Shutdown added in v1.5.0

func (p *CommonPumpConfig) Shutdown() error

type DogStatsdConf

type DogStatsdConf struct {
	EnvPrefix            string   `mapstructure:"meta_env_prefix"`
	Namespace            string   `mapstructure:"namespace"`
	Address              string   `mapstructure:"address"`
	SampleRate           float64  `mapstructure:"sample_rate"`
	AsyncUDS             bool     `mapstructure:"async_uds"`
	AsyncUDSWriteTimeout int      `mapstructure:"async_uds_write_timeout_seconds"`
	Buffered             bool     `mapstructure:"buffered"`
	BufferedMaxMessages  int      `mapstructure:"buffered_max_messages"`
	Tags                 []string `mapstructure:"tags"`
}

type DogStatsdPump

type DogStatsdPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*DogStatsdPump) GetEnvPrefix added in v1.3.0

func (s *DogStatsdPump) GetEnvPrefix() string

func (*DogStatsdPump) GetName

func (s *DogStatsdPump) GetName() string

func (*DogStatsdPump) Init

func (s *DogStatsdPump) Init(conf interface{}) error

func (*DogStatsdPump) New

func (s *DogStatsdPump) New() Pump

func (*DogStatsdPump) Shutdown added in v1.5.0

func (s *DogStatsdPump) Shutdown() error

func (*DogStatsdPump) WriteData

func (s *DogStatsdPump) WriteData(ctx context.Context, data []interface{}) error

type DummyPump

type DummyPump struct {
	CommonPumpConfig
}

func (*DummyPump) GetName

func (p *DummyPump) GetName() string

func (*DummyPump) Init

func (p *DummyPump) Init(conf interface{}) error

func (*DummyPump) New

func (p *DummyPump) New() Pump

func (*DummyPump) WriteData

func (p *DummyPump) WriteData(ctx context.Context, data []interface{}) error

type Elasticsearch3Operator

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

type Elasticsearch5Operator

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

type Elasticsearch6Operator

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

type Elasticsearch7Operator added in v1.5.0

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

type ElasticsearchBulkConfig added in v1.0.0

type ElasticsearchBulkConfig struct {
	Workers       int `mapstructure:"workers"`
	FlushInterval int `mapstructure:"flush_interval"`
	BulkActions   int `mapstructure:"bulk_actions"`
	BulkSize      int `mapstructure:"bulk_size"`
}

type ElasticsearchConf

type ElasticsearchConf struct {
	EnvPrefix          string                  `mapstructure:"meta_env_prefix"`
	IndexName          string                  `mapstructure:"index_name"`
	ElasticsearchURL   string                  `mapstructure:"elasticsearch_url"`
	EnableSniffing     bool                    `mapstructure:"use_sniffing"`
	DocumentType       string                  `mapstructure:"document_type"`
	RollingIndex       bool                    `mapstructure:"rolling_index"`
	ExtendedStatistics bool                    `mapstructure:"extended_stats"`
	GenerateID         bool                    `mapstructure:"generate_id"`
	DecodeBase64       bool                    `mapstructure:"decode_base64"`
	Version            string                  `mapstructure:"version"`
	DisableBulk        bool                    `mapstructure:"disable_bulk"`
	BulkConfig         ElasticsearchBulkConfig `mapstructure:"bulk_config"`
	AuthAPIKeyID       string                  `mapstructure:"auth_api_key_id"`
	AuthAPIKey         string                  `mapstructure:"auth_api_key"`
	Username           string                  `mapstructure:"auth_basic_username"`
	Password           string                  `mapstructure:"auth_basic_password"`
}

type ElasticsearchOperator

type ElasticsearchOperator interface {
	// contains filtered or unexported methods
}

type ElasticsearchPump

type ElasticsearchPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*ElasticsearchPump) GetEnvPrefix added in v1.3.0

func (e *ElasticsearchPump) GetEnvPrefix() string

func (*ElasticsearchPump) GetName

func (e *ElasticsearchPump) GetName() string

func (*ElasticsearchPump) Init

func (e *ElasticsearchPump) Init(config interface{}) error

func (*ElasticsearchPump) New

func (e *ElasticsearchPump) New() Pump

func (*ElasticsearchPump) Shutdown added in v1.5.0

func (e *ElasticsearchPump) Shutdown() error

func (*ElasticsearchPump) WriteData

func (e *ElasticsearchPump) WriteData(ctx context.Context, data []interface{}) error

type GraylogConf

type GraylogConf struct {
	EnvPrefix   string   `mapstructure:"meta_env_prefix"`
	GraylogHost string   `mapstructure:"host"`
	GraylogPort int      `mapstructure:"port"`
	Tags        []string `mapstructure:"tags"`
}

type GraylogPump

type GraylogPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*GraylogPump) GetEnvPrefix added in v1.3.0

func (p *GraylogPump) GetEnvPrefix() string

func (*GraylogPump) GetName

func (p *GraylogPump) GetName() string

func (*GraylogPump) Init

func (p *GraylogPump) Init(conf interface{}) error

func (*GraylogPump) New

func (p *GraylogPump) New() Pump

func (*GraylogPump) WriteData

func (p *GraylogPump) WriteData(ctx context.Context, data []interface{}) error

type GroupLoginRequest

type GroupLoginRequest struct {
	UserKey string
	GroupID string
}

type HybridPump

type HybridPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

HybridPump allows to send analytics to MDCB over RPC

func (*HybridPump) GetName

func (p *HybridPump) GetName() string

func (*HybridPump) Init

func (p *HybridPump) Init(config interface{}) error

func (*HybridPump) New

func (p *HybridPump) New() Pump

func (*HybridPump) WriteData

func (p *HybridPump) WriteData(ctx context.Context, data []interface{}) error

type InfluxConf

type InfluxConf struct {
	EnvPrefix    string   `mapstructure:"meta_env_prefix"`
	DatabaseName string   `mapstructure:"database_name"`
	Addr         string   `mapstructure:"address"`
	Username     string   `mapstructure:"username"`
	Password     string   `mapstructure:"password"`
	Fields       []string `mapstructure:"fields"`
	Tags         []string `mapstructure:"tags"`
}

type InfluxPump

type InfluxPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*InfluxPump) GetEnvPrefix added in v1.3.0

func (i *InfluxPump) GetEnvPrefix() string

func (*InfluxPump) GetName

func (i *InfluxPump) GetName() string

func (*InfluxPump) Init

func (i *InfluxPump) Init(config interface{}) error

func (*InfluxPump) New

func (i *InfluxPump) New() Pump

func (*InfluxPump) WriteData

func (i *InfluxPump) WriteData(ctx context.Context, data []interface{}) error

type Json

type Json map[string]interface{}

type KafkaConf

type KafkaConf struct {
	EnvPrefix             string            `mapstructure:"meta_env_prefix"`
	Broker                []string          `mapstructure:"broker"`
	ClientId              string            `mapstructure:"client_id"`
	Topic                 string            `mapstructure:"topic"`
	Timeout               time.Duration     `mapstructure:"timeout"`
	Compressed            bool              `mapstructure:"compressed"`
	MetaData              map[string]string `mapstructure:"meta_data"`
	UseSSL                bool              `mapstructure:"use_ssl"`
	SSLInsecureSkipVerify bool              `mapstructure:"ssl_insecure_skip_verify"`
	SSLCertFile           string            `mapstructure:"ssl_cert_file"`
	SSLKeyFile            string            `mapstructure:"ssl_key_file"`
	SASLMechanism         string            `mapstructure:"sasl_mechanism"`
	Username              string            `mapstructure:"sasl_username"`
	Password              string            `mapstructure:"sasl_password"`
	Algorithm             string            `mapstructure:"sasl_algorithm"`
}

type KafkaPump

type KafkaPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*KafkaPump) GetEnvPrefix added in v1.3.0

func (k *KafkaPump) GetEnvPrefix() string

func (*KafkaPump) GetName

func (k *KafkaPump) GetName() string

func (*KafkaPump) Init

func (k *KafkaPump) Init(config interface{}) error

func (*KafkaPump) New

func (k *KafkaPump) New() Pump

func (*KafkaPump) WriteData

func (k *KafkaPump) WriteData(ctx context.Context, data []interface{}) error

type LogzioPump

type LogzioPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*LogzioPump) GetEnvPrefix added in v1.3.0

func (p *LogzioPump) GetEnvPrefix() string

func (*LogzioPump) GetName

func (p *LogzioPump) GetName() string

func (*LogzioPump) Init

func (p *LogzioPump) Init(config interface{}) error

func (*LogzioPump) New

func (p *LogzioPump) New() Pump

func (*LogzioPump) WriteData

func (p *LogzioPump) WriteData(ctx context.Context, data []interface{}) error

type LogzioPumpConfig

type LogzioPumpConfig struct {
	EnvPrefix      string `mapstructure:"meta_env_prefix"`
	CheckDiskSpace bool   `mapstructure:"check_disk_space"`
	DiskThreshold  int    `mapstructure:"disk_threshold"`
	DrainDuration  string `mapstructure:"drain_duration"`
	QueueDir       string `mapstructure:"queue_dir"`
	Token          string `mapstructure:"token"`
	URL            string `mapstructure:"url"`
}

func NewLogzioPumpConfig

func NewLogzioPumpConfig() *LogzioPumpConfig

type MoesifConf

type MoesifConf struct {
	EnvPrefix                  string                 `mapstructure:"meta_env_prefix"`
	ApplicationID              string                 `mapstructure:"application_id"`
	RequestHeaderMasks         []string               `mapstructure:"request_header_masks"`
	ResponseHeaderMasks        []string               `mapstructure:"response_header_masks"`
	RequestBodyMasks           []string               `mapstructure:"request_body_masks"`
	ResponseBodyMasks          []string               `mapstructure:"response_body_masks"`
	DisableCaptureRequestBody  bool                   `mapstructure:"disable_capture_request_body"`
	DisableCaptureResponseBody bool                   `mapstructure:"disable_capture_response_body"`
	UserIDHeader               string                 `mapstructure:"user_id_header"`
	CompanyIDHeader            string                 `mapstructure:"company_id_header"`
	EnableBulk                 bool                   `mapstructure:"enable_bulk"`
	BulkConfig                 map[string]interface{} `mapstructure:"bulk_config"`
	AuthorizationHeaderName    string                 `mapstructure:"authorization_header_name"`
	AuthorizationUserIdField   string                 `mapstructure:"authorization_user_id_field"`
}

type MoesifPump

type MoesifPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*MoesifPump) GetEnvPrefix added in v1.3.0

func (p *MoesifPump) GetEnvPrefix() string

func (*MoesifPump) GetName

func (p *MoesifPump) GetName() string

func (*MoesifPump) GetTimeout added in v1.0.0

func (p *MoesifPump) GetTimeout() int

func (*MoesifPump) Init

func (p *MoesifPump) Init(config interface{}) error

func (*MoesifPump) New

func (p *MoesifPump) New() Pump

func (*MoesifPump) SetTimeout added in v1.0.0

func (p *MoesifPump) SetTimeout(timeout int)

func (*MoesifPump) WriteData

func (p *MoesifPump) WriteData(ctx context.Context, data []interface{}) error

type MongoAggregateConf

type MongoAggregateConf struct {
	BaseMongoConf
	UseMixedCollection      bool     `mapstructure:"use_mixed_collection"`
	TrackAllPaths           bool     `mapstructure:"track_all_paths"`
	IgnoreTagPrefixList     []string `mapstructure:"ignore_tag_prefix_list"`
	ThresholdLenTagList     int      `mapstructure:"threshold_len_tag_list"`
	StoreAnalyticsPerMinute bool     `mapstructure:"store_analytics_per_minute"`
	IgnoreAggregationsList  []string `mapstructure:"ignore_aggregations"`
}

type MongoAggregatePump

type MongoAggregatePump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*MongoAggregatePump) GetCollectionName

func (m *MongoAggregatePump) GetCollectionName(orgid string) (string, error)

func (*MongoAggregatePump) GetEnvPrefix added in v1.3.0

func (m *MongoAggregatePump) GetEnvPrefix() string

func (*MongoAggregatePump) GetName

func (m *MongoAggregatePump) GetName() string

func (*MongoAggregatePump) HandleWriteErr

func (m *MongoAggregatePump) HandleWriteErr(err error) error

func (*MongoAggregatePump) Init

func (m *MongoAggregatePump) Init(config interface{}) error

func (*MongoAggregatePump) New

func (m *MongoAggregatePump) New() Pump

func (*MongoAggregatePump) WriteData

func (m *MongoAggregatePump) WriteData(ctx context.Context, data []interface{}) error

func (*MongoAggregatePump) WriteUptimeData

func (m *MongoAggregatePump) WriteUptimeData(data []interface{})

WriteUptimeData will pull the data from the in-memory store and drop it into the specified MongoDB collection

type MongoConf

type MongoConf struct {
	BaseMongoConf

	CollectionName            string `json:"collection_name" mapstructure:"collection_name"`
	MaxInsertBatchSizeBytes   int    `json:"max_insert_batch_size_bytes" mapstructure:"max_insert_batch_size_bytes"`
	MaxDocumentSizeBytes      int    `json:"max_document_size_bytes" mapstructure:"max_document_size_bytes"`
	CollectionCapMaxSizeBytes int    `json:"collection_cap_max_size_bytes" mapstructure:"collection_cap_max_size_bytes"`
	CollectionCapEnable       bool   `json:"collection_cap_enable" mapstructure:"collection_cap_enable"`
}

type MongoPump

type MongoPump struct {
	IsUptime bool

	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*MongoPump) AccumulateSet

func (m *MongoPump) AccumulateSet(data []interface{}) [][]interface{}

func (*MongoPump) GetEnvPrefix added in v1.3.0

func (m *MongoPump) GetEnvPrefix() string

func (*MongoPump) GetName

func (m *MongoPump) GetName() string

func (*MongoPump) Init

func (m *MongoPump) Init(config interface{}) error

func (*MongoPump) New

func (m *MongoPump) New() Pump

func (*MongoPump) WriteData

func (m *MongoPump) WriteData(ctx context.Context, data []interface{}) error

func (*MongoPump) WriteUptimeData

func (m *MongoPump) WriteUptimeData(data []interface{})

WriteUptimeData will pull the data from the in-memory store and drop it into the specified MongoDB collection

type MongoSelectiveConf

type MongoSelectiveConf struct {
	BaseMongoConf
	MaxInsertBatchSizeBytes int `mapstructure:"max_insert_batch_size_bytes"`
	MaxDocumentSizeBytes    int `mapstructure:"max_document_size_bytes"`
}

type MongoSelectivePump

type MongoSelectivePump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*MongoSelectivePump) AccumulateSet

func (m *MongoSelectivePump) AccumulateSet(data []interface{}) [][]interface{}

func (*MongoSelectivePump) GetCollectionName

func (m *MongoSelectivePump) GetCollectionName(orgid string) (string, error)

func (*MongoSelectivePump) GetEnvPrefix added in v1.3.0

func (m *MongoSelectivePump) GetEnvPrefix() string

func (*MongoSelectivePump) GetName

func (m *MongoSelectivePump) GetName() string

func (*MongoSelectivePump) Init

func (m *MongoSelectivePump) Init(config interface{}) error

func (*MongoSelectivePump) New

func (m *MongoSelectivePump) New() Pump

func (*MongoSelectivePump) WriteData

func (m *MongoSelectivePump) WriteData(ctx context.Context, data []interface{}) error

func (*MongoSelectivePump) WriteUptimeData

func (m *MongoSelectivePump) WriteUptimeData(data []interface{})

WriteUptimeData will pull the data from the in-memory store and drop it into the specified MongoDB collection

type MongoType added in v1.0.0

type MongoType int
const (
	StandardMongo MongoType = iota
	AWSDocumentDB
)

type MysqlConfig added in v1.5.0

type MysqlConfig struct {
	// default size for string fields. By default set to: 256
	DefaultStringSize uint `json:"default_string_size" mapstructure:"default_string_size"`
	// disable datetime precision, which not supported before MySQL 5.6
	DisableDatetimePrecision bool `json:"disable_datetime_precision" mapstructure:"disable_datetime_precision"`
	// drop & create when rename index, rename index not supported before MySQL 5.7, MariaDB
	DontSupportRenameIndex bool `json:"dont_support_rename_index" mapstructure:"dont_support_rename_index"`
	// `change` when rename column, rename column not supported before MySQL 8, MariaDB
	DontSupportRenameColumn bool `json:"dont_support_rename_column" mapstructure:"dont_support_rename_column"`
	// auto configure based on currently MySQL version
	SkipInitializeWithVersion bool `json:"skip_initialize_with_version" mapstructure:"skip_initialize_with_version"`
}

type PostgresConfig added in v1.5.0

type PostgresConfig struct {
	// disables implicit prepared statement usage
	PreferSimpleProtocol bool `json:"prefer_simple_protocol" mapstructure:"prefer_simple_protocol"`
}

type PrometheusConf

type PrometheusConf struct {
	EnvPrefix string `mapstructure:"meta_env_prefix"`
	Addr      string `mapstructure:"listen_address"`
	Path      string `mapstructure:"path"`
}

type PrometheusPump

type PrometheusPump struct {

	// Per service
	TotalStatusMetrics  *prometheus.CounterVec
	PathStatusMetrics   *prometheus.CounterVec
	KeyStatusMetrics    *prometheus.CounterVec
	OauthStatusMetrics  *prometheus.CounterVec
	TotalLatencyMetrics *prometheus.HistogramVec

	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*PrometheusPump) GetEnvPrefix added in v1.3.0

func (p *PrometheusPump) GetEnvPrefix() string

func (*PrometheusPump) GetName

func (p *PrometheusPump) GetName() string

func (*PrometheusPump) Init

func (p *PrometheusPump) Init(conf interface{}) error

func (*PrometheusPump) New

func (p *PrometheusPump) New() Pump

func (*PrometheusPump) WriteData

func (p *PrometheusPump) WriteData(ctx context.Context, data []interface{}) error

type Pump

type Pump interface {
	GetName() string
	New() Pump
	Init(interface{}) error
	WriteData(context.Context, []interface{}) error
	SetFilters(analytics.AnalyticsFilters)
	GetFilters() analytics.AnalyticsFilters
	SetTimeout(timeout int)
	GetTimeout() int
	SetOmitDetailedRecording(bool)
	GetOmitDetailedRecording() bool
	GetEnvPrefix() string
	Shutdown() error
	SetMaxRecordSize(size int)
	GetMaxRecordSize() int
}

func GetPumpByName

func GetPumpByName(name string) (Pump, error)

type SQLAggregatePump added in v1.5.0

type SQLAggregatePump struct {
	CommonPumpConfig

	SQLConf *SQLAggregatePumpConf
	// contains filtered or unexported fields
}

func (*SQLAggregatePump) GetEnvPrefix added in v1.5.0

func (c *SQLAggregatePump) GetEnvPrefix() string

func (*SQLAggregatePump) GetName added in v1.5.0

func (c *SQLAggregatePump) GetName() string

func (*SQLAggregatePump) Init added in v1.5.0

func (c *SQLAggregatePump) Init(conf interface{}) error

func (*SQLAggregatePump) New added in v1.5.0

func (c *SQLAggregatePump) New() Pump

func (*SQLAggregatePump) WriteData added in v1.5.0

func (c *SQLAggregatePump) WriteData(ctx context.Context, data []interface{}) error

WriteData aggregates and writes the passed data to SQL database. When table sharding is enabled, startIndex and endIndex are found by checking timestamp of the records. The main for loop iterates and finds the index where a new day starts. Then, the data is passed to AggregateData function and written to database day by day on different tables. However, if table sharding is not enabled, the for loop iterates one time and all data is passed at once to the AggregateData function and written to database on single table.

type SQLAggregatePumpConf added in v1.5.0

type SQLAggregatePumpConf struct {
	SQLConf `mapstructure:",squash"`

	EnvPrefix               string   `mapstructure:"meta_env_prefix"`
	TrackAllPaths           bool     `mapstructure:"track_all_paths"`
	IgnoreTagPrefixList     []string `mapstructure:"ignore_tag_prefix_list"`
	ThresholdLenTagList     int      `mapstructure:"threshold_len_tag_list"`
	StoreAnalyticsPerMinute bool     `mapstructure:"store_analytics_per_minute"`
	IgnoreAggregationsList  []string `mapstructure:"ignore_aggregations"`
}

type SQLConf added in v1.5.0

type SQLConf struct {
	EnvPrefix        string         `mapstructure:"meta_env_prefix"`
	Type             string         `json:"type" mapstructure:"type"`
	ConnectionString string         `json:"connection_string" mapstructure:"connection_string"`
	Postgres         PostgresConfig `json:"postgres" mapstructure:"postgres"`
	Mysql            MysqlConfig    `json:"mysql" mapstructure:"mysql"`
	TableSharding    bool           `json:"table_sharding" mapstructure:"table_sharding"`
	LogLevel         string         `json:"log_level" mapstructure:"log_level"`
	BatchSize        int            `json:"batch_size" mapstructure:"batch_size"`
}

type SQLPump added in v1.5.0

type SQLPump struct {
	CommonPumpConfig
	IsUptime bool

	SQLConf *SQLConf
	// contains filtered or unexported fields
}

func (*SQLPump) GetEnvPrefix added in v1.5.0

func (c *SQLPump) GetEnvPrefix() string

func (*SQLPump) GetName added in v1.5.0

func (c *SQLPump) GetName() string

func (*SQLPump) Init added in v1.5.0

func (c *SQLPump) Init(conf interface{}) error

func (*SQLPump) New added in v1.5.0

func (c *SQLPump) New() Pump

func (*SQLPump) WriteData added in v1.5.0

func (c *SQLPump) WriteData(ctx context.Context, data []interface{}) error

func (*SQLPump) WriteUptimeData added in v1.5.0

func (c *SQLPump) WriteUptimeData(data []interface{})

type SegmentConf

type SegmentConf struct {
	EnvPrefix string `mapstructure:"meta_env_prefix"`
	WriteKey  string `mapstructure:"segment_write_key"`
}

type SegmentPump

type SegmentPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*SegmentPump) GetEnvPrefix added in v1.3.0

func (s *SegmentPump) GetEnvPrefix() string

func (*SegmentPump) GetName

func (s *SegmentPump) GetName() string

func (*SegmentPump) Init

func (s *SegmentPump) Init(config interface{}) error

func (*SegmentPump) New

func (s *SegmentPump) New() Pump

func (*SegmentPump) ToJSONMap

func (s *SegmentPump) ToJSONMap(obj interface{}) (map[string]interface{}, error)

func (*SegmentPump) WriteData

func (s *SegmentPump) WriteData(ctx context.Context, data []interface{}) error

func (*SegmentPump) WriteDataRecord

func (s *SegmentPump) WriteDataRecord(record analytics.AnalyticsRecord) error

type SplunkClient

type SplunkClient struct {
	Token         string
	CollectorURL  string
	TLSSkipVerify bool
	// contains filtered or unexported fields
}

SplunkClient contains Splunk client methods.

func NewSplunkClient

func NewSplunkClient(token string, collectorURL string, skipVerify bool, certFile string, keyFile string, serverName string) (c *SplunkClient, err error)

NewSplunkClient initializes a new SplunkClient.

func (*SplunkClient) Send

func (c *SplunkClient) Send(ctx context.Context, data []byte) (*http.Response, error)

Send sends an event to the Splunk HTTP Event Collector interface.

type SplunkPump

type SplunkPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

SplunkPump is a Tyk Pump driver for Splunk.

func (*SplunkPump) FilterTags added in v1.5.0

func (p *SplunkPump) FilterTags(filteredTags []string) []string

Filters the tags based on config rule

func (*SplunkPump) GetEnvPrefix added in v1.3.0

func (p *SplunkPump) GetEnvPrefix() string

func (*SplunkPump) GetName

func (p *SplunkPump) GetName() string

GetName returns the pump name.

func (*SplunkPump) Init

func (p *SplunkPump) Init(config interface{}) error

Init performs the initialization of the SplunkClient.

func (*SplunkPump) New

func (p *SplunkPump) New() Pump

New initializes a new pump.

func (*SplunkPump) WriteData

func (p *SplunkPump) WriteData(ctx context.Context, data []interface{}) error

WriteData prepares an appropriate data structure and sends it to the HTTP Event Collector.

type SplunkPumpConfig

type SplunkPumpConfig struct {
	EnvPrefix              string   `mapstructure:"meta_env_prefix"`
	CollectorToken         string   `mapstructure:"collector_token"`
	CollectorURL           string   `mapstructure:"collector_url"`
	SSLInsecureSkipVerify  bool     `mapstructure:"ssl_insecure_skip_verify"`
	SSLCertFile            string   `mapstructure:"ssl_cert_file"`
	SSLKeyFile             string   `mapstructure:"ssl_key_file"`
	SSLServerName          string   `mapstructure:"ssl_server_name"`
	ObfuscateAPIKeys       bool     `mapstructure:"obfuscate_api_keys"`
	ObfuscateAPIKeysLength int      `mapstructure:"obfuscate_api_keys_length"`
	Fields                 []string `mapstructure:"fields"`
	IgnoreTagPrefixList    []string `mapstructure:"ignore_tag_prefix_list"`
	EnableBatch            bool     `mapstructure:"enable_batch"`
	BatchMaxContentLength  int      `mapstructure:"batch_max_content_length"`
}

SplunkPumpConfig contains the driver configuration parameters.

type StatsdConf

type StatsdConf struct {
	EnvPrefix string   `mapstructure:"meta_env_prefix"`
	Address   string   `mapstructure:"address"`
	Fields    []string `mapstructure:"fields"`
	Tags      []string `mapstructure:"tags"`
}

type StatsdPump

type StatsdPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*StatsdPump) GetEnvPrefix added in v1.3.0

func (s *StatsdPump) GetEnvPrefix() string

func (*StatsdPump) GetName

func (s *StatsdPump) GetName() string

func (*StatsdPump) Init

func (s *StatsdPump) Init(config interface{}) error

func (*StatsdPump) New

func (s *StatsdPump) New() Pump

func (*StatsdPump) WriteData

func (s *StatsdPump) WriteData(ctx context.Context, data []interface{}) error

type StdOutConf added in v1.4.0

type StdOutConf struct {
	EnvPrefix    string `mapstructure:"meta_env_prefix"`
	Format       string `mapstructure:"format"`
	LogFieldName string `mapstructure:"log_field_name"`
}

type StdOutPump added in v1.4.0

type StdOutPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*StdOutPump) GetEnvPrefix added in v1.4.0

func (s *StdOutPump) GetEnvPrefix() string

func (*StdOutPump) GetName added in v1.4.0

func (s *StdOutPump) GetName() string

func (*StdOutPump) Init added in v1.4.0

func (s *StdOutPump) Init(config interface{}) error

func (*StdOutPump) New added in v1.4.0

func (s *StdOutPump) New() Pump

func (*StdOutPump) WriteData added in v1.4.0

func (s *StdOutPump) WriteData(ctx context.Context, data []interface{}) error

* ** Write the actual Data to Stdout Here

type SyslogConf added in v1.2.0

type SyslogConf struct {
	EnvPrefix   string `mapstructure:"meta_env_prefix"`
	Transport   string `mapstructure:"transport"`
	NetworkAddr string `mapstructure:"network_addr"`
	LogLevel    int    `mapstructure:"log_level"`
	Tag         string `mapstructure:"tag"`
}

type SyslogPump added in v1.2.0

type SyslogPump struct {
	CommonPumpConfig
	// contains filtered or unexported fields
}

func (*SyslogPump) GetEnvPrefix added in v1.3.0

func (s *SyslogPump) GetEnvPrefix() string

func (*SyslogPump) GetFilters added in v1.2.0

func (s *SyslogPump) GetFilters() analytics.AnalyticsFilters

func (*SyslogPump) GetName added in v1.2.0

func (s *SyslogPump) GetName() string

func (*SyslogPump) GetTimeout added in v1.2.0

func (s *SyslogPump) GetTimeout() int

func (*SyslogPump) Init added in v1.2.0

func (s *SyslogPump) Init(config interface{}) error

func (*SyslogPump) New added in v1.2.0

func (s *SyslogPump) New() Pump

func (*SyslogPump) SetFilters added in v1.2.0

func (s *SyslogPump) SetFilters(filters analytics.AnalyticsFilters)

func (*SyslogPump) SetTimeout added in v1.2.0

func (s *SyslogPump) SetTimeout(timeout int)

func (*SyslogPump) WriteData added in v1.2.0

func (s *SyslogPump) WriteData(ctx context.Context, data []interface{}) error

* ** Write the actual Data to Syslog Here

type UptimePump added in v1.5.0

type UptimePump interface {
	GetName() string
	Init(interface{}) error
	WriteUptimeData(data []interface{})
}

Jump to

Keyboard shortcuts

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