Skip to content
Start here

Observability

ObservabilityTelemetry

List keys
client.workers.observability.telemetry.keys(TelemetryKeysParams { account_id, datasets, filters, 5 more } params, RequestOptionsoptions?): SinglePage<TelemetryKeysResponse { key, lastSeenAt, type } >
POST/accounts/{account_id}/workers/observability/telemetry/keys
Run a query
client.workers.observability.telemetry.query(TelemetryQueryParams { account_id, queryId, timeframe, 11 more } params, RequestOptionsoptions?): TelemetryQueryResponse { run, statistics, agents, 5 more }
POST/accounts/{account_id}/workers/observability/telemetry/query
List values
client.workers.observability.telemetry.values(TelemetryValuesParams { account_id, datasets, key, 5 more } params, RequestOptionsoptions?): SinglePage<TelemetryValuesResponse { dataset, key, type, value } >
POST/accounts/{account_id}/workers/observability/telemetry/values
ModelsExpand Collapse
TelemetryKeysResponse { key, lastSeenAt, type }
key: string
lastSeenAt: number
type: "string" | "boolean" | "number"
One of the following:
"string"
"boolean"
"number"
TelemetryQueryResponse { run, statistics, agents, 5 more }
run: Run { id, accountId, dry, 8 more }

A Workers Observability Query Object

id: string
accountId: string
dry: boolean
granularity: number
query: Query { id, adhoc, created, 6 more }
id: string
adhoc: boolean

If the query wasn’t explcitly saved

created: string
createdBy: string
description: string | null
maxLength1000
name: string

Query name

maxLength250
minLength1
parameters: Parameters { calculations, datasets, filterCombination, 6 more }
calculations?: Array<Calculation>

Create Calculations to compute as part of the query.

operator: "uniq" | "count" | "max" | 35 more
One of the following:
"uniq"
"count"
"max"
"min"
"sum"
"avg"
"median"
"p001"
"p01"
"p05"
"p10"
"p25"
"p75"
"p90"
"p95"
"p99"
"p999"
"stddev"
"variance"
"COUNT_DISTINCT"
"COUNT"
"MAX"
"MIN"
"SUM"
"AVG"
"MEDIAN"
"P001"
"P01"
"P05"
"P10"
"P25"
"P75"
"P90"
"P95"
"P99"
"P999"
"STDDEV"
"VARIANCE"
alias?: string
key?: string
keyType?: "string" | "number" | "boolean"
One of the following:
"string"
"number"
"boolean"
datasets?: Array<string>

Set the Datasets to query. Leave it empty to query all the datasets.

filterCombination?: "and" | "or" | "AND" | "OR"

Set a Flag to describe how to combine the filters on the query.

One of the following:
"and"
"or"
"AND"
"OR"
filters?: Array<UnionMember0 { filterCombination, filters, kind } | WorkersObservabilityFilterLeaf { key, operation, type, 2 more } >

Configure the Filters to apply to the query. Supports nested groups via kind: ‘group’.

One of the following:
UnionMember0 { filterCombination, filters, kind }
filterCombination: "and" | "or" | "AND" | "OR"
One of the following:
"and"
"or"
"AND"
"OR"
filters: Array<unknown>
kind: "group"
WorkersObservabilityFilterLeaf { key, operation, type, 2 more }

Filtering best practices: use observability_keys and observability_values to confirm available fields and values. If searching for errors, filter for $metadata.error exists.

key: string

Filter field name. IMPORTANT: do not guess keys. Always use verified keys from previous query results or the observability_keys response. Preferred keys: $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, $metadata.error.

operation: "includes" | "not_includes" | "starts_with" | 25 more
One of the following:
"includes"
"not_includes"
"starts_with"
"regex"
"exists"
"is_null"
"in"
"not_in"
"eq"
"neq"
"gt"
"gte"
"lt"
"lte"
"="
"!="
">"
">="
"<"
"<="
"INCLUDES"
"DOES_NOT_INCLUDE"
"MATCH_REGEX"
"EXISTS"
"DOES_NOT_EXIST"
"IN"
"NOT_IN"
"STARTS_WITH"
type: "string" | "number" | "boolean"
One of the following:
"string"
"number"
"boolean"
kind?: "filter"
value?: string | number | boolean

Filter comparison value. IMPORTANT: must match actual values in your logs. Verify using previous query results or the /values endpoint. Ensure value type matches the field type. String comparisons are case-sensitive unless using specific operations. Regex uses ClickHouse RE2 syntax (no lookaheads/lookbehinds); examples: ^5\d{2}$ for HTTP 5xx, \bERROR\b for word boundary.

One of the following:
string
number
boolean
groupBys?: Array<GroupBy>

Define how to group the results of the query.

type: "string" | "number" | "boolean"
One of the following:
"string"
"number"
"boolean"
value: string
havings?: Array<Having>

Configure the Having clauses that filter on calculations in the query result.

key: string
operation: "eq" | "neq" | "gt" | 3 more
One of the following:
"eq"
"neq"
"gt"
"gte"
"lt"
"lte"
value: number
limit?: number

Set a limit on the number of results / records returned by the query

maximum100
minimum0
needle?: Needle { value, isRegex, matchCase }

Define an expression to search using full-text search.

value: Value
isRegex?: boolean
matchCase?: boolean
orderBy?: OrderBy { value, order }

Configure the order of the results returned by the query.

value: string

Configure which Calculation to order the results by.

order?: "asc" | "desc"

Set the order of the results

One of the following:
"asc"
"desc"
updated: string
updatedBy: string
status: "STARTED" | "COMPLETED"
One of the following:
"STARTED"
"COMPLETED"
timeframe: Timeframe { from, to }

Time range for the query execution

from: number

Start timestamp for the query timeframe (Unix timestamp in milliseconds)

to: number

End timestamp for the query timeframe (Unix timestamp in milliseconds)

userId: string
created?: string
statistics?: Statistics { bytes_read, elapsed, rows_read, abr_level }
bytes_read: number

Number of uncompressed bytes read from the table.

elapsed: number

Time in seconds for the query to run.

rows_read: number

Number of rows scanned from the table.

abr_level?: number

The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1

updated?: string
statistics: Statistics { bytes_read, elapsed, rows_read, abr_level }

The statistics object contains information about query performance from the database, it does not include any network latency

bytes_read: number

Number of uncompressed bytes read from the table.

elapsed: number

Time in seconds for the query to run.

rows_read: number

Number of rows scanned from the table.

abr_level?: number

The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the ABR level is 1

agents?: Array<Agent>
agentClass: string
eventTypeCounts: Record<string, number>
firstEventMs: number
hasErrors: boolean
lastEventMs: number
namespace: string
service: string
totalEvents: number
calculations?: Array<Calculation>
aggregates: Array<Aggregate>
count: number
interval: number
sampleInterval: number
value: number
groups?: Array<Group>
key: string
value: string | number | boolean
One of the following:
string
number
boolean
calculation: string
series: Array<Series>
data: Array<Data>
count: number
interval: number
sampleInterval: number
value: number
firstSeen?: string
groups?: Array<Group>
key: string
value: string | number | boolean
One of the following:
string
number
boolean
lastSeen?: string
time: string
alias?: string
compare?: Array<Compare>
aggregates: Array<Aggregate>
count: number
interval: number
sampleInterval: number
value: number
groups?: Array<Group>
key: string
value: string | number | boolean
One of the following:
string
number
boolean
calculation: string
series: Array<Series>
data: Array<Data>
count: number
interval: number
sampleInterval: number
value: number
firstSeen?: string
groups?: Array<Group>
key: string
value: string | number | boolean
One of the following:
string
number
boolean
lastSeen?: string
time: string
alias?: string
events?: Events { count, events, fields, series }
count?: number
events?: Array<Event>
"$metadata": Metadata { id, account, cloudService, 28 more }
id: string

Unique event ID. Use as the cursor for offset-based pagination.

account?: string
cloudService?: string
coldStart?: number
exclusiveMinimum
minimum0
cost?: number
exclusiveMinimum
minimum0
duration?: number
exclusiveMinimum
minimum0
endTime?: number
minimum0
error?: string
errorTemplate?: string
fingerprint?: string
level?: string
message?: string
messageTemplate?: string
metricName?: string
origin?: string
parentSpanId?: string
provider?: string
region?: string
requestId?: string
service?: string
spanId?: string
spanName?: string
stackId?: string
startTime?: number
minimum0
statusCode?: number
exclusiveMinimum
minimum0
traceDuration?: number
exclusiveMinimum
minimum0
traceId?: string
transactionName?: string
trigger?: string
type?: string
url?: string
dataset: string
source: string | unknown
One of the following:
string
unknown
timestamp: number
minimum0
"$containers"?: unknown

Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.

