Documentation

Overview

    Package analytics provides the methods to run an analytics reporting system for API requests which may be useful to users for measuring access and possibly identifying bad actors abusing requests.

    Index

    Constants

    View Source
    const RANGE = 14

      RANGE determines the number of days ponzu request analytics and metrics are stored and displayed within the system

      Variables

      This section is empty.

      Functions

      func Backup

      func Backup(ctx context.Context, res http.ResponseWriter) error

        Backup writes a snapshot of the system.db database to an HTTP response. The output is discarded if we get a cancellation signal.

        func ChartData

        func ChartData() (map[string]interface{}, error)

          ChartData returns the map containing decoded javascript needed to chart RANGE days of data by day

          func Close

          func Close()

            Close exports the abillity to close our db file. Should be called with defer after call to Init() from the same place.

            func Init

            func Init()

              Init creates a db connection, initializes the db with schema and data and sets up the queue/batching channel

              func Record

              func Record(req *http.Request)

                Record queues an apiRequest for metrics

                Types

                This section is empty.