You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cloud/billing-api.mdx
+16-47Lines changed: 16 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,7 @@ tags:
14
14
---
15
15
16
16
The Temporal Cloud Billing API provides Namespace-level cost attribution through on-demand billing reports.
17
-
These reports are generated asynchronously and can be accessed with an object endpoint or downloaded in CSV format
18
-
for analysis by FinOps professionals and Temporal Cloud operators.
17
+
Reports are delivered in CSV format and can be accessed via API or downloaded directly for use in FinOps tooling and cost management platforms.
19
18
20
19
This API is part of the [Cloud Operations API](/ops).
21
20
@@ -29,67 +28,42 @@ The Billing API allows you to:
29
28
30
29
- Generate billing reports for specified invoice months
31
30
- Retrieve report status and metadata
32
-
- Correlate report generation with async operations
33
-
- Download CSV reports
34
-
- Integrate billing reports into internal analytics tooling and cloud cost management platforms
31
+
- Download CSV reports that can be fed into internal analytics tooling or cloud cost management platforms
35
32
36
-
The Billing API contains:
33
+
The Billing Report contains:
37
34
38
35
- Accurate Namespace-level cost attribution
39
-
-Down to hourly granularity
40
-
-Alignment with the [FOCUS schema](https://focus.finops.org/)
36
+
-Hourly granularity
37
+
-A [FOCUS](https://focus.finops.org/)-friendly data format
41
38
42
-
For complete request and response schemas, refer to the Protocol Buffer definitions below.
39
+
For complete request and response schemas, refer to the Schema below.
43
40
44
41
Billing report generation is **asynchronous**. You initiate report creation, then poll for completion.
45
42
46
-
## Report data granularity
43
+
## Report data limitations
47
44
48
-
Reports can be generated with hourly granularity only, for the current billing month, and the previous billing month.
45
+
For pre-release, reports can be generated with hourly granularity only, for the current billing month, and the previous billing month.
49
46
50
47
## Allowed date ranges
51
48
52
49
Date ranges must use billing-month boundaries (MM/YYYY).
53
50
Requests may include the current billing month.
54
51
The data in finalized reports includes usage up to `current_time`\- 24 hours (rounded up to nearest hour).
55
52
56
-
:::info Limitiations
57
-
58
-
Data from the current billing period is not cacheable. Also, recently requested historical date ranges may complete faster due to caching.
59
-
60
-
:::
61
-
62
53
## Rate limits and concurrency
63
54
64
-
To ensure system stability, rate limits apply to API usage.
55
+
Rate limits apply to API usage.
65
56
66
57
### Per-account concurrency
67
58
68
59
Within a single account:
69
60
70
-
- Only one billing report per account is processed at a time
61
+
- Only one billing report per account is generated at a time
71
62
- Additional requests are accepted but queued
72
-
- Processing occurs serially per account
73
-
74
-
### Global rate limits
75
-
76
-
Billing report generation depends on shared infrastructure.
77
63
78
-
Report generation time varies based on:
64
+
### Report Generation Latency
79
65
80
-
- Global system load
81
-
- Date range size
82
-
- Cache availability
83
-
84
-
### Caching behavior
85
-
86
-
If a previously requested date range is requested again:
87
-
88
-
- Cached precomputed data is reused
89
-
- Global rate limits are skipped
90
-
- Generation completes significantly faster
91
-
92
-
Exception: Data from the current billing period is not cached.
66
+
Report generation time varies and is not guaranteed. Factors that affect it include the size of the requested date range and overall platform load.
93
67
94
68
## Best practices
95
69
@@ -99,8 +73,6 @@ Poll `GetBillingReport` using exponential backoff.
99
73
100
74
Download reports immediately after generation (URLs expire).
101
75
102
-
Reuse previously requested date ranges when possible to benefit from caching.
103
-
104
76
Avoid frequent generation of large overlapping ranges in the current billing period.
105
77
106
78
## Billing report schema
@@ -123,7 +95,7 @@ Each row represents a charge record.
123
95
| ChargePeriodStart | Time period start from when this charge took place, correlates to data granularity | 2025-10-01T00:00:00.000Z |
124
96
| ContractedCost | Cost calculated by multiplying ContractedUnitPrice and PricingQuantity | 100.00 |
125
97
| ContractedUnitPrice | The agreed-upon unit price for a single pricing unit of the associated SKU. Inclusive of negotiated discounts | 10.00 |
126
-
| InvoiceID | The ID of the invoice for this billing period | in\_1SPN94JLJETBw2gmYWyQ71xT|
98
+
| InvoiceID | The ID of the invoice for this billing period | in\_XXXXXXXXXXXXXXXXXXXX|
127
99
| InvoiceIssuer | The entity responsible for issuing payable invoices | stripe |
128
100
| PricingQuantity | The volume of a given SKU used or purchased | 10.00 |
129
101
| PricingUnit | The measurement unit used for PricingQuantity | 1 Million Actions |
@@ -137,16 +109,13 @@ Each row represents a charge record.
137
109
| ServiceSubcategory | A secondary classification of the service category for a service based on its core function | Actions |
138
110
| SKUID | A unique identifier that represents a specific SKU | essentials-actions |
139
111
| SKUMeter | The functionality being metered or measured by a particular SKU in a charge | Actions |
140
-
| Tags | Provider and customer defined tags associated with resources |`{"$tmprl\_project":\["project-id"\],"namespace-tag-key":\["namespace-tag-value"\]}`|
112
+
| Tags | Provider and customer defined tags associated with resources |`{"$tmprl_project":["project-id"],"namespace-tag-key":["namespace-tag-value"]}`|
141
113
142
114
## Generate a report
143
115
144
116
To generate a report, follow these steps:
145
117
146
-
1. Create a billing report using `CreateBillingReport`
147
-
1. Receive:
148
-
-`billing_report_id` (identifies the report artifact)
149
-
-`async_operation_id` (identifies the background job)
118
+
1. Create a billing report using `CreateBillingReport`. The response includes a `billing_report_id` and `async_operation_id`.
150
119
1. Poll `GetBillingReport` using the `billing_report_id`
151
120
1. When the report state becomes `BILLING_REPORT_STATE_GENERATED`, retrieve the download URL
152
121
1. Download the report before the URL expires
@@ -155,7 +124,7 @@ To generate a report, follow these steps:
155
124
156
125
| Identifier | Purpose |
157
126
| ----- | ----- |
158
-
|`billing_report_id`| Identifies the billing report artifact and is used to retrieve metadata and download URLs |
127
+
|`billing_report_id`| Identifies the billing report and is used to retrieve metadata and download URLs |
159
128
|`async_operation_id`| Identifies the background operation responsible for generating the report |
160
129
161
130
The async operation follows the standard Cloud Operations async model (see [Async Operations](/ops#per-identity-rate-limits)).
Copy file name to clipboardExpand all lines: docs/develop/dotnet/message-passing.mdx
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,7 @@ Follow these guidelines when writing your message handlers:
37
37
38
38
- Message handlers are defined as methods on the Workflow class, using one of the three attributes: [`WorkflowQueryAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowQueryAttribute.html), [`WorkflowSignalAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowSignalAttribute.html), and [`WorkflowUpdateAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowUpdateAttribute.html).
39
39
- The parameters and return values of handlers and the main Workflow function must be [serializable](/dataconversion).
40
-
- Prefer data classes to multiple input parameters.
41
-
Data class parameters allow you to add fields without changing the calling signature.
40
+
- Prefer data classes to multiple input parameters. Data class parameters allow you to add fields without changing the calling signature. Keep in mind that serialization and deserialization can fail with the default data converter if the new field does not have a default value.
description: Configure Workflow timeouts, set Retry Policies, and manage Activity timeouts and Heartbeats using Temporal's Go SDK for optimized execution control.
16
+
description: Handle errors, configure Workflow timeouts, set Retry Policies, and manage Activity timeouts and Heartbeats using Temporal's Go SDK.
16
17
---
17
18
18
19
This page shows how to do the following:
19
20
21
+
-[Handle errors](#error-handling)
20
22
-[Set Workflow timeouts](#workflow-timeouts)
21
23
-[Set a Workflow Retry Policy](#workflow-retries)
22
24
-[Set Activity timeouts](#activity-timeouts)
23
25
-[Set a custom Activity Retry Policy](#activity-retries)
24
26
27
+
## Error handling {#error-handling}
28
+
29
+
Within a Workflow, an Activity or Child Workflow execution might fail. You can
30
+
handle errors differently based on the error type.
31
+
32
+
If the Activity returns an error as `errors.New()` or `fmt.Errorf()`, that error is converted into `*temporal.ApplicationError`.
33
+
34
+
If the Activity returns an error as `temporal.NewNonRetryableApplicationError("error message", details)`, that error is returned as `*temporal.ApplicationError`.
35
+
36
+
There are other types of errors such as `*temporal.TimeoutError`, `*temporal.CanceledError` and
37
+
`*temporal.PanicError`.
38
+
39
+
Here's an example of handling Activity errors within Workflow code that differentiates between different error types.
// handle Activity errors (errors created other than using NewApplicationError() API)
54
+
switch applicationErr.Type() {
55
+
case"CustomErrTypeA":
56
+
// handle CustomErrTypeA
57
+
case CustomErrTypeB:
58
+
// handle CustomErrTypeB
59
+
default:
60
+
// newer version of Activity could return new errors that Workflow was not aware of.
61
+
}
62
+
}
63
+
64
+
varcanceledErr *CanceledError
65
+
if errors.As(err, &canceledErr) {
66
+
// handle cancellation
67
+
}
68
+
69
+
vartimeoutErr *TimeoutError
70
+
if errors.As(err, &timeoutErr) {
71
+
// handle timeout, could check timeout type by timeoutErr.TimeoutType()
72
+
switch err.TimeoutType() {
73
+
case commonpb.ScheduleToStart:
74
+
// Handle ScheduleToStart timeout.
75
+
case commonpb.StartToClose:
76
+
// Handle StartToClose timeout.
77
+
case commonpb.Heartbeat:
78
+
// Handle heartbeat timeout.
79
+
default:
80
+
}
81
+
}
82
+
83
+
varpanicErr *PanicError
84
+
if errors.As(err, &panicErr) {
85
+
// handle panic, message and call stack are available by panicErr.Error() and panicErr.StackTrace()
86
+
}
87
+
}
88
+
```
89
+
90
+
### Panics and deferred functions
91
+
92
+
In Go, [`defer` schedules cleanup functions and `recover()` catches panics](https://go.dev/blog/defer-panic-and-recover) to prevent them from crashing the program.
93
+
This doesn't work the same way in Temporal Workflow code — you cannot `recover()` from a panic inside a `defer`.
94
+
Deferred functions that try to interact with the Temporal SDK during panic unwinding will re-panic immediately.
95
+
96
+
Use `defer` only for local cleanup.
97
+
Handle Temporal API cleanup through explicit error checks instead.
98
+
25
99
## Workflow timeouts {#workflow-timeouts}
26
100
27
101
**How to set Workflow timeouts using the Temporal Go SDK**
Copy file name to clipboardExpand all lines: docs/develop/python/message-passing.mdx
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,8 +42,7 @@ Follow these guidelines when writing your message handlers:
42
42
43
43
- Message handlers are defined as methods on the Workflow class, using one of the three decorators: [`@workflow.query`](https://python.temporal.io/temporalio.workflow.html#query), [`@workflow.signal`](https://python.temporal.io/temporalio.workflow.html#signal), and [`@workflow.update`](https://python.temporal.io/temporalio.workflow.html#update).
44
44
- The parameters and return values of handlers and the main Workflow function must be [serializable](/dataconversion).
45
-
- Prefer [data classes](https://docs.python.org/3/library/dataclasses.html) to multiple input parameters.
46
-
Data class parameters allow you to add fields without changing the calling signature.
45
+
- Prefer [data classes](https://docs.python.org/3/library/dataclasses.html) to multiple input parameters. Data class parameters allow you to add fields without changing the calling signature. Keep in mind that serialization and deserialization can fail with the default data converter if the new field does not have a default value.
Copy file name to clipboardExpand all lines: docs/encyclopedia/workers/worker-versioning.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ Since Independent Activities aren't part of a Workflow's version, they can run i
74
74
75
75
-**Current Worker Deployment Version**: The version where Workflows are routed to unless they were previously pinned on a different version. Other versions can continue polling to allow pinned Workflows to finish executing or in case you need to roll back. If no current version is specified, the default is unversioned.
76
76
-**Ramping Worker Deployment Version**: The version where a configurable percentage of Workflows are routed to unless they were previously pinned on a different version. The ramp percentage can be in the range [0, 100]. Workflows that don't go to the Ramping Version will go to the Current Version. If no Ramping Version is specified, 100% of new Workflows and Auto-Upgrade Workflows will go to the Current Version.
77
-
-**Target Worker Deployment Version**: The version your Workflow will move to next. This could be the Deployment's Current Version or the Ramping Version. For example, if an Auto-Upgrade Workflow was running on Version A, the Current Version is B, and there is a 5% ramp to C, there is a 95% chance that its Target Version is B and 5% that it's C.
77
+
-**Target Worker Deployment Version**: The version your Workflow will upgrade to next. This could be the Deployment's Current Version or the Ramping Version. For example, if an Auto-Upgrade Workflow was running on Version A, the Current Version is B, and there is a 5% ramp to C, there is a 95% chance that its Target Version is B and 5% that it's C. Workflow ID determines whether the workflow falls into the 95% group or the 5% group.
0 commit comments