From 85ef2afc61c4128d0ff44efeaf7086e6abf01f17 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 10:50:29 +0000 Subject: [PATCH 01/10] feat(charts): test add histogram --- backend/graph-proxy/src/metrics.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/graph-proxy/src/metrics.rs b/backend/graph-proxy/src/metrics.rs index e61ed555f..42838ff58 100644 --- a/backend/graph-proxy/src/metrics.rs +++ b/backend/graph-proxy/src/metrics.rs @@ -11,6 +11,7 @@ pub type MetricsState = Arc; pub struct Metrics { /// Total requests on all routes pub total_requests: Counter, + pub graphql_request_latency_ms: Histogram, } impl Metrics { @@ -23,6 +24,15 @@ impl Metrics { .with_description("The total requests on all routes made since the last restart.") .build(); - Metrics { total_requests } + let graphql_request_latency_ms = meter + .f64_histogram("graph_proxy_graphql_request_latency_ms") + .with_description("GraphQL request latency") + .with_unit("ms") + .build(); + + Metrics { + total_requests, + graphql_request_latency_ms, + } } } From dc970d823e8376a5bd18557a99b06e262c0d3be6 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 12:01:06 +0000 Subject: [PATCH 02/10] feat(charts): test add mod --- backend/graph-proxy/src/graphql/mod.rs | 50 +++++++++++++++++++++----- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/backend/graph-proxy/src/graphql/mod.rs b/backend/graph-proxy/src/graphql/mod.rs index 76f97543a..8bda7b0ad 100644 --- a/backend/graph-proxy/src/graphql/mod.rs +++ b/backend/graph-proxy/src/graphql/mod.rs @@ -116,7 +116,9 @@ pub async fn graphql_handler( auth_token_header: Option>>, request: GraphQLRequest, ) -> GraphQLResponse { + let start = std::time::Instant::now(); let query = request.into_inner(); + let mut request_type = "unparseable"; if let Ok(query) = parse_query(&query.query) { let operation = query.operations; @@ -130,19 +132,34 @@ pub async fn graphql_handler( .map(|operation| operation.1.node.ty) .collect(), }; + let mut has_query = false; + let mut has_mutation = false; for operation in operations { match operation { - async_graphql::parser::types::OperationType::Query => state - .metrics_state - .total_requests - .add(1, &[KeyValue::new("request_type", "query")]), - async_graphql::parser::types::OperationType::Mutation => state - .metrics_state - .total_requests - .add(1, &[KeyValue::new("request_type", "mutation")]), + async_graphql::parser::types::OperationType::Query => { + has_query = true; + state + .metrics_state + .total_requests + .add(1, &[KeyValue::new("request_type", "query")]) + } + async_graphql::parser::types::OperationType::Mutation => { + has_mutation = true; + state + .metrics_state + .total_requests + .add(1, &[KeyValue::new("request_type", "mutation")]) + } async_graphql::parser::types::OperationType::Subscription => {} }; } + request_type = if has_mutation{ + "mutation" + } else if has_query { + "query" + } else { + "query" + }; } else { state .metrics_state @@ -151,7 +168,22 @@ pub async fn graphql_handler( }; let auth_token = auth_token_header.map(|header| header.0); - state.schema.execute(query.data(auth_token)).await.into() + /// state.schema.execute(query.data(auth_token)).await.into() + let response = state.schema.execute(query.data(auth_token)).await; + let elapsed_ms = start.elapsed().as_secs_f64() * 1000.0; + let status = if response.errors.is_empty() { + "ok" + } else { + "error" + }; + state.metrics_state.request_duration_ms.record( + elapsed_ms, + &[ + KeyValue::new("request_type", request_type), + KeyValue::new("status", status), + ], + ); + response.into() } lazy_static! { From e846b56cf505e3c56c8f236e86243b6be24c7b00 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 12:11:31 +0000 Subject: [PATCH 03/10] feat(backend): test --- backend/graph-proxy/src/graphql/mod.rs | 4 ++-- backend/graph-proxy/src/metrics.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/graph-proxy/src/graphql/mod.rs b/backend/graph-proxy/src/graphql/mod.rs index 8bda7b0ad..1ee469fcb 100644 --- a/backend/graph-proxy/src/graphql/mod.rs +++ b/backend/graph-proxy/src/graphql/mod.rs @@ -153,7 +153,7 @@ pub async fn graphql_handler( async_graphql::parser::types::OperationType::Subscription => {} }; } - request_type = if has_mutation{ + request_type = if has_mutation { "mutation" } else if has_query { "query" @@ -168,7 +168,7 @@ pub async fn graphql_handler( }; let auth_token = auth_token_header.map(|header| header.0); - /// state.schema.execute(query.data(auth_token)).await.into() + // state.schema.execute(query.data(auth_token)).await.into() let response = state.schema.execute(query.data(auth_token)).await; let elapsed_ms = start.elapsed().as_secs_f64() * 1000.0; let status = if response.errors.is_empty() { diff --git a/backend/graph-proxy/src/metrics.rs b/backend/graph-proxy/src/metrics.rs index 42838ff58..fb7f59ceb 100644 --- a/backend/graph-proxy/src/metrics.rs +++ b/backend/graph-proxy/src/metrics.rs @@ -11,7 +11,7 @@ pub type MetricsState = Arc; pub struct Metrics { /// Total requests on all routes pub total_requests: Counter, - pub graphql_request_latency_ms: Histogram, + pub request_duration_ms: Histogram, } impl Metrics { @@ -25,14 +25,14 @@ impl Metrics { .build(); let graphql_request_latency_ms = meter - .f64_histogram("graph_proxy_graphql_request_latency_ms") - .with_description("GraphQL request latency") + .f64_histogram("graph_proxy_request_duration_ms") + .with_description("GraphQL request duration") .with_unit("ms") .build(); Metrics { total_requests, - graphql_request_latency_ms, + request_duration_ms, } } } From f9e0d508684abc326dbb292d1483d91a0fc6b318 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 12:17:08 +0000 Subject: [PATCH 04/10] feat(backend): test --- backend/graph-proxy/src/metrics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/graph-proxy/src/metrics.rs b/backend/graph-proxy/src/metrics.rs index fb7f59ceb..f7c2b9310 100644 --- a/backend/graph-proxy/src/metrics.rs +++ b/backend/graph-proxy/src/metrics.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use opentelemetry::metrics::{Counter, MeterProvider}; +use opentelemetry::metrics::{Counter, Histogram, MeterProvider}; use opentelemetry_sdk::metrics::SdkMeterProvider; /// Thread-safe wrapper for OTEL metrics From 7e9ff61eb4c6d9eb8150e0b1613bd520fed87e1c Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 12:22:20 +0000 Subject: [PATCH 05/10] feat(backend): test --- backend/graph-proxy/src/metrics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/graph-proxy/src/metrics.rs b/backend/graph-proxy/src/metrics.rs index f7c2b9310..e5857022d 100644 --- a/backend/graph-proxy/src/metrics.rs +++ b/backend/graph-proxy/src/metrics.rs @@ -24,7 +24,7 @@ impl Metrics { .with_description("The total requests on all routes made since the last restart.") .build(); - let graphql_request_latency_ms = meter + let request_duration_ms = meter .f64_histogram("graph_proxy_request_duration_ms") .with_description("GraphQL request duration") .with_unit("ms") From 09f1b3a86ed995fde5d285f86d2662df38977b78 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Mon, 26 Jan 2026 17:25:24 +0000 Subject: [PATCH 06/10] feat(chart): test --- .github/workflows/_graph_proxy_container.yaml | 4 +++- backend/graph-proxy/src/metrics.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_graph_proxy_container.yaml b/.github/workflows/_graph_proxy_container.yaml index 2b9e0b85e..007750c9d 100644 --- a/.github/workflows/_graph_proxy_container.yaml +++ b/.github/workflows/_graph_proxy_container.yaml @@ -35,6 +35,7 @@ jobs: images: ${{ env.IMAGE_REPOSITORY }} tags: | type=raw,value=${{ steps.tags.outputs.version }} + type=raw,value=branch-${{ github.ref_name }} type=raw,value=latest - name: Set up Docker Buildx @@ -47,7 +48,8 @@ jobs: context: backend file: backend/Dockerfile.graph-proxy target: deploy - push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/graph-proxy@') }} + #push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/graph-proxy@') }} + push: ${{ github.event_name == 'push' && (github.ref_type == 'branch' || startsWith(github.ref, 'refs/tags/graph-proxy@')) }} load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/graph-proxy@')) }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/backend/graph-proxy/src/metrics.rs b/backend/graph-proxy/src/metrics.rs index e5857022d..75ff02de8 100644 --- a/backend/graph-proxy/src/metrics.rs +++ b/backend/graph-proxy/src/metrics.rs @@ -11,6 +11,7 @@ pub type MetricsState = Arc; pub struct Metrics { /// Total requests on all routes pub total_requests: Counter, + /// Request duration on every request pub request_duration_ms: Histogram, } From 6e811fb5b0d56f5b09dd5318d118e6f51257cb58 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Wed, 28 Jan 2026 10:49:23 +0000 Subject: [PATCH 07/10] feat(graph-proxy): test --- backend/graph-proxy/src/graphql/mod.rs | 2 -- backend/graph-proxy/src/graphql/subscription.rs | 3 +++ backend/graph-proxy/src/graphql/workflows.rs | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/graph-proxy/src/graphql/mod.rs b/backend/graph-proxy/src/graphql/mod.rs index 1ee469fcb..d6b05cb44 100644 --- a/backend/graph-proxy/src/graphql/mod.rs +++ b/backend/graph-proxy/src/graphql/mod.rs @@ -155,8 +155,6 @@ pub async fn graphql_handler( } request_type = if has_mutation { "mutation" - } else if has_query { - "query" } else { "query" }; diff --git a/backend/graph-proxy/src/graphql/subscription.rs b/backend/graph-proxy/src/graphql/subscription.rs index eeb3fcb31..74a4fad2c 100644 --- a/backend/graph-proxy/src/graphql/subscription.rs +++ b/backend/graph-proxy/src/graphql/subscription.rs @@ -53,6 +53,8 @@ struct WatchEvent { /// Error returned by API error: Option, } + +/// Get authentication token fn get_auth_token(ctx: &Context<'_>) -> anyhow::Result { ctx.data_unchecked::>>() .as_ref() @@ -203,6 +205,7 @@ impl WorkflowsSubscription { } } +/// message for StreamError #[derive(Debug, Deserialize)] struct StreamError { /// The message associated with the error diff --git a/backend/graph-proxy/src/graphql/workflows.rs b/backend/graph-proxy/src/graphql/workflows.rs index 030db2aeb..57e97b1c2 100644 --- a/backend/graph-proxy/src/graphql/workflows.rs +++ b/backend/graph-proxy/src/graphql/workflows.rs @@ -121,6 +121,7 @@ impl Workflow { } } +/// Metadata for a workflow #[derive(Debug)] pub(super) struct Metadata { /// The name given to the workflow, unique within a given visit @@ -379,6 +380,7 @@ impl Artifact<'_> { } } +/// Get filename of the artifact in s3 bucket fn artifact_filename( manifest: &IoArgoprojWorkflowV1alpha1Artifact, ) -> Result<&str, WorkflowParsingError> { @@ -471,6 +473,7 @@ impl Task { } } +/// Fetch missing task information async fn fetch_missing_task_info( mut url: Url, token: Option>, From 4a72e0842de23a56cc63e6775765d9a308a915ad Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Wed, 28 Jan 2026 10:54:22 +0000 Subject: [PATCH 08/10] feat(graph-proxy): test --- backend/graph-proxy/src/graphql/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/graph-proxy/src/graphql/mod.rs b/backend/graph-proxy/src/graphql/mod.rs index d6b05cb44..072d73fdd 100644 --- a/backend/graph-proxy/src/graphql/mod.rs +++ b/backend/graph-proxy/src/graphql/mod.rs @@ -132,12 +132,10 @@ pub async fn graphql_handler( .map(|operation| operation.1.node.ty) .collect(), }; - let mut has_query = false; let mut has_mutation = false; for operation in operations { match operation { async_graphql::parser::types::OperationType::Query => { - has_query = true; state .metrics_state .total_requests From 648e24d98daf5607527446aa3ee8143f2c4259d1 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Wed, 28 Jan 2026 10:58:21 +0000 Subject: [PATCH 09/10] feat(graph-proxy): test --- backend/graph-proxy/src/graphql/mod.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/backend/graph-proxy/src/graphql/mod.rs b/backend/graph-proxy/src/graphql/mod.rs index 072d73fdd..f6ecbe511 100644 --- a/backend/graph-proxy/src/graphql/mod.rs +++ b/backend/graph-proxy/src/graphql/mod.rs @@ -135,12 +135,10 @@ pub async fn graphql_handler( let mut has_mutation = false; for operation in operations { match operation { - async_graphql::parser::types::OperationType::Query => { - state - .metrics_state - .total_requests - .add(1, &[KeyValue::new("request_type", "query")]) - } + async_graphql::parser::types::OperationType::Query => state + .metrics_state + .total_requests + .add(1, &[KeyValue::new("request_type", "query")]), async_graphql::parser::types::OperationType::Mutation => { has_mutation = true; state @@ -151,11 +149,7 @@ pub async fn graphql_handler( async_graphql::parser::types::OperationType::Subscription => {} }; } - request_type = if has_mutation { - "mutation" - } else { - "query" - }; + request_type = if has_mutation { "mutation" } else { "query" }; } else { state .metrics_state From e26cd9b8285c04f6441d98f217aa0ead07f3c334 Mon Sep 17 00:00:00 2001 From: Sze Ching Date: Wed, 28 Jan 2026 16:50:53 +0000 Subject: [PATCH 10/10] feat(ci): test --- .github/workflows/_graph_proxy_container.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_graph_proxy_container.yaml b/.github/workflows/_graph_proxy_container.yaml index 007750c9d..2f76053ab 100644 --- a/.github/workflows/_graph_proxy_container.yaml +++ b/.github/workflows/_graph_proxy_container.yaml @@ -35,7 +35,7 @@ jobs: images: ${{ env.IMAGE_REPOSITORY }} tags: | type=raw,value=${{ steps.tags.outputs.version }} - type=raw,value=branch-${{ github.ref_name }} + type=raw,value=${{ github.ref_name }} type=raw,value=latest - name: Set up Docker Buildx