get_context_graph
¶
get_context_graph(
start_time: datetime,
end_time: datetime,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
node_filters: Optional[NodeFilters] = None,
edge_filters: Optional[EdgeFilters] = None,
depth: Optional[int] = None,
max_results: Optional[int] = None,
max_edges_per_node: Optional[int] = None,
include_metadata: Optional[bool] = None,
next_token: Optional[PaginationToken] = None,
) -> GetContextGraphOutput
Queries the context graph with filtering, traversal, and pagination support. Pagination note: nodes and edges are returned together as a coherent subgraph. Pagination cursors advance over nodes (the primary collection); each page includes all edges connecting nodes within that page. Callers should treat nodes as the paginated collection and edges as supplementary relationship data attached to those nodes.
Parameters:
-
node_filters(Optional[NodeFilters], default:None) –Criteria restricting which nodes are returned.
-
edge_filters(Optional[EdgeFilters], default:None) –Criteria restricting which edges are returned.
-
start_time(datetime) –Start of the time range (UTC), inclusive.
-
end_time(datetime) –End of the time range (UTC), inclusive.
-
depth(Optional[int], default:None) –How many hops to traverse out from the nodes matched by nodeFilters. 0 returns only the matched nodes themselves.
-
max_results(Optional[int], default:None) –The maximum number of nodes to return in a single page.
-
max_edges_per_node(Optional[int], default:None) –The maximum number of edges to return per node, bounding the fan-out of a densely connected node.
-
include_metadata(Optional[bool], default:None) –Whether to return the metadata block, semantics included, on each node and edge. Off by default because it costs an extra lookup per returned node.
-
next_token(Optional[PaginationToken], default:None) –Pagination token from a previous response, to retrieve the next page.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Query a service and its immediate dependencies The following example returns context graph nodes matching the filter and traverses one hop out to their direct dependencies, over a one-hour window. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.get_context_graph(node_filters={'nodeType': 'SERVICE', 'namespace': ['ecommerce']}, start_time='2026-09-16T00:00:00Z', end_time='2026-09-16T01:00:00Z', depth=1, max_results=100, include_metadata=False)
Return metric aggregation metadata
The following example returns aggregation metadata for a metric stream observed on a service over a one-hour window. The metric attributes identify its producing service and instrumentation scope; additional data point dimensions can identify multiple time series. The metric lists the operations it measures, and the node's operationDetails gives the dimension sets that select each one. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.get_context_graph(node_filters={'nodeId': 'svc:checkout-service'}, start_time='2026-09-16T00:00:00Z', end_time='2026-09-16T01:00:00Z', depth=0, max_results=1, include_metadata=True)
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 | |