Related queries and mutations in Performance and cost. Each has its own section.
Queries
getStorageOptimizationCandidates (query)
getStorageOptimizationCandidates is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Get tables that are candidates for storage optimization, largest first unless 'orderBy' or 'orderDirection' says otherwise. Scoped to a single warehouse when 'resourceId' is given, otherwise to every warehouse in the account. Both cases are narrowed by the account's cost agent warehouse scope: candidates on warehouses outside the scope are not returned.
Arguments
| Argument | Type | Description |
|---|---|---|
resourceId | UUID | UUID of the warehouse to scan for optimization candidates. Omit to return candidates across the warehouses in the account's cost agent warehouse scope. Passing a warehouse outside that scope returns an empty page with totalCount 0 and no error, even when the warehouse is valid and accessible. |
first | Int | Maximum number of candidates to return per page (default: 50) Default: 50. |
after | String | Cursor from a previous page's endCursor to fetch the next page. A cursor carries the sort it was issued under. Reusing one after 'orderBy' or 'orderDirection' changes is rejected; start again from the first page instead. |
filter | StorageOptimizationCandidatesFilter | Optional filters applied to the candidate results |
orderBy | StorageOptimizationSortField | Field to sort candidates by, applied to every candidate matching the filter rather than to the returned page alone. Defaults to totalByteCount. A candidate with no recorded size sorts as zero bytes. A candidate with no risk tier sorts last in either direction. A candidate that was never read sorts as the stalest. tableCategory ranks by cleanup safety rather than alphabetically, from safest to remove to least safe: temporary, ad_hoc, archive_snapshot, other, production. Safest-first is the ASC order; 'orderDirection' defaults to DESC. An unrecognised or unset category sorts last in either direction. tableName sorts by table name, breaking ties on project then dataset; fullTableId sorts the fully qualified identifier ('project:dataset.table') instead. Either way an unset name sorts last in either direction. |
orderDirection | StorageOptimizationSortDirection | Direction to sort 'orderBy' in. Defaults to DESC. |
Returns
StorageOptimizationCandidatesResult
Example
query GetStorageOptimizationCandidates {
getStorageOptimizationCandidates {
totalCount
totalByteCountSum
breakdownByRiskLevel
}
}Types used only by getStorageOptimizationCandidates
getStorageOptimizationCandidatesStorageOptimizationCandidate
StorageOptimizationCandidateObject type. A table that is a candidate for storage optimization.
| Field | Type | Description |
|---|---|---|
projectName | String | |
datasetName | String | |
tableName | String | |
tableType | String | |
latestUpdate | DateTime | |
latestRead | DateTime | |
latestWrite | DateTime | |
latestQuery | DateTime | |
isPeriodicMetadata | Boolean | |
totalReads | Float | |
totalWrites | Float | |
totalUsers | Float | |
totalReadingUsers | Float | |
totalWritingUsers | Float | |
importanceScore | Float | |
isImportant | Boolean | |
criticality | String | |
degreeIn | Float | |
degreeOut | Float | |
nodeType | String | |
isMonitored | Boolean | |
hasActiveMonitor | Boolean | |
isExcluded | Boolean | |
createdTime | DateTime | |
discoveredTime | DateTime | |
lastObserved | DateTime | |
byteCountShare | Float | |
rowCountShare | Float | |
wastePattern | String | |
tableCategory | String | |
riskTier | Int | |
fullTableId | String! | Fully qualified table identifier (project:dataset.table) |
resourceUuid | String! | UUID of the warehouse this table belongs to |
mcon | String! | Monte Carlo object name — unique table identifier |
daysSinceLatestRead | Float | Number of days since the table was last read (computed at query time) |
totalRowCount | Float | Most recent row count for this table |
totalByteCount | Float | Most recent byte count for this table |
queryLogDays | Int | Days, out of the last 30, on which Monte Carlo collected query logs for this table's warehouse. Read and write dates cover only those days, so a warehouse with fewer days can show a table as unread when its reads were not collected. Null when not yet measured. |
tickets | [StorageCandidateTicket!]! | Tickets created covering this candidate (empty if none). |
StorageOptimizationCandidatesFilter
StorageOptimizationCandidatesFilterInput object type. Optional filters applied to storage optimization candidate results.
| Field | Type | Description |
|---|---|---|
databaseNames | [String!] | Filter candidates to tables whose database/project/catalog name is in this list. Exact match. Null or empty list applies no filter. |
schemaNames | [String!] | Filter candidates to tables whose schema/dataset name is in this list. Exact match. Null or empty list applies no filter. |
tiers | [Int!] | Filter candidates to the given safety tiers (0 = safest to remove, 5 = highest risk). Null or empty list applies no filter. |
tableCategories | [String!] | Filter candidates to the given derived table categories (temporary, ad_hoc, archive_snapshot, other, production). Null or empty list applies no filter. |
nameSearch | String | Case-insensitive substring match on the table name. Null or empty string applies no filter. |
domainIds | [UUID!] | Filter candidates to tables assigned to any of these domains. Restricted to domains the caller can access. Null or empty list applies no filter. |
StorageOptimizationCandidatesResult
StorageOptimizationCandidatesResultObject type.
| Field | Type | Description |
|---|---|---|
nodes | [StorageOptimizationCandidate!]! | Storage optimization candidates for the current page |
totalCount | Int! | Total number of candidates across all pages |
totalByteCountSum | Float! | Summed 'totalByteCount' of every candidate matching the current filter, not just the returned page. Candidates with no recorded size do not contribute, and an empty result reports 0. |
pageInfo | StorageOptimizationPageInfo! | Pagination information |
breakdownByRiskLevel | [Int!]! | Per-tier candidate counts for the current filter, as a 6-element array indexed by safety tier (0 = safest to remove, 5 = highest risk). Empty tiers report 0. |
StorageOptimizationSortField
StorageOptimizationSortFieldEnum type. Field a storage optimization candidate list is sorted by.
| Value | Description |
|---|---|
totalByteCount | |
riskTier | |
daysSinceLatestRead | |
tableCategory | |
tableName | |
fullTableId |
Related types
DateTime, StorageCandidateTicket, StorageOptimizationPageInfo, StorageOptimizationSortDirection, UUID
getStorageUnusedTables (query)
getStorageUnusedTables is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Tables Cost Agent judged unused in the account's latest run that listed them, largest first unless 'orderBy' or 'orderDirection' says otherwise. Each table says whether it is in a finding, and why not when it isn't. Narrowed to the caller's domains and the account's cost agent warehouse scope. Not available to the free tier of Performance & Cost Agent.
Arguments
| Argument | Type | Description |
|---|---|---|
first | Int | Tables per page, at most 1000 (default: 50). Default: 50. |
after | String | 'endCursor' of the previous page. A cursor from another sort is rejected; start again from the first page. |
filter | StorageUnusedTablesFilter | |
orderBy | StorageUnusedTableSortField | Defaults to sizeBytes. |
orderDirection | StorageOptimizationSortDirection | Defaults to DESC. |
Returns
StorageUnusedTablesResult!
Example
query GetStorageUnusedTables {
getStorageUnusedTables {
totalCount
totalSizeBytes
totalMonthlyCostUsd
asOfTime
mode
notice
}
}Types used only by getStorageUnusedTables
getStorageUnusedTablesStorageUnusedTable
StorageUnusedTableObject type. A table Cost Agent judged unused in its run. Names are customer identifiers: show them as
plain text.
| Field | Type | Description |
|---|---|---|
mcon | String! | Monte Carlo object name of the table. |
warehouseUuid | UUID! | The table's warehouse. |
platform | String! | The warehouse's platform. |
fullTableId | String! | |
databaseName | String | |
schemaName | String | |
tableName | String | |
sizeBytes | Float! | |
monthlyCostUsd | Float | Storage cost a month at the price 'priceLabel' names. Null without a price. |
priceSource | String | Where the price came from: STANDARD, CUSTOMER or BILLED_AVERAGE. |
priceLabel | String | The price and its source in words, e.g. '$23.00/TB-month, standard price'. |
lastUsedTime | DateTime | The latest read, write or data change seen. Null when none was seen. |
isLastUsedFirstSeen | Boolean! | Whether 'lastUsedTime' is the date Monte Carlo first saw the table, not a use it saw. Always false for now, because Monte Carlo doesn't record first-seen dates yet. |
downstreamCount | Int | Assets directly downstream: tables and reports. Null when unknown. |
storageShare | Float | The table's share of the bytes of every table in its warehouse, from 0 to 1. Null when unknown. |
status | StorageUnusedTableStatus! | |
dropReason | String | Why Cost Agent didn't make the table's schema a finding, when 'status' is DROPPED: KEPT_ON_PURPOSE, USED_OUTSIDE_MC, EVIDENCE_MISREAD or WOULD_HURT_USERS. |
findingKey | String | The stable key of the run's finding that lists the table, when 'status' is IN_FINDING. |
tickets | [StorageCandidateTicket!]! | Tickets created covering this table (empty if none). |
StorageUnusedTableSortField
StorageUnusedTableSortFieldEnum type. Field the unused tables are sorted by, named after the field it sorts. A table without a value sorts last in either direction. tableName breaks ties on database, then schema.
| Value | Description |
|---|---|
sizeBytes | |
monthlyCostUsd | |
lastUsedTime | |
storageShare | |
downstreamCount | |
tableName |
StorageUnusedTableStatus
StorageUnusedTableStatusEnum type. Whether an unused table is in one of the run's findings, and why not when it isn't.
IN_FINDING: in one of the run's findings. DROPPED: Cost Agent reviewed the table's schema and
didn't make it a finding; 'dropReason' says why. UNDER_MINIMUM_SAVING: the schema's saving is
under the minimum a finding shows. OUTSIDE_TOP_FINDINGS: the schema's finding ranked below
the run's cap on findings. INSUFFICIENT_HISTORY: the warehouse's query logs miss days, so the
table can't be proven unused. UNKNOWN: a status this version of the API doesn't know.
| Value | Description |
|---|---|
IN_FINDING | |
DROPPED | |
UNDER_MINIMUM_SAVING | |
OUTSIDE_TOP_FINDINGS | |
INSUFFICIENT_HISTORY | |
UNKNOWN |
StorageUnusedTableWarehouse
StorageUnusedTableWarehouseObject type. A warehouse Cost Agent looked at for unused tables in the run.
| Field | Type | Description |
|---|---|---|
warehouseUuid | UUID! | |
platform | String! | |
status | StorageUnusedTableWarehouseStatus! | |
queryLogDays | Int | Days, out of the last 30, with query logs. Null when not measured. |
unusedTotal | Int! | Unused tables found among the tables checked. |
leftOut | Int! | Unused tables beyond the largest ones the run lists, so not listed. 0 when the warehouse's status lists no tables. Otherwise the run lists 'unusedTotal' minus 'leftOut' of them. |
isLeftOutLowerBound | Boolean! | Whether only the warehouse's largest tables were checked, so 'unusedTotal' and 'leftOut' are lower bounds. |
StorageUnusedTableWarehouseStatus
StorageUnusedTableWarehouseStatusEnum type. Whether a warehouse's unused tables were listed, and why not when they weren't.
LISTED: its unused tables are listed. INSUFFICIENT_HISTORY: query logs on too few days, so its
unused tables are listed with status INSUFFICIENT_HISTORY. NO_QUERY_HISTORY: no query logs in
the window; none are listed. NOT_SUPPORTED: its platform's query logs can't prove a table
unused yet; none are listed. UNAVAILABLE: its tables couldn't be read in this run; none are
listed. UNKNOWN: a status this version of the API doesn't know.
| Value | Description |
|---|---|
LISTED | |
INSUFFICIENT_HISTORY | |
NO_QUERY_HISTORY | |
NOT_SUPPORTED | |
UNAVAILABLE | |
UNKNOWN |
StorageUnusedTablesFilter
StorageUnusedTablesFilterInput object type. Filters on the unused tables. A null or empty value applies no filter.
| Field | Type | Description |
|---|---|---|
warehouseIds | [UUID!] | |
databaseNames | [String!] | Exact database or project names. |
schemaNames | [String!] | Exact schema or dataset names. |
statuses | [StorageUnusedTableStatus!] | |
nameSearch | String | Case-insensitive substring of the table name, at most 200 characters. |
domainIds | [UUID!] | Tables assigned to any of these domains, within the domains the caller can access. |
StorageUnusedTablesNotice
StorageUnusedTablesNoticeEnum type. What to tell the viewer about the account's latest Cost Agent run.
STORAGE_OFF: the latest run left storage findings out, so it listed no tables. RUN_FAILED: the
latest run ended in an error; the tables are from the run 'asOfTime' names. NOT_LISTED: the
latest run didn't list unused tables; the tables are from the run 'asOfTime' names.
NONE_FOUND: the run found no unused tables.
| Value | Description |
|---|---|
STORAGE_OFF | |
RUN_FAILED | |
NOT_LISTED | |
NONE_FOUND |
StorageUnusedTablesResult
StorageUnusedTablesResultObject type.
| Field | Type | Description |
|---|---|---|
nodes | [StorageUnusedTable!]! | |
totalCount | Int! | Tables matching the filter, across all pages. |
totalSizeBytes | Float! | Summed size of every table matching the filter. |
totalMonthlyCostUsd | Float! | Summed monthly cost of every table matching the filter. Tables without a price don't contribute. |
pageInfo | StorageOptimizationPageInfo! | |
asOfTime | DateTime | The end of the data the tables' run read. Null when the account has no run that listed unused tables, or the caller can't see that run. |
mode | StorageUnusedTablesRunMode | The tables' run's mode. Null when the account has no run that listed unused tables, or the caller can't see that run. |
notice | StorageUnusedTablesNotice | What to tell the viewer about the latest run. Null when nothing. |
warehouses | [StorageUnusedTableWarehouse!]! | The warehouses the tables' run looked at, including those with no tables. |
StorageUnusedTablesRunMode
StorageUnusedTablesRunModeEnum type. Who is shown the run's findings. ON: customers. SHADOW: only Monte Carlo users, who are the
only callers given a SHADOW run's tables.
| Value | Description |
|---|---|
ON | |
SHADOW |
Related types
DateTime, StorageCandidateTicket, StorageOptimizationPageInfo, StorageOptimizationSortDirection, UUID
Mutations
createJiraTicketForStorageCandidates (mutation)
createJiraTicketForStorageCandidates is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Create a Jira ticket for a set of storage-optimization candidates or unused tables.
Arguments
| Argument | Type | Description |
|---|---|---|
candidateMcons | [String!]! | MCONs of the selected tables: storage optimization candidates, or unused tables from getStorageUnusedTables. |
details | CreateJiraStorageTicketInput! |
Returns
CreateJiraTicketForStorageCandidates
Example
mutation CreateJiraTicketForStorageCandidates($candidateMcons: [String!]!, $details: CreateJiraStorageTicketInput!) {
createJiraTicketForStorageCandidates(candidateMcons: $candidateMcons, details: $details) {
ticket {
id
provider
identifier
url
coveredMcons
createdTime
}
}
}Types used only by createJiraTicketForStorageCandidates
createJiraTicketForStorageCandidatesCreateJiraStorageTicketInput
CreateJiraStorageTicketInputInput object type. Jira ticket details for a set of storage-optimization candidates.
| Field | Type | Description |
|---|---|---|
integrationId | UUID! | UUID of the Jira integration to create the ticket under. |
project | Int! | Jira project id. |
issuetype | Int! | Jira issue-type id. |
summary | String! | Ticket summary (must be non-empty). |
description | String | Ticket description (Markdown). |
fields | JSONString | Additional Jira fields keyed by field id (e.g. required custom fields). |
CreateJiraTicketForStorageCandidates
CreateJiraTicketForStorageCandidatesObject type.
| Field | Type | Description |
|---|---|---|
ticket | StorageCandidateTicket |
Related types
JSONString, StorageCandidateTicket, UUID
createLinearTicketForStorageCandidates (mutation)
createLinearTicketForStorageCandidates is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Create a Linear issue for a set of storage-optimization candidates or unused tables.
Arguments
| Argument | Type | Description |
|---|---|---|
candidateMcons | [String!]! | MCONs of the selected tables: storage optimization candidates, or unused tables from getStorageUnusedTables. |
details | CreateLinearStorageTicketInput! |
Returns
CreateLinearTicketForStorageCandidates
Example
mutation CreateLinearTicketForStorageCandidates($candidateMcons: [String!]!, $details: CreateLinearStorageTicketInput!) {
createLinearTicketForStorageCandidates(candidateMcons: $candidateMcons, details: $details) {
ticket {
id
provider
identifier
url
coveredMcons
createdTime
}
}
}Types used only by createLinearTicketForStorageCandidates
createLinearTicketForStorageCandidatesCreateLinearStorageTicketInput
CreateLinearStorageTicketInputInput object type. Linear ticket details for a set of storage-optimization candidates.
| Field | Type | Description |
|---|---|---|
title | String! | Ticket title (must be non-empty). |
description | String | Ticket description (Markdown). |
teamId | String | Linear team ID; defaults to the integration's default team. |
CreateLinearTicketForStorageCandidates
CreateLinearTicketForStorageCandidatesObject type.
| Field | Type | Description |
|---|---|---|
ticket | StorageCandidateTicket |
Related types
Source: The GraphQL API reference
This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.
