github.com/titpetric/microservice/server/stats
No package summary is available.
Package
Files: 7. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Constants
Vars
IncomingFields are all the field names in the DB table
IncomingPrimaryFields are the primary key fields in the DB table
IncomingProcFields are all the field names in the DB table
IncomingProcPrimaryFields are the primary key fields in the DB table
MigrationsFields are all the field names in the DB table
MigrationsPrimaryFields are the primary key fields in the DB table
Keep returning a single object to avoid allocations
Types
Flusher
Flusher is a context-driven background data flush job
| Field name | Field type | Comment |
|---|---|---|
|
No comment on field. | |
| finish |
|
No comment on field. |
| enabled |
|
No comment on field. |
| queueIndex |
|
queueIndex is a key for []queues |
| queueMask |
|
queueMask is a masking value for queueIndex -> key |
| queues |
|
queues hold a set of writable queues |
| db |
|
No comment on field. |
Incoming
Incoming generated for db table incoming
Incoming stats log, writes only
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
Tracking ID |
| Property |
|
Property name (human readable, a-z) |
| PropertySection |
|
Property Section ID |
| PropertyID |
|
Property Item ID |
| RemoteIP |
|
Remote IP from user making request |
| Stamp |
|
Timestamp of request |
IncomingProc
IncomingProc generated for db table incoming_proc
Incoming stats log, writes only
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
Tracking ID |
| Property |
|
Property name (human readable, a-z) |
| PropertySection |
|
Property Section ID |
| PropertyID |
|
Property Item ID |
| RemoteIP |
|
Remote IP from user making request |
| Stamp |
|
Timestamp of request |
Migrations
Migrations generated for db table migrations
| Field name | Field type | Comment |
|---|---|---|
| Project |
|
Microservice or project name |
| Filename |
|
yyyy-mm-dd-HHMMSS.sql |
| StatementIndex |
|
Statement number from SQL file |
| Status |
|
ok or full error message |
Queue
Queue provides a queuing structure for Incoming{}
| Field name | Field type | Comment |
|---|---|---|
|
No comment on field. | |
| values |
|
No comment on field. |
Server
Server implements stats.StatsService
| Field name | Field type | Comment |
|---|---|---|
| db |
|
No comment on field. |
| sonyflake |
|
No comment on field. |
| flusher |
|
No comment on field. |
Functions
func New
func NewFlusher
NewFlusher creates a *Flusher
Uses: atomic.NewBool, atomic.NewUint32, context.Background, context.WithCancel.func NewQueue
NewQueue creates a new *Queue instance
func NewQueues
NewQueues creates a slice of *Queue instances
func (*Flusher) Push
Push spreads queue writes evenly across all queues
func (*Incoming) SetStamp
SetStamp sets Stamp which requires a *time.Time
func (*IncomingProc) SetStamp
SetStamp sets Stamp which requires a *time.Time
func (*Queue) Clear
Clear returns current queue items and clears it
func (*Queue) Length
Length returns the current queue size
func (*Queue) Push
Push adds a new item to the queue
func (*Server) Push
Push a record to the incoming log table
Uses: errors.New, time.Now.func (*Server) Shutdown
Shutdown is a cleanup hook after SIGTERM
Private functions
func flush
func run
Tests
Files: 1. Third party imports: 0. Imports from organisation: 0. Tests: 1. Benchmarks: 0.