github.com/TykTechnologies/tyk-pump/analytics
No package summary is available.
Package
Files: 4. Third party imports: 5. Imports from organisation: 1. Tests: 0. Benchmarks: 0.
Constants
Vars
GraphSQLTableName should be defined before SQL migration is called on the GraphRecord the reason this approach is used to define the table name is due to gorm's inability to read values from the fields of the GraphRecord/AnalyticsRecord struct when it is migrating, due to that a single static value is going to be returned as TableName and it will be used as the prefix for index/relationship creation no matter the value passed to db.Table()
lastDocumentTimestamp is a map to store the last document timestamps of different Mongo Aggregators
mutex is used to prevent concurrent writes to the same key
Types
AggregateFieldList
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| APIKeys |
|
No comment on field. |
| APIID |
|
No comment on field. |
| OauthIDs |
|
No comment on field. |
| Geo |
|
No comment on field. |
| Tags |
|
No comment on field. |
| Errors |
|
No comment on field. |
| Endpoints |
|
No comment on field. |
| KeyEndpoint |
|
No comment on field. |
| OauthEndpoint |
|
No comment on field. |
| APIEndpoint |
|
No comment on field. |
AnalyticsFilters
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| OrgsIDs |
|
Filters pump data by an allow list of org_ids. |
| APIIDs |
|
Filters pump data by an allow list of api_ids. |
| ResponseCodes |
|
Filters pump data by an allow list of response_codes. |
| SkippedOrgsIDs |
|
Filters pump data by a block list of org_ids. |
| SkippedAPIIDs |
|
Filters pump data by a block list of api_ids. |
| SkippedResponseCodes |
|
Filters pump data by a block list of response_codes. |
AnalyticsRecord
AnalyticsRecord encodes the details of a request
| Field name | Field type | Comment |
|---|---|---|
| id |
|
No comment on field. |
| Method |
|
No comment on field. |
| Host |
|
No comment on field. |
| Path |
|
No comment on field. |
| RawPath |
|
No comment on field. |
| ContentLength |
|
No comment on field. |
| UserAgent |
|
No comment on field. |
| Day |
|
No comment on field. |
| Month |
|
No comment on field. |
| Year |
|
No comment on field. |
| Hour |
|
No comment on field. |
| ResponseCode |
|
No comment on field. |
| APIKey |
|
No comment on field. |
| TimeStamp |
|
No comment on field. |
| APIVersion |
|
No comment on field. |
| APIName |
|
No comment on field. |
| APIID |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| OauthID |
|
No comment on field. |
| RequestTime |
|
No comment on field. |
| RawRequest |
|
No comment on field. |
| RawResponse |
|
No comment on field. |
| IPAddress |
|
No comment on field. |
| Geo |
|
No comment on field. |
| Network |
|
No comment on field. |
| Latency |
|
No comment on field. |
| Tags |
|
No comment on field. |
| Alias |
|
No comment on field. |
| TrackPath |
|
No comment on field. |
| ExpireAt |
|
No comment on field. |
| ApiSchema |
|
No comment on field. |
| GraphQLStats |
|
No comment on field. |
| CollectionName |
|
No comment on field. |
AnalyticsRecordAggregate
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| id |
|
No comment on field. |
| TimeStamp |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| TimeID |
|
No comment on field. |
| APIKeys |
|
No comment on field. |
| Errors |
|
No comment on field. |
| Versions |
|
No comment on field. |
| APIID |
|
No comment on field. |
| OauthIDs |
|
No comment on field. |
| Geo |
|
No comment on field. |
| Tags |
|
No comment on field. |
| Endpoints |
|
No comment on field. |
| Lists |
|
No comment on field. |
| KeyEndpoint |
|
No comment on field. |
| OauthEndpoint |
|
No comment on field. |
| ApiEndpoint |
|
No comment on field. |
| Total |
|
No comment on field. |
| ExpireAt |
|
No comment on field. |
| LastTime |
|
No comment on field. |
| Mixed |
|
No comment on field. |
City
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| GeoNameID |
|
No comment on field. |
| Names |
|
No comment on field. |
Code
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Code1x |
|
No comment on field. |
| Code200 |
|
No comment on field. |
| Code201 |
|
No comment on field. |
| Code2x |
|
No comment on field. |
| Code301 |
|
No comment on field. |
| Code302 |
|
No comment on field. |
| Code303 |
|
No comment on field. |
| Code304 |
|
No comment on field. |
| Code3x |
|
No comment on field. |
| Code400 |
|
No comment on field. |
| Code401 |
|
No comment on field. |
| Code403 |
|
No comment on field. |
| Code404 |
|
No comment on field. |
| Code429 |
|
No comment on field. |
| Code4x |
|
No comment on field. |
| Code500 |
|
No comment on field. |
| Code501 |
|
No comment on field. |
| Code502 |
|
No comment on field. |
| Code503 |
|
No comment on field. |
| Code504 |
|
No comment on field. |
| Code5x |
|
No comment on field. |
Counter
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Hits |
|
No comment on field. |
| Success |
|
No comment on field. |
| ErrorTotal |
|
No comment on field. |
| RequestTime |
|
No comment on field. |
| TotalRequestTime |
|
No comment on field. |
| Identifier |
|
No comment on field. |
| HumanIdentifier |
|
No comment on field. |
| LastTime |
|
No comment on field. |
| OpenConnections |
|
No comment on field. |
| ClosedConnections |
|
No comment on field. |
| BytesIn |
|
No comment on field. |
| BytesOut |
|
No comment on field. |
| MaxUpstreamLatency |
|
No comment on field. |
| MinUpstreamLatency |
|
No comment on field. |
| TotalUpstreamLatency |
|
No comment on field. |
| UpstreamLatency |
|
No comment on field. |
| MaxLatency |
|
No comment on field. |
| MinLatency |
|
No comment on field. |
| TotalLatency |
|
No comment on field. |
| Latency |
|
No comment on field. |
| ErrorMap |
|
No comment on field. |
| ErrorList |
|
No comment on field. |
Country
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ISOCode |
|
No comment on field. |
Dimension
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Name |
|
No comment on field. |
| Value |
|
No comment on field. |
| Counter |
|
No comment on field. |
ErrorData
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Code |
|
No comment on field. |
| Count |
|
No comment on field. |
GeoData
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Country |
|
No comment on field. |
| City |
|
No comment on field. |
| Location |
|
No comment on field. |
GraphError
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Message |
|
No comment on field. |
| Path |
|
No comment on field. |
GraphQLOperations
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
GraphQLStats
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Variables |
|
No comment on field. |
| RootFields |
|
No comment on field. |
| Types |
|
No comment on field. |
| Errors |
|
No comment on field. |
| OperationType |
|
No comment on field. |
| HasErrors |
|
No comment on field. |
| IsGraphQL |
|
No comment on field. |
GraphRecord
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Types |
|
No comment on field. |
| AnalyticsRecord |
|
No comment on field. |
| OperationType |
|
No comment on field. |
| Variables |
|
No comment on field. |
| RootFields |
|
No comment on field. |
| Errors |
|
No comment on field. |
| HasErrors |
|
No comment on field. |
GraphRecordAggregate
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
|
No comment on field. | |
| Types |
|
No comment on field. |
| Fields |
|
No comment on field. |
| Operation |
|
No comment on field. |
| RootFields |
|
No comment on field. |
GraphSQLAnalyticsRecordAggregate
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| Dimension |
|
No comment on field. |
| DimensionValue |
|
No comment on field. |
| APIID |
|
No comment on field. |
|
No comment on field. | |
|
No comment on field. | |
| TimeStamp |
|
No comment on field. |
Latency
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Total |
|
No comment on field. |
| Upstream |
|
No comment on field. |
Location
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Latitude |
|
No comment on field. |
| Longitude |
|
No comment on field. |
| TimeZone |
|
No comment on field. |
NetworkStats
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| OpenConnections |
|
No comment on field. |
| ClosedConnection |
|
No comment on field. |
| BytesIn |
|
No comment on field. |
| BytesOut |
|
No comment on field. |
SQLAnalyticsRecordAggregate
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
|
No comment on field. | |
| TimeStamp |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| Dimension |
|
No comment on field. |
| DimensionValue |
|
No comment on field. |
|
No comment on field. |
UptimeReportAggregate
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| TimeStamp |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| TimeID |
|
No comment on field. |
| URL |
|
No comment on field. |
| Errors |
|
No comment on field. |
| Total |
|
No comment on field. |
| ExpireAt |
|
No comment on field. |
| LastTime |
|
No comment on field. |
UptimeReportAggregateSQL
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
|
No comment on field. | |
| TimeStamp |
|
No comment on field. |
| OrgID |
|
No comment on field. |
| Dimension |
|
No comment on field. |
| DimensionValue |
|
No comment on field. |
|
No comment on field. |
UptimeReportData
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
| URL |
|
No comment on field. |
| RequestTime |
|
No comment on field. |
| ResponseCode |
|
No comment on field. |
| TCPError |
|
No comment on field. |
| ServerError |
|
No comment on field. |
| Day |
|
No comment on field. |
| Month |
|
No comment on field. |
| Year |
|
No comment on field. |
| Hour |
|
No comment on field. |
| Minute |
|
No comment on field. |
| TimeStamp |
|
No comment on field. |
| ExpireAt |
|
No comment on field. |
| APIID |
|
No comment on field. |
| OrgID |
|
No comment on field. |
Functions
func AggregateData
AggregateData calculates aggregated data, returns map orgID => aggregated analytics data
func AggregateGraphData
AggregateGraphData collects the graph records into a map of GraphRecordAggregate to apiID
Uses: fmt.Sprintf.func AggregateUptimeData
func GeoIPLookup
func NewGraphRecordAggregate
func OnConflictAssignments
func OnConflictUptimeAssignments
func SetlastTimestampAgggregateRecord
SetlastTimestampAgggregateRecord sets the last timestamp for the aggregate record
func TrimTag
func (*AnalyticsRecord) GetFieldNames
func (*AnalyticsRecord) GetGeo
func (*AnalyticsRecord) GetLineValues
func (*AnalyticsRecord) GetObjectID
func (*AnalyticsRecord) IsGraphRecord
func (*AnalyticsRecord) RemoveIgnoredFields
func (*AnalyticsRecord) SetExpiry
func (*AnalyticsRecord) SetObjectID
func (*AnalyticsRecord) TableName
func (*AnalyticsRecord) TimeStampFromProto
func (*AnalyticsRecord) TimestampToProto
TimestampToProto will process timestamps and assign them to the proto record protobuf converts all timestamps to UTC so we need to ensure that we keep the same original location, in order to do so, we store the location
Uses: timestamppb.New.func (*AnalyticsRecord) ToGraphRecord
func (*AnalyticsRecord) TrimRawData
func (*AnalyticsRecordAggregate) AsChange
func (*AnalyticsRecordAggregate) AsTimeUpdate
func (*AnalyticsRecordAggregate) Dimensions
func (*AnalyticsRecordAggregate) DiscardAggregations
DiscardAggregations this method discard the aggregations of X field specified in the aggregated pump configuration
Uses: logrus.Fields.func (*AnalyticsRecordAggregate) GetObjectID
func (*AnalyticsRecordAggregate) SetErrorList
func (*AnalyticsRecordAggregate) SetObjectID
func (*AnalyticsRecordAggregate) TableName
func (*Code) ProcessStatusCodes
func (*GeoData) GetFieldNames
func (*GeoData) GetLineValues
func (*GraphRecord) GetObjectID
GetObjectID is a dummy function to satisfy the interface
func (*GraphRecord) SetObjectID
SetObjectID is a dummy function to satisfy the interface
func (*GraphRecord) TableName
TableName is used by both the sql orm and mongo driver the table name and collection name used for operations on this model the conditional return is to ensure the right value is used for both the sql and mongo operations
func (*GraphRecordAggregate) Dimensions
func (*Latency) GetFieldNames
func (*Latency) GetLineValues
func (*NetworkStats) Flush
func (*NetworkStats) GetFieldNames
func (*NetworkStats) GetLineValues
func (*SQLAnalyticsRecordAggregate) TableName
func (*UptimeReportAggregate) Dimensions
func (*UptimeReportAggregateSQL) TableName
func (*UptimeReportData) GetObjectID
func (*UptimeReportData) SetObjectID
func (*UptimeReportData) TableName
func (AnalyticsFilters) HasFilter
func (AnalyticsFilters) ShouldFilter
func (AnalyticsRecordAggregate) New
func (UptimeReportAggregate) New
Private functions
func doHash
func fnLatencySetter
func getLastDocumentTimestamp
getLastDocumentTimestamp gets the last timestamp for the aggregate record
func ignoreTag
func incrementAggregate
incrementAggregate increments the analytic record aggregate fields using the analytics record
References: hex.EncodeToString, strconv.Itoa, structs.Map.func incrementOrSetUnit
incrementOrSetUnit is a Mini function to handle incrementing a specific counter in our object
func intInSlice
func replaceUnsupportedChars
func setAggregateTimestamp
func stringInSlice
func trimString
func generateBSONFromProperty
func generateSetterForTime
func getRecords
func latencySetter
Tests
Files: 5. Third party imports: 6. Imports from organisation: 1. Tests: 32. Benchmarks: 0.