Skills Getting started Skills GitLab Hub

analytics-instrument

Use when adding a new SlopKit Analytics event or metric to a product — pick a name and schema, implement the track or metric call, write the catalog file, then add a dedicated panel page. After the name exists, use analytics-page for the page. Do not invent generic views that already exist on /events and /metrics.

Synopsis

The YAML description states when to use this skill. disable-model-invocation is unset.

Source file: skills/analytics-instrument/SKILL.md.

Front matter

name
analytics-instrument
description
Use when adding a new SlopKit Analytics event or metric to a product — pick a name and schema, implement the track or metric call, write the catalog file, then add a dedicated panel page. After the name exists, use analytics-page for the page. Do not invent generic views that already exist on /events and /metrics.
disable-model-invocation
unset

Full contents

---
name: analytics-instrument
description: Use when adding a new SlopKit Analytics event or metric to a product — pick a name and schema, implement the track or metric call, write the catalog file, then add a dedicated panel page. After the name exists, use analytics-page for the page. Do not invent generic views that already exist on /events and /metrics.
---

# Analytics instrument

Add a **new** event or metric to the product, then a page that is about that name. Invoke from the product repo.

If the name already exists in catalog or infer, do not invent a second name. Use `analytics-page` only.

## Name and schema

- Event: a verb phrase the product already uses in the UI or logs (`Signed Up`, `Checkout Failed`). Track needs `event` plus `userId` or `anonymousId`.
- Metric: a dotted name (`checkout.latency`) with a numeric `value`. Attributes are opaque keys.
- Catalog is one DuckDB `STRUCT` file: `catalog/events/<name>.struct` casts `events.properties`; `catalog/metrics/<name>.struct` casts `metrics.attributes`. The STRUCT body does not repeat the column name. Percent-encode path-illegal characters in the stem.

Do not invent a third property bag. Keep Segment `properties` and OTLP `attributes`.

## Implement in the product

Find how this product already POSTs to the collector (`/v1/track`, `/v1/batch`, `/v1/metrics`). Match that style, URL, and write key. Do not add a new client library unless the product has none.

Call the new name from the real feature path, not from a one-off script you leave behind.

## Slices

Brainstorm cuts that this name can actually answer: a property you just stored, a failure reason, a step, a duration. Write those down, then keep the ones the schema supports.

Do **not** add generic views that `/events` and `/metrics` already serve (all names, daily volume for everything, a raw log of everything).

## Page

Read [analytics-page](../analytics-page/SKILL.md) and follow it for the dedicated `/p` page. The name now exists, so that skill may use it. One page, one question, named SQL, no clone of the system lists.