From 2d299cc4b9fc966f90e65f3f4799d52ec3790c45 Mon Sep 17 00:00:00 2001 From: Pranshu Maheshwari Date: Tue, 19 Nov 2024 11:22:59 -0500 Subject: [PATCH] Added graphql examples --- .../docs/pipelines/observability/metrics.mdx | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/content/docs/pipelines/observability/metrics.mdx b/src/content/docs/pipelines/observability/metrics.mdx index 18652ce02b98353..e5487c0341f7ac0 100644 --- a/src/content/docs/pipelines/observability/metrics.mdx +++ b/src/content/docs/pipelines/observability/metrics.mdx @@ -6,4 +6,61 @@ sidebar: --- -TODO \ No newline at end of file +Pipelines metrics are split across three different nodes under `viewer` > `accounts`. Refer to [Explore the GraphQL schema](/analytics/graphql-api/getting-started/explore-graphql-schema/) to learn how to navigate a GraphQL schema and discover which data are available. + +To learn more about the GraphQL Analytics API, refer to [GraphQL Analytics API](/analytics/graphql-api/). + +You can use the GraphQL API to measure metrics for data ingested, as well as data delivered. + +## Write GraphQL queries + +Examples of how to explore your Pipelines metrics. + +### Measure total bytes & records ingested over time period + +```graphql +query PipelineIngestion($accountTag: string!, $pipelineId: string!, $datetimeStart: Time!, $datetimeEnd: Time!) { + viewer { + accounts(filter: {accountTag: $accountTag}) { + pipelinesIngestionAdaptiveGroups( + limit: 10000 + filter: { + pipelineId: $pipelineId + datetime_geq: $datetimeStart + datetime_leq: $datetimeEnd + } + + ) + { + sum { + ingestedBytes, + ingestedRecords, + } + } + } + } +} +``` + +### Measure volume of data delivered + +```graphql +query PipelineDelivery($accountTag: string!, $queueId: string!, $datetimeStart: Time!, $datetimeEnd: Time!) { + viewer { + accounts(filter: {accountTag: $accountTag}) { + pipelinesDeliveryAdaptiveGroups( + limit: 10000 + filter: { + pipelineId: $queueId + datetime_geq: $datetimeStart + datetime_leq: $datetimeEnd + } + ) { + sum { + deliveredBytes, + } + } + } + } +} +``` \ No newline at end of file