Tags
Tags are dynamic metadata that your Worker exposes to describe its runtime environment, capabilities, or status. Tags are especially useful for monitoring and debugging in the Load Balancer's dashboard, or from the /health
endpoint.
What are tags for?
- Monitoring: Tags are displayed in the Load Balancer's dashboard for each Worker, making it easy to see key runtime information at a glance (e.g., Chrome version, AI model, GPU type).
- Filtering: You can use tags to distinguish between different types of Workers, dependencies, hardware, etc.
- Debugging: Tags help you quickly identify issues related to environment or dependencies.
How to define tags
To add custom tags, create files in the src/tags/
directory of your Worker. Each file should export an async tags
function that returns an object of key-value pairs.
Example: src/tags/chromeVersion.ts
import { chromeVersion } from '../services/chrome'
export async function tags() {
const puppeteerVersion = require('puppeteer/package.json').version
return {
puppeteerVersion,
chromeVersion: chromeVersion ? chromeVersion.replace(/^Chrome\//, '') : 'unknown',
}
}
You can add as many tag files as you want. All tags are merged and exposed in the /health
endpoint (with authentication).
How tags are used by the Load Balancer
- When the Load Balancer discovers or monitors Workers, it fetches their
/health
endpoint and collects the tags. - Tags are displayed in the dashboard for each Worker, so you can see at a glance which version, model, or environment each Worker is running.
tip
Tags are especially useful for monitoring and debugging in production. Use them to expose any information that helps you operate your Workers. See Logging for more on observability.