Goal
Show a number from your own code beside a service, live and over time.Prerequisites
- A deployed project. Every deploy already has STACKSHIFT_METRICS_URL and STACKSHIFT_METRICS_TOKEN, so there is nothing to set up.
Workflow
1
Call the SDK, or post to STACKSHIFT_METRICS_URL, whenever the number changes.
2
Deploy. The number shows in the live strip next to that service, for example worker · 3 photos waiting, with a chart below.
From your code
- Outside StackShift the SDK calls do nothing and never throw, so the same code runs on your laptop.
JavaScript and TypeScript
Python
Go
PHP
Ruby
Over plain HTTP
- unit is optional, up to 16 characters.
- A batch holds up to 50 points.
One number
Several at once
Limits
- Up to 120 requests a minute for each service.
- Names are 1 to 64 characters. Values must be numbers.
- History is kept for your plan’s log days, and at least 7 days.
Expected result
Project, Metrics shows the latest value beside the service and a chart of its history.
Related guides
The performance page
Project, Metrics shows how your project is doing right now and over the last 7 days: memory, speed, page load, processor, disk, network and database, with what to change.
API
The endpoints behind the performance page, for your own tools.