Connect Tsuga usage metrics to Costory when you want to divide cloud cost by requests, errors, latency, or another telemetry signal. Costory imports Tsuga metrics, log aggregations, and trace aggregations so you can build reports from the same data you use for observability.Documentation Index
Fetch the complete documentation index at: https://docs.costory.io/llms.txt
Use this file to discover all available pages before exploring further.
Before you begin, make sure you have:
- A Tsuga account with at least one metric, log stream, or trace
- Permissions to create Operation API Keys in your Tsuga workspace
What You Provide
Operation API Key
A Bearer token scoped to read metrics and run aggregations.
Metric or Query Config
The metric names and aggregation you want to import.
Setup Steps
Create an Operation API Key in Tsuga
Go to Settings > API Keys in the Tsuga app and create a new key with the Operation type. Copy the key. It is only shown once.
Add Tsuga as a data source in Costory
Navigate to Settings > Data Sources > Add New and select Tsuga.
Enter your API key
Paste your Operation API Key. Costory uses it as a Bearer token against
https://api.tsuga.com.Browse available metrics
Costory calls
GET /v1/metrics to list all metrics in your workspace. Select the metrics you want to import.Configure your aggregation
For each metric, choose an aggregation type:
sum, average, max, min, count, or percentile. You can also add an optional group-by field, such as service or env.How Costory Queries Tsuga
Costory uses two Tsuga endpoints depending on the chart type:| Use case | Endpoint |
|---|---|
| Single aggregated value over a period | POST /v1/aggregation/multi-query/scalar |
| Time series for trend charts | POST /v1/aggregation/multi-query/timeseries |
metrics, logs, and traces as data sources. You can import raw metrics or aggregations derived from logs and traces, such as HTTP errors per minute from logs or p99 latency from traces.
Example: query API call count as a time series
Supported Data Sources
Metrics
Standard time series metrics, including counters, gauges, and histograms.
Logs
Aggregations computed from log streams, such as error rate.
Traces
Aggregations computed from distributed traces, such as p99 latency.
FAQ
What is an Operation API Key?
What is an Operation API Key?
Tsuga has two key types: Ingestion keys are write-only and send data to Tsuga. Operation keys are read-only and query data. Costory needs an Operation key to call the public API.
Can I import metrics derived from logs or traces, not just raw metrics?
Can I import metrics derived from logs or traces, not just raw metrics?
Yes. The aggregation endpoints support
"dataSource": "logs" and "dataSource": "traces". You can define any aggregation Tsuga supports, and Costory treats the result as a usage metric.Can I filter by a specific service or environment?
Can I filter by a specific service or environment?
Yes. Use the
filter field in the query body with Tsuga’s query syntax, such as service:my-service AND env:production, to scope the metric to part of your infrastructure.How do I find the metric names available in my workspace?
How do I find the metric names available in my workspace?
Tsuga’s
GET /v1/metrics endpoint returns all metric names with their metadata. You can also browse the API reference at app.tsuga.com/swagger.When will I see data in Costory after setup?
When will I see data in Costory after setup?
You typically see data within a few minutes of the first successful sync. Historical backfill depends on the retention configured in your Tsuga workspace.
Next Steps
Build Unit Economics
Divide cloud costs by Tsuga metrics to track cost per request, cost per user, and other per-unit metrics.
Connect Events
Add deploys and incidents to correlate with metric changes.