"$workers"?: UnionMember0 { eventType, requestId, scriptName, 7 more } | UnionMember1 { cpuTimeMs, eventType, outcome, 11 more }

Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.

One of the following:
UnionMember0 { eventType, requestId, scriptName, 7 more }
eventType: "fetch" | "scheduled" | "alarm" | 8 more
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
requestId: string
scriptName: string
durableObjectId?: string
entrypoint?: string
event?: Record<string, unknown>
executionModel?: "durableObject" | "stateless"
One of the following:
"durableObject"
"stateless"
outcome?: string
scriptVersion?: ScriptVersion { id, message, tag }
id?: string
message?: string
tag?: string
truncated?: boolean
UnionMember1 { cpuTimeMs, eventType, outcome, 11 more }
cpuTimeMs: number
eventType: "fetch" | "scheduled" | "alarm" | 8 more
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
outcome: string
requestId: string
scriptName: string
wallTimeMs: number
diagnosticsChannelEvents?: Array<DiagnosticsChannelEvent>
channel: string
message: string
timestamp: number
dispatchNamespace?: string
durableObjectId?: string
entrypoint?: string
event?: Record<string, unknown>
executionModel?: "durableObject" | "stateless"
One of the following:
"durableObject"
"stateless"
scriptVersion?: ScriptVersion { id, message, tag }
id?: string
message?: string
tag?: string
truncated?: boolean
fields?: Array<Field>
key: string
type: string
series?: Array<Series>
data: Array<Data>
aggregates: Aggregates { _count, _interval, _firstSeen, 2 more }
Deprecated_count: number
exclusiveMinimum
minimum0
Deprecated_interval: number
exclusiveMinimum
minimum0
Deprecated_firstSeen?: string
Deprecated_lastSeen?: string
Deprecatedbin?: unknown
count: number
interval: number
sampleInterval: number
errors?: number
groups?: Record<string, string | number | boolean>

Groups in the query results.

One of the following:
string
number
boolean
time: string
invocations?: Record<string, Array<Invocation>>
"$metadata": Metadata { id, account, cloudService, 28 more }
id: string

Unique event ID. Use as the cursor for offset-based pagination.

account?: string
cloudService?: string
coldStart?: number
exclusiveMinimum
minimum0
cost?: number
exclusiveMinimum
minimum0
duration?: number
exclusiveMinimum
minimum0
endTime?: number
minimum0
error?: string
errorTemplate?: string
fingerprint?: string
level?: string
message?: string
messageTemplate?: string
metricName?: string
origin?: string
parentSpanId?: string
provider?: string
region?: string
requestId?: string
service?: string
spanId?: string
spanName?: string
stackId?: string
startTime?: number
minimum0
statusCode?: number
exclusiveMinimum
minimum0
traceDuration?: number
exclusiveMinimum
minimum0
traceId?: string
transactionName?: string
trigger?: string
type?: string
url?: string
dataset: string
source: string | unknown
One of the following:
string
unknown
timestamp: number
minimum0
"$containers"?: unknown

Cloudflare Containers event information enriches your logs so you can easily identify and debug issues.

"$workers"?: UnionMember0 { eventType, requestId, scriptName, 7 more } | UnionMember1 { cpuTimeMs, eventType, outcome, 11 more }

Cloudflare Workers event information enriches your logs so you can easily identify and debug issues.

One of the following:
UnionMember0 { eventType, requestId, scriptName, 7 more }
eventType: "fetch" | "scheduled" | "alarm" | 8 more
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
requestId: string
scriptName: string
durableObjectId?: string
entrypoint?: string
event?: Record<string, unknown>
executionModel?: "durableObject" | "stateless"
One of the following:
"durableObject"
"stateless"
outcome?: string
scriptVersion?: ScriptVersion { id, message, tag }
id?: string
message?: string
tag?: string
truncated?: boolean
UnionMember1 { cpuTimeMs, eventType, outcome, 11 more }
cpuTimeMs: number
eventType: "fetch" | "scheduled" | "alarm" | 8 more
One of the following:
"fetch"
"scheduled"
"alarm"
"cron"
"queue"
"email"
"tail"
"rpc"
"websocket"
"workflow"
"unknown"
outcome: string
requestId: string
scriptName: string
wallTimeMs: number
diagnosticsChannelEvents?: Array<DiagnosticsChannelEvent>
channel: string
message: string
timestamp: number
dispatchNamespace?: string
durableObjectId?: string
entrypoint?: string
event?: Record<string, unknown>
executionModel?: "durableObject" | "stateless"
One of the following:
"durableObject"
"stateless"
scriptVersion?: ScriptVersion { id, message, tag }
id?: string
message?: string
tag?: string
truncated?: boolean
traces?: Array<Trace>
rootSpanName: string
rootTransactionName: string
service: Array<string>
spans: number
traceDurationMs: number
traceEndMs: number
traceId: string
traceStartMs: number
errors?: Array<string>
TelemetryValuesResponse { dataset, key, type, value }
dataset: string
key: string
type: "string" | "boolean" | "number"
One of the following:
"string"
"boolean"
"number"
value: string | number | boolean
One of the following:
string
number
boolean

ObservabilityDestinations

Get Destinations
client.workers.observability.destinations.list(DestinationListParams { account_id, order, orderBy, 2 more } params, RequestOptionsoptions?): SinglePage<DestinationListResponse { configuration, enabled, name, 2 more } >
GET/accounts/{account_id}/workers/observability/destinations
Create Destination
client.workers.observability.destinations.create(DestinationCreateParams { account_id, configuration, enabled, 2 more } params, RequestOptionsoptions?): DestinationCreateResponse { configuration, enabled, name, 2 more }
POST/accounts/{account_id}/workers/observability/destinations
Update Destination
client.workers.observability.destinations.update(stringslug, DestinationUpdateParams { account_id, configuration, enabled } params, RequestOptionsoptions?): DestinationUpdateResponse { configuration, enabled, name, 2 more }
PATCH/accounts/{account_id}/workers/observability/destinations/{slug}
Delete Destination
client.workers.observability.destinations.delete(stringslug, DestinationDeleteParams { account_id } params, RequestOptionsoptions?): DestinationDeleteResponse { configuration, enabled, name, 2 more }
DELETE/accounts/{account_id}/workers/observability/destinations/{slug}
ModelsExpand Collapse
DestinationListResponse { configuration, enabled, name, 2 more }
configuration: Configuration { destination_conf, headers, jobStatus, 3 more }
destination_conf: string
headers: Record<string, string>
jobStatus: JobStatus { error_message, last_complete, last_error }
error_message: string
last_complete: string
last_error: string
logpushDataset: "opentelemetry-traces" | "opentelemetry-logs"
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
type: "logpush"
url: string
enabled: boolean
name: string
scripts: Array<string>
slug: string
DestinationCreateResponse { configuration, enabled, name, 2 more }
configuration: Configuration { destination_conf, logpushDataset, logpushJob, 2 more }
destination_conf: string
logpushDataset: "opentelemetry-traces" | "opentelemetry-logs"
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpushJob: number
type: "logpush"
url: string
enabled: boolean
name: string
scripts: Array<string>
slug: string
DestinationUpdateResponse { configuration, enabled, name, 2 more }
configuration: Configuration { destination_conf, logpushDataset, logpushJob, 2 more }
destination_conf: string
logpushDataset: "opentelemetry-traces" | "opentelemetry-logs"
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpushJob: number
type: "logpush"
url: string
enabled: boolean
name: string
scripts: Array<string>
slug: string
DestinationDeleteResponse { configuration, enabled, name, 2 more }
configuration: Configuration { destination_conf, logpushDataset, logpushJob, 2 more }
destination_conf: string
logpushDataset: "opentelemetry-traces" | "opentelemetry-logs"
One of the following:
"opentelemetry-traces"
"opentelemetry-logs"
logpushJob: number
type: "logpush"
url: string
enabled: boolean
name: string
scripts: Array<string>
slug: string