tilegroxy Docs
Requires a postgresql datastore to supply the connection.

Table Setup

Tilegroxy never issues DDL so you must create the table yourself before starting tilegroxy. This keeps the credentials tilegroxy uses free of schema privileges.

The following matches the default column names:

CREATE TABLE tilegroxy_analytics (
    time      TIMESTAMPTZ NOT NULL,
    layer     TEXT        NOT NULL,
    z         INTEGER     NOT NULL,
    x         INTEGER     NOT NULL,
    y         INTEGER     NOT NULL,
    user_id   TEXT,
    extra     JSONB
);

CREATE INDEX ON tilegroxy_analytics (layer, time);

The extra column receives everything selected via fields and extraFields as a JSON object. JSONB is used instead of dedicated columns so that changing which fields you collect doesn’t require a schema migration.

Tilegroxy does not expire events so this table grows unbounded. It is recommended you partition it by time and drop old partitions on a schedule.

Also accepts the batching parameters shared by every analytics module.

Example

  • YAML

  • JSON

datastores:
  - name: postgresql
    id: pg-analytics
    host: localhost
    user: tilegroxy
    password: env.PGPASSWORD
    database: analytics

analytics:
  name: postgresql
  datastore: pg-analytics
  table: tilegroxy_analytics
  fields:
    - duration
    - contenttype
  extraFields:
    environment: production
{
  "datastores": [
    {
      "name": "postgresql",
      "id": "pg-analytics",
      "host": "localhost",
      "user": "tilegroxy",
      "password": "env.PGPASSWORD",
      "database": "analytics"
    }
  ],
  "analytics": {
    "name": "postgresql",
    "datastore": "pg-analytics",
    "table": "tilegroxy_analytics",
    "fields": [
      "duration",
      "contenttype"
    ],
    "extraFields": {
      "environment": "production"
    }
  }
}

Configuration

Configuration options
Parameter Description Type Required Default

Datastore

The ID of the datastore to use. The datastore must have a type of postgresql. Also see the Datastores documentation.

string

Yes

None

Table

The table to insert events into. May be schema qualified. Must be a plain identifier

string

Yes

None

ID

An identifier for this destination, used in logs to attribute analytics messages

string

No

postgresql

Columns

Overrides for the default column names. Keys are the logical field names: time, layer, z, x, y, user_id, extra

map[string]string

No

None

Fields

Additional attributes to record. See Analytics

string[]

No

None

ExtraFields

Arbitrary additional attributes. See Analytics

map[string]string

No

None