github.com/TykTechnologies/tyk-pump
No package summary is available.
Package
Files: 4. Third party imports: 4. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Constants
Vars
Types
PumpConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Name |
|
The name of the pump. This is used to identify the pump in the logs.
Deprecated, use |
| Type |
|
Sets the pump type. This is needed when the pump key does not equal to the pump name type.
Current valid types are: |
| Filters |
|
This feature adds a new configuration field in each pump called filters and its structure is the following:
The fields api_ids, org_ids and response_codes works as allow list (APIs and orgs where we want to send the analytics records) and the fields skip_api_ids, skip_org_ids and skip_response_codes works as block list. The priority is always block list configurations over allow list. An example of configuration would be:
|
| Timeout |
|
By default, a pump will wait forever for each write operation to complete; you can configure an optional timeout by setting the configuration option The timeout is configured within the main pump config as shown here; note that this example would configure a 5 second timeout:
Tyk will inform you if the pump's write operation is taking longer than the purging loop (configured via If there is no timeout configured and pump's write operation is taking longer than the purging loop, the following warning log will be generated:
If there is a timeout configured, but pump's write operation is still taking longer than the purging loop, the following warning log will be generated:
|
| OmitDetailedRecording |
|
Setting this to true will avoid writing raw_request and raw_response fields for each request
in pumps. Defaults to |
| MaxRecordSize |
|
Defines maximum size (in bytes) for Raw Request and Raw Response logs, this value defaults to 0. If it is not set then tyk-pump will not trim any data and will store the full information. This can also be set at a pump level. For example:
|
| IgnoreFields |
|
IgnoreFields defines a list of analytics fields that will be ignored when writing to the pump.
This can be used to avoid writing sensitive information to the Database, or data that you don't really need to have.
The field names must be the same as the JSON tags of the analytics record fields.
For example: |
| Meta |
|
Meta is a map of configuration values that are specific to each pump. For example, the
|
| DecodeRawRequest |
|
Setting this to true allows the Raw Request to be decoded from base 64 for all pumps. This is set to false by default. |
| DecodeRawResponse |
|
Setting this to true allows the Raw Response to be decoded from base 64 for all pumps. This is set to false by default. |
StatsDSink
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| options |
|
No comment on field. |
| cmdChan |
|
No comment on field. |
| drainDoneChan |
|
No comment on field. |
| stopDoneChan |
|
No comment on field. |
| flushPeriod |
|
No comment on field. |
| udpBuf |
|
No comment on field. |
| timingBuf |
|
No comment on field. |
| udpConn |
|
No comment on field. |
| udpAddr |
|
No comment on field. |
| prefixBuffers |
|
map of {job,event,suffix} to a re-usable buffer prefixed with the key. Since each timing/gauge has a unique component (the time), we'll truncate to the prefix, write the timing, and write the statsD suffix (eg, "|ms\n"). Then copy that to the UDP buffer. |
StatsDSinkOptions
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Prefix |
|
Prefix is something like "metroid" Events emitted to StatsD would be metroid.myevent.wat Eg, don't include a trailing dot in the prefix. It can be "", that's fine. |
| SanitizationFunc |
|
SanitizationFunc sanitizes jobs and events before sending them to statsd |
| SkipNestedEvents |
|
SkipNestedEvents will skip {events,timers,gauges} from sending the job.event version and will only send the event version. |
| SkipTopLevelEvents |
|
SkipTopLevelEvents will skip {events,timers,gauges} from sending the event version and will only send the job.event version. |
StatsDSinkSanitizationFunc
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
TykPumpConfiguration
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| PurgeDelay |
|
The number of seconds the Pump waits between checking for analytics data and purge it from Redis. |
| PurgeChunk |
|
The maximum number of records to pull from Redis at a time. If it's unset or |
| StorageExpirationTime |
|
The number of seconds for the analytics records TTL. It only works if |
| DontPurgeUptimeData |
|
Setting this to |
| UptimePumpConfig |
|
Example Uptime Pump configuration:
|
| Pumps |
|
The default environment variable prefix for each pump follows this format:
You can also set custom names for each pump specifying the pump type. For example, if you
want a Kafka pump which is called |
| AnalyticsStorageType |
|
Sets the analytics storage type. Where the pump will be fetching data from. Currently, only
the |
| AnalyticsStorageConfig |
|
Example Temporal storage configuration:
|
| StatsdConnectionString |
|
Connection string for StatsD monitoring for information please see the Instrumentation docs. |
| StatsdPrefix |
|
Custom prefix value. For example separate settings for production and staging. |
| LogLevel |
|
Set the logger details for tyk-pump. The posible values are: |
| LogFormat |
|
Set the logger format. The possible values are: |
| HealthCheckEndpointName |
|
TYKCONFIGHEADERSTART
HEADER Health Check
From v2.9.4, we have introduced a |
| HealthCheckEndpointPort |
|
The default port is 8083. |
| OmitDetailedRecording |
|
Setting this to true will avoid writing raw_request and raw_response fields for each request in pumps. Defaults to false. |
| MaxRecordSize |
|
Defines maximum size (in bytes) for Raw Request and Raw Response logs, this value defaults to 0. If it is not set then tyk-pump will not trim any data and will store the full information. This can also be set at a pump level. For example:
|
| OmitConfigFile |
|
Defines if tyk-pump should ignore all the values in configuration file. Specially useful when setting all configurations in environment variables. |
| HTTPProfile |
|
Enable debugging of Tyk Pump by exposing profiling information, the same as the gateway https://tyk.io/docs/troubleshooting/tyk-gateway/profiling/ |
| DecodeRawRequest |
|
Setting this to true allows the Raw Request to be decoded from base 64 for all pumps. This is set to false by default. |
| DecodeRawResponse |
|
Setting this to true allows the Raw Response to be decoded from base 64 for all pumps. This is set to false by default. |
UptimeConf
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
|
TYKCONFIGHEADERSTART
HEADER Mongo Uptime Pump
In
|
|
|
TYKCONFIGHEADERSTART HEADER SQL Uptime Pump Supported in Tyk Pump v1.5.0+ In An example of a SQL Postgres uptime pump would be:
Take into account that you can also set |
|
| UptimeType |
|
Determines the uptime type. Options are |
eventKey
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| job |
|
No comment on field. |
| event |
|
No comment on field. |
| suffix |
|
No comment on field. |
prefixBuffer
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
|
No comment on field. | |
| prefixLen |
|
No comment on field. |
statsdCmdKind
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
statsdEmitCmd
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Kind |
|
No comment on field. |
| Job |
|
No comment on field. |
| Event |
|
No comment on field. |
| Nanos |
|
No comment on field. |
| Value |
|
No comment on field. |
| Status |
|
No comment on field. |
Functions
func Init
func LoadConfig
func MonitorApplicationInstrumentation
func NewStatsDSink
func PreprocessAnalyticsValues
func SetupInstrumentation
SetupInstrumentation handles all the intialisation of the instrumentation handler
Uses: os.Getenv.func StartPurgeLoop
func (*StatsDSink) Drain
func (*StatsDSink) EmitComplete
func (*StatsDSink) EmitEvent
func (*StatsDSink) EmitEventErr
func (*StatsDSink) EmitGauge
func (*StatsDSink) EmitTiming
func (*StatsDSink) Stop
func (*TykPumpConfiguration) LoadPumpsByEnv
Private functions
func checkShutdown
func execPumpWriting
func filterData
func initialisePumps
func initialiseUptimePump
func main
func sanitizeKey
func setupAnalyticsStore
func storeVersion
func writeToPumps
func flush
func getPrefixBuffer
func loop
func processCmd
func processComplete
func processEvent
func processEventErr
func processGauge
func processTiming
func writeNanosToTimingBuf
func writeSanitizedKeys
func writeStatsDMetric
assumes b is a well-formed statsd metric like "job.event:1|c\n" (including newline)
func shouldOmitConfigFile
Tests
Files: 2. Third party imports: 1. Imports from organisation: 2. Tests: 12. Benchmarks: 0.
Types
MockedPump
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| CounterRequest |
|
No comment on field. |
| TurnedOff |
|
No comment on field. |
|
No comment on field. |