@juspay/neurolink 12.17.1 → 12.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist/browser/neurolink.min.js +421 -412
  3. package/dist/cli/commands/proxy.js +455 -259
  4. package/dist/constants/contextWindows.d.ts +2 -0
  5. package/dist/constants/contextWindows.js +4 -0
  6. package/dist/proxy/anthropicBudgetResponse.d.ts +3 -0
  7. package/dist/proxy/anthropicBudgetResponse.js +153 -0
  8. package/dist/proxy/bodyCaptureProcessing.d.ts +1 -0
  9. package/dist/proxy/bodyCaptureProcessing.js +23 -4
  10. package/dist/proxy/bodyCaptureWorker.js +20 -2
  11. package/dist/proxy/codexFallback.d.ts +10 -0
  12. package/dist/proxy/codexFallback.js +108 -24
  13. package/dist/proxy/codexUsage.js +2 -0
  14. package/dist/proxy/globalInstaller.d.ts +32 -1
  15. package/dist/proxy/globalInstaller.js +386 -3
  16. package/dist/proxy/otelLogSink.d.ts +3 -3
  17. package/dist/proxy/otelLogSink.js +137 -144
  18. package/dist/proxy/otlpLogTransport.d.ts +3 -0
  19. package/dist/proxy/otlpLogTransport.js +334 -0
  20. package/dist/proxy/proxyActivity.d.ts +22 -2
  21. package/dist/proxy/proxyActivity.js +114 -9
  22. package/dist/proxy/proxyAnalysis.js +82 -52
  23. package/dist/proxy/proxyClientCancellation.d.ts +7 -0
  24. package/dist/proxy/proxyClientCancellation.js +23 -0
  25. package/dist/proxy/proxyContextPreflight.d.ts +25 -0
  26. package/dist/proxy/proxyContextPreflight.js +337 -0
  27. package/dist/proxy/proxyFailureDetails.d.ts +19 -0
  28. package/dist/proxy/proxyFailureDetails.js +96 -0
  29. package/dist/proxy/proxyLifecycle.js +7 -0
  30. package/dist/proxy/proxyRouteBodyCapture.d.ts +13 -0
  31. package/dist/proxy/proxyRouteBodyCapture.js +112 -0
  32. package/dist/proxy/proxyTokenBudget.d.ts +40 -0
  33. package/dist/proxy/proxyTokenBudget.js +523 -0
  34. package/dist/proxy/proxyTracer.d.ts +3 -2
  35. package/dist/proxy/proxyTracer.js +46 -20
  36. package/dist/proxy/proxyTranslationEngine.d.ts +8 -10
  37. package/dist/proxy/proxyTranslationEngine.js +736 -376
  38. package/dist/proxy/requestLogger.d.ts +1 -0
  39. package/dist/proxy/requestLogger.js +107 -5
  40. package/dist/proxy/restartControl.js +9 -4
  41. package/dist/proxy/rollingWorkerProcess.js +65 -0
  42. package/dist/proxy/rollingWorkerSupervisor.js +7 -0
  43. package/dist/proxy/updateCoordinator.d.ts +14 -1
  44. package/dist/proxy/updateCoordinator.js +57 -2
  45. package/dist/server/routes/claudeProxyRoutes.d.ts +4 -5
  46. package/dist/server/routes/claudeProxyRoutes.js +809 -577
  47. package/dist/server/routes/codexProxyRoutes.js +191 -9
  48. package/dist/server/routes/openaiProxyRoutes.d.ts +1 -1
  49. package/dist/server/routes/openaiProxyRoutes.js +261 -69
  50. package/dist/types/cli.d.ts +3 -0
  51. package/dist/types/codex.d.ts +5 -1
  52. package/dist/types/index.d.ts +2 -0
  53. package/dist/types/index.js +2 -0
  54. package/dist/types/proxy.d.ts +148 -3
  55. package/dist/types/proxy.js +0 -15
  56. package/dist/types/proxyBudget.d.ts +74 -0
  57. package/dist/types/proxyBudget.js +1 -0
  58. package/dist/types/proxyContext.d.ts +35 -0
  59. package/dist/types/proxyContext.js +1 -0
  60. package/docs/assets/dashboards/README.md +37 -0
  61. package/docs/assets/dashboards/neurolink-proxy-observability-dashboard.json +197 -89
  62. package/docs-site/static/search-index.json +1 -1
  63. package/package.json +3 -1
  64. package/scripts/observability/NATIVE-DURABLE.md +63 -0
  65. package/scripts/observability/otel-collector.proxy-native-durable.yaml +93 -0
  66. package/scripts/observability/proxy-telemetry-backend.mjs +32 -5
  67. package/scripts/observability/proxy-telemetry-check.mjs +396 -61
  68. package/scripts/observability/query-proxy-history.mjs +34 -5
@@ -20,7 +20,7 @@
20
20
  "id": "Panel_0001",
21
21
  "type": "metric",
22
22
  "title": "Requests in Range",
23
- "description": "Use this as the top-line traffic count for the selected time window.",
23
+ "description": "Use this as the top-line traffic count for the selected time window. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
24
24
  "config": {
25
25
  "show_legends": false,
26
26
  "legends_position": null,
@@ -78,7 +78,7 @@
78
78
  "queryType": "sql",
79
79
  "queries": [
80
80
  {
81
- "query": "SELECT count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
81
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
82
82
  "vrlFunctionQuery": "",
83
83
  "customQuery": true,
84
84
  "fields": {
@@ -128,7 +128,7 @@
128
128
  "id": "Panel_0002",
129
129
  "type": "metric",
130
130
  "title": "Prompt Tokens (M)",
131
- "description": "Thousands of prompt-side tokens seen by the proxy: uncached input plus cache writes plus cache reads.",
131
+ "description": "Millions of prompt-side tokens seen by the proxy, counting cached input once and each provider usage owner once. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
132
132
  "config": {
133
133
  "show_legends": false,
134
134
  "legends_position": null,
@@ -186,7 +186,7 @@
186
186
  "queryType": "sql",
187
187
  "queries": [
188
188
  {
189
- "query": "SELECT CAST(ROUND(SUM(token_total) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0)+COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) AS token_total FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
189
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(token_total) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END AS token_total FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
190
190
  "vrlFunctionQuery": "",
191
191
  "customQuery": true,
192
192
  "fields": {
@@ -236,7 +236,7 @@
236
236
  "id": "Panel_0003",
237
237
  "type": "metric",
238
238
  "title": "Output Tokens (k)",
239
- "description": "Thousands of completion tokens returned by the proxy in the selected time window.",
239
+ "description": "Thousands of completion tokens returned by the proxy in the selected time window. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
240
240
  "config": {
241
241
  "show_legends": false,
242
242
  "legends_position": null,
@@ -294,7 +294,7 @@
294
294
  "queryType": "sql",
295
295
  "queries": [
296
296
  {
297
- "query": "SELECT CAST(ROUND(SUM(output_tokens) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_output_tokens,0) AS output_tokens FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
297
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(output_tokens) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_output_tokens,0) AS output_tokens FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
298
298
  "vrlFunctionQuery": "",
299
299
  "customQuery": true,
300
300
  "fields": {
@@ -344,7 +344,7 @@
344
344
  "id": "Panel_0004",
345
345
  "type": "metric",
346
346
  "title": "Failed Request Share",
347
- "description": "Percent of proxy requests that ended with an error. Rising values mean user-visible failures.",
347
+ "description": "Percent of proxy requests that ended with an error. Rising values mean user-visible failures. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
348
348
  "config": {
349
349
  "show_legends": false,
350
350
  "legends_position": null,
@@ -402,7 +402,7 @@
402
402
  "queryType": "sql",
403
403
  "queries": [
404
404
  {
405
- "query": "SELECT CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
405
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
406
406
  "vrlFunctionQuery": "",
407
407
  "customQuery": true,
408
408
  "fields": {
@@ -560,7 +560,7 @@
560
560
  "id": "Panel_0006",
561
561
  "type": "metric",
562
562
  "title": "Overloaded Responses",
563
- "description": "Requests rejected as overloaded or capacity-constrained upstream.",
563
+ "description": "Requests rejected as overloaded or capacity-constrained upstream. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
564
564
  "config": {
565
565
  "show_legends": false,
566
566
  "legends_position": null,
@@ -618,7 +618,7 @@
618
618
  "queryType": "sql",
619
619
  "queries": [
620
620
  {
621
- "query": "SELECT SUM(CASE WHEN is_overloaded = true THEN 1 ELSE 0 END) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
621
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT SUM(CASE WHEN is_overloaded = true THEN 1 ELSE 0 END) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
622
622
  "vrlFunctionQuery": "",
623
623
  "customQuery": true,
624
624
  "fields": {
@@ -668,7 +668,7 @@
668
668
  "id": "Panel_0007",
669
669
  "type": "line",
670
670
  "title": "Request Trend (5m)",
671
- "description": "Request volume over time in 5-minute buckets.",
671
+ "description": "Request volume over time in 5-minute buckets. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
672
672
  "config": {
673
673
  "show_legends": true,
674
674
  "legends_position": "bottom",
@@ -726,7 +726,7 @@
726
726
  "queryType": "sql",
727
727
  "queries": [
728
728
  {
729
- "query": "SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
729
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
730
730
  "vrlFunctionQuery": "",
731
731
  "customQuery": true,
732
732
  "fields": {
@@ -785,7 +785,7 @@
785
785
  "id": "Panel_0008",
786
786
  "type": "bar",
787
787
  "title": "Requests by Model",
788
- "description": "Which models are carrying the current load.",
788
+ "description": "Which models are carrying the current load. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
789
789
  "config": {
790
790
  "show_legends": true,
791
791
  "legends_position": "bottom",
@@ -843,7 +843,7 @@
843
843
  "queryType": "sql",
844
844
  "queries": [
845
845
  {
846
- "query": "SELECT ai_model AS x_axis_1, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
846
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT ai_model AS x_axis_1, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' GROUP BY ai_model ORDER BY y_axis_1 DESC",
847
847
  "vrlFunctionQuery": "",
848
848
  "customQuery": true,
849
849
  "fields": {
@@ -896,6 +896,114 @@
896
896
  "htmlContent": "",
897
897
  "markdownContent": "",
898
898
  "customChartContent": ""
899
+ },
900
+ {
901
+ "id": "Panel_integrity_conflicts",
902
+ "type": "metric",
903
+ "title": "Conflicting Producer Events (Excluded)",
904
+ "description": "Producer event identities with contradictory final payloads. Excluded from request, token, and cost totals, so those totals represent only verified records. Run telemetry doctor to inspect every conflicting payload.",
905
+ "config": {
906
+ "show_legends": false,
907
+ "legends_position": null,
908
+ "decimals": 0.0,
909
+ "line_thickness": 1.5,
910
+ "step_value": "0",
911
+ "top_results_others": false,
912
+ "axis_border_show": false,
913
+ "label_option": {
914
+ "position": "inside",
915
+ "rotate": 0.0
916
+ },
917
+ "show_symbol": true,
918
+ "line_interpolation": "smooth",
919
+ "legend_width": {
920
+ "unit": "px"
921
+ },
922
+ "base_map": {
923
+ "type": "osm"
924
+ },
925
+ "map_type": {
926
+ "type": "world"
927
+ },
928
+ "map_view": {
929
+ "zoom": 1.0,
930
+ "lat": 0.0,
931
+ "lng": 0.0
932
+ },
933
+ "map_symbol_style": {
934
+ "size": "by Value",
935
+ "size_by_value": {
936
+ "min": 1.0,
937
+ "max": 100.0
938
+ },
939
+ "size_fixed": 2.0
940
+ },
941
+ "drilldown": [],
942
+ "mark_line": [],
943
+ "override_config": [],
944
+ "connect_nulls": false,
945
+ "no_value_replacement": "",
946
+ "wrap_table_cells": false,
947
+ "table_transpose": false,
948
+ "table_dynamic_columns": false,
949
+ "color": {
950
+ "mode": "palette-classic-by-series",
951
+ "fixedColor": ["#53ca53"],
952
+ "seriesBy": "last"
953
+ },
954
+ "trellis": {
955
+ "layout": null,
956
+ "num_of_columns": 1
957
+ }
958
+ },
959
+ "queryType": "sql",
960
+ "queries": [
961
+ {
962
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT COUNT(*) AS y_axis_1 FROM (SELECT COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)) FROM proxy_final_versions WHERE proxy_versions>1 GROUP BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) conflicts",
963
+ "vrlFunctionQuery": "",
964
+ "customQuery": true,
965
+ "fields": {
966
+ "stream": "neurolink_proxy",
967
+ "stream_type": "logs",
968
+ "x": [],
969
+ "y": [
970
+ {
971
+ "label": "Y-Axis",
972
+ "alias": "y_axis_1",
973
+ "column": "y_axis_1",
974
+ "color": null,
975
+ "aggregationFunction": "sum"
976
+ }
977
+ ],
978
+ "z": [],
979
+ "breakdown": [],
980
+ "filter": {
981
+ "filterType": "group",
982
+ "logicalOperator": "AND",
983
+ "conditions": []
984
+ }
985
+ },
986
+ "config": {
987
+ "promql_legend": "",
988
+ "layer_type": "scatter",
989
+ "weight_fixed": 1.0,
990
+ "limit": 0.0,
991
+ "min": 0.0,
992
+ "max": 100.0,
993
+ "time_shift": []
994
+ }
995
+ }
996
+ ],
997
+ "layout": {
998
+ "x": 0,
999
+ "y": 23,
1000
+ "w": 16,
1001
+ "h": 7,
1002
+ "i": 200
1003
+ },
1004
+ "htmlContent": "",
1005
+ "markdownContent": "",
1006
+ "customChartContent": ""
899
1007
  }
900
1008
  ]
901
1009
  },
@@ -907,7 +1015,7 @@
907
1015
  "id": "Panel_0009",
908
1016
  "type": "metric",
909
1017
  "title": "Failed Requests",
910
- "description": "Raw error count. Use with failed request share to separate traffic growth from reliability regressions.",
1018
+ "description": "Raw error count. Use with failed request share to separate traffic growth from reliability regressions. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
911
1019
  "config": {
912
1020
  "show_legends": false,
913
1021
  "legends_position": null,
@@ -965,7 +1073,7 @@
965
1073
  "queryType": "sql",
966
1074
  "queries": [
967
1075
  {
968
- "query": "SELECT SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
1076
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
969
1077
  "vrlFunctionQuery": "",
970
1078
  "customQuery": true,
971
1079
  "fields": {
@@ -1015,7 +1123,7 @@
1015
1123
  "id": "Panel_0010",
1016
1124
  "type": "metric",
1017
1125
  "title": "Failed Request Share",
1018
- "description": "Percent of requests returning non-success responses.",
1126
+ "description": "Percent of requests returning non-success responses. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1019
1127
  "config": {
1020
1128
  "show_legends": false,
1021
1129
  "legends_position": null,
@@ -1073,7 +1181,7 @@
1073
1181
  "queryType": "sql",
1074
1182
  "queries": [
1075
1183
  {
1076
- "query": "SELECT CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
1184
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
1077
1185
  "vrlFunctionQuery": "",
1078
1186
  "customQuery": true,
1079
1187
  "fields": {
@@ -1123,7 +1231,7 @@
1123
1231
  "id": "Panel_0011",
1124
1232
  "type": "metric",
1125
1233
  "title": "429 Rate-Limit Responses",
1126
- "description": "How often upstream or routing pressure surfaced as HTTP 429 responses.",
1234
+ "description": "How often upstream or routing pressure surfaced as HTTP 429 responses. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1127
1235
  "config": {
1128
1236
  "show_legends": false,
1129
1237
  "legends_position": null,
@@ -1181,7 +1289,7 @@
1181
1289
  "queryType": "sql",
1182
1290
  "queries": [
1183
1291
  {
1184
- "query": "SELECT SUM(CASE WHEN is_rate_limited = true THEN 1 ELSE 0 END) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
1292
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT SUM(CASE WHEN is_rate_limited = true THEN 1 ELSE 0 END) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal'",
1185
1293
  "vrlFunctionQuery": "",
1186
1294
  "customQuery": true,
1187
1295
  "fields": {
@@ -1231,7 +1339,7 @@
1231
1339
  "id": "Panel_0012",
1232
1340
  "type": "line",
1233
1341
  "title": "Failure Trend",
1234
- "description": "When failures started and whether they were isolated or sustained.",
1342
+ "description": "When failures started and whether they were isolated or sustained. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1235
1343
  "config": {
1236
1344
  "show_legends": true,
1237
1345
  "legends_position": "bottom",
@@ -1289,7 +1397,7 @@
1289
1397
  "queryType": "sql",
1290
1398
  "queries": [
1291
1399
  {
1292
- "query": "SELECT histogram(_timestamp, '1 hour') AS x_axis_1, error_type, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND is_error = true GROUP BY x_axis_1, error_type ORDER BY x_axis_1 ASC",
1400
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '1 hour') AS x_axis_1, error_type, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND is_error = true GROUP BY x_axis_1, error_type ORDER BY x_axis_1 ASC",
1293
1401
  "vrlFunctionQuery": "",
1294
1402
  "customQuery": true,
1295
1403
  "fields": {
@@ -1355,7 +1463,7 @@
1355
1463
  "id": "Panel_0013",
1356
1464
  "type": "bar",
1357
1465
  "title": "Failures by Error Type",
1358
- "description": "Breaks failures down by proxy or upstream error category.",
1466
+ "description": "Breaks failures down by proxy or upstream error category. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1359
1467
  "config": {
1360
1468
  "show_legends": true,
1361
1469
  "legends_position": "bottom",
@@ -1413,7 +1521,7 @@
1413
1521
  "queryType": "sql",
1414
1522
  "queries": [
1415
1523
  {
1416
- "query": "SELECT error_type AS x_axis_1, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND is_error = true GROUP BY error_type ORDER BY y_axis_1 DESC",
1524
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT error_type AS x_axis_1, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND is_error = true GROUP BY error_type ORDER BY y_axis_1 DESC",
1417
1525
  "vrlFunctionQuery": "",
1418
1526
  "customQuery": true,
1419
1527
  "fields": {
@@ -1471,7 +1579,7 @@
1471
1579
  "id": "Panel_0014",
1472
1580
  "type": "bar",
1473
1581
  "title": "Failures by Account / Route",
1474
- "description": "Shows whether one account is causing most failures.",
1582
+ "description": "Shows whether one account is causing most failures. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1475
1583
  "config": {
1476
1584
  "show_legends": true,
1477
1585
  "legends_position": "bottom",
@@ -1529,7 +1637,7 @@
1529
1637
  "queryType": "sql",
1530
1638
  "queries": [
1531
1639
  {
1532
- "query": "SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) AND is_error = true GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
1640
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) AND is_error = true GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
1533
1641
  "vrlFunctionQuery": "",
1534
1642
  "customQuery": true,
1535
1643
  "fields": {
@@ -1587,7 +1695,7 @@
1587
1695
  "id": "Panel_0015",
1588
1696
  "type": "bar",
1589
1697
  "title": "Failures by HTTP Status",
1590
- "description": "Which status codes dominate: 401/403 auth, 429 rate limit, 5xx transient, and similar.",
1698
+ "description": "Which status codes dominate: 401/403 auth, 429 rate limit, 5xx transient, and similar. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
1591
1699
  "config": {
1592
1700
  "show_legends": true,
1593
1701
  "legends_position": "bottom",
@@ -1645,7 +1753,7 @@
1645
1753
  "queryType": "sql",
1646
1754
  "queries": [
1647
1755
  {
1648
- "query": "SELECT CAST(http_status_code AS VARCHAR) AS x_axis_1, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND is_error = true GROUP BY http_status_code ORDER BY y_axis_1 DESC",
1756
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(http_status_code AS VARCHAR) AS x_axis_1, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND is_error = true GROUP BY http_status_code ORDER BY y_axis_1 DESC",
1649
1757
  "vrlFunctionQuery": "",
1650
1758
  "customQuery": true,
1651
1759
  "fields": {
@@ -2505,7 +2613,7 @@
2505
2613
  "id": "Panel_0023",
2506
2614
  "type": "metric",
2507
2615
  "title": "Accounts / Routes Used",
2508
- "description": "Distinct accounts that served traffic in the selected time window.",
2616
+ "description": "Distinct accounts that served traffic in the selected time window. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
2509
2617
  "config": {
2510
2618
  "show_legends": false,
2511
2619
  "legends_position": null,
@@ -2563,7 +2671,7 @@
2563
2671
  "queryType": "sql",
2564
2672
  "queries": [
2565
2673
  {
2566
- "query": "SELECT COUNT(DISTINCT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex'))",
2674
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT COUNT(DISTINCT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex'))",
2567
2675
  "vrlFunctionQuery": "",
2568
2676
  "customQuery": true,
2569
2677
  "fields": {
@@ -2613,7 +2721,7 @@
2613
2721
  "id": "Panel_0024",
2614
2722
  "type": "metric",
2615
2723
  "title": "Requests on Busiest Account / Route",
2616
- "description": "How concentrated traffic is on the busiest account. High concentration is expected with fill-first routing.",
2724
+ "description": "How concentrated traffic is on the busiest account. High concentration is expected with fill-first routing. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
2617
2725
  "config": {
2618
2726
  "show_legends": false,
2619
2727
  "legends_position": null,
@@ -2671,7 +2779,7 @@
2671
2779
  "queryType": "sql",
2672
2780
  "queries": [
2673
2781
  {
2674
- "query": "SELECT count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC LIMIT 1",
2782
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC LIMIT 1",
2675
2783
  "vrlFunctionQuery": "",
2676
2784
  "customQuery": true,
2677
2785
  "fields": {
@@ -2721,7 +2829,7 @@
2721
2829
  "id": "Panel_0025",
2722
2830
  "type": "metric",
2723
2831
  "title": "Accounts / Routes with Failures",
2724
- "description": "How many distinct accounts saw at least one failure.",
2832
+ "description": "How many distinct accounts saw at least one failure. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
2725
2833
  "config": {
2726
2834
  "show_legends": false,
2727
2835
  "legends_position": null,
@@ -2779,7 +2887,7 @@
2779
2887
  "queryType": "sql",
2780
2888
  "queries": [
2781
2889
  {
2782
- "query": "SELECT COUNT(DISTINCT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) AND is_error = true",
2890
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT COUNT(DISTINCT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) AND is_error = true",
2783
2891
  "vrlFunctionQuery": "",
2784
2892
  "customQuery": true,
2785
2893
  "fields": {
@@ -2829,7 +2937,7 @@
2829
2937
  "id": "Panel_0026",
2830
2938
  "type": "line",
2831
2939
  "title": "Traffic by Account / Route",
2832
- "description": "Shows how traffic shifted between accounts over time.",
2940
+ "description": "Shows how traffic shifted between accounts over time. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
2833
2941
  "config": {
2834
2942
  "show_legends": true,
2835
2943
  "legends_position": "bottom",
@@ -2887,7 +2995,7 @@
2887
2995
  "queryType": "sql",
2888
2996
  "queries": [
2889
2997
  {
2890
- "query": "SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS account_label, count(*) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY x_axis_1 ASC",
2998
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS account_label, count(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY x_axis_1 ASC",
2891
2999
  "vrlFunctionQuery": "",
2892
3000
  "customQuery": true,
2893
3001
  "fields": {
@@ -2953,7 +3061,7 @@
2953
3061
  "id": "Panel_0027",
2954
3062
  "type": "bar",
2955
3063
  "title": "Tokens by Account / Route (k)",
2956
- "description": "Where token load is landing across accounts.",
3064
+ "description": "Where token load is landing across accounts. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
2957
3065
  "config": {
2958
3066
  "show_legends": true,
2959
3067
  "legends_position": "bottom",
@@ -3011,7 +3119,7 @@
3011
3119
  "queryType": "sql",
3012
3120
  "queries": [
3013
3121
  {
3014
- "query": "SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0) + COALESCE(ai_output_tokens,0)) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
3122
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END+COALESCE(ai_output_tokens,0)) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
3015
3123
  "vrlFunctionQuery": "",
3016
3124
  "customQuery": true,
3017
3125
  "fields": {
@@ -3069,7 +3177,7 @@
3069
3177
  "id": "Panel_0028",
3070
3178
  "type": "bar",
3071
3179
  "title": "Failure Share by Account / Route",
3072
- "description": "Which accounts have materially worse failure rates.",
3180
+ "description": "Which accounts have materially worse failure rates. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
3073
3181
  "config": {
3074
3182
  "show_legends": true,
3075
3183
  "legends_position": "bottom",
@@ -3127,7 +3235,7 @@
3127
3235
  "queryType": "sql",
3128
3236
  "queries": [
3129
3237
  {
3130
- "query": "SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
3238
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(100.0 * SUM(CASE WHEN is_error = true THEN 1 ELSE 0 END) / COUNT(*), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND COALESCE(proxy_accounting_scope, 'client') != 'internal' AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
3131
3239
  "vrlFunctionQuery": "",
3132
3240
  "customQuery": true,
3133
3241
  "fields": {
@@ -3185,7 +3293,7 @@
3185
3293
  "id": "Panel_0029",
3186
3294
  "type": "bar",
3187
3295
  "title": "Input vs Output Tokens by Account / Route",
3188
- "description": "Input versus output token volume by real account or fallback route, shown as raw tokens. Internal final rows are excluded.",
3296
+ "description": "Input versus output token volume by real account or fallback route, shown as raw tokens. Provider usage is counted once on its designated owner, including internal bridge children. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
3189
3297
  "config": {
3190
3298
  "show_legends": true,
3191
3299
  "legends_position": "bottom",
@@ -3243,7 +3351,7 @@
3243
3351
  "queryType": "sql",
3244
3352
  "queries": [
3245
3353
  {
3246
- "query": "SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, 'input' AS token_type, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END UNION ALL SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, 'output' AS token_type, CAST(ROUND(SUM(COALESCE(ai_output_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END",
3354
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, 'input' AS token_type, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END), 0) AS BIGINT) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END UNION ALL SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, 'output' AS token_type, CAST(ROUND(SUM(COALESCE(ai_output_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END",
3247
3355
  "vrlFunctionQuery": "",
3248
3356
  "customQuery": true,
3249
3357
  "fields": {
@@ -4436,7 +4544,7 @@
4436
4544
  "id": "Panel_0040",
4437
4545
  "type": "metric",
4438
4546
  "title": "Prompt Tokens (M)",
4439
- "description": "Thousands of prompt-side tokens in the selected window: uncached input plus cache writes plus cache reads.",
4547
+ "description": "Thousands of prompt-side tokens in the selected window: uncached input plus cache writes plus cache reads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4440
4548
  "config": {
4441
4549
  "show_legends": false,
4442
4550
  "legends_position": null,
@@ -4494,7 +4602,7 @@
4494
4602
  "queryType": "sql",
4495
4603
  "queries": [
4496
4604
  {
4497
- "query": "SELECT CAST(ROUND(SUM(token_total) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0)+COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) AS token_total FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
4605
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(token_total) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END AS token_total FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
4498
4606
  "vrlFunctionQuery": "",
4499
4607
  "customQuery": true,
4500
4608
  "fields": {
@@ -4544,7 +4652,7 @@
4544
4652
  "id": "Panel_0041",
4545
4653
  "type": "metric",
4546
4654
  "title": "Output Tokens (k)",
4547
- "description": "Thousands of completion tokens returned in the selected window.",
4655
+ "description": "Thousands of completion tokens returned in the selected window. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4548
4656
  "config": {
4549
4657
  "show_legends": false,
4550
4658
  "legends_position": null,
@@ -4602,7 +4710,7 @@
4602
4710
  "queryType": "sql",
4603
4711
  "queries": [
4604
4712
  {
4605
- "query": "SELECT CAST(ROUND(SUM(output_tokens) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_output_tokens,0) AS output_tokens FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
4713
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(output_tokens) / 1000.0, 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_output_tokens,0) AS output_tokens FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
4606
4714
  "vrlFunctionQuery": "",
4607
4715
  "customQuery": true,
4608
4716
  "fields": {
@@ -4652,7 +4760,7 @@
4652
4760
  "id": "Panel_0042",
4653
4761
  "type": "metric",
4654
4762
  "title": "Cache Reuse Ratio",
4655
- "description": "Cached prompt tokens reused divided by cached prompt tokens newly written. Values above 1 mean the cache is being reused more than it is being populated.",
4763
+ "description": "Cached prompt tokens reused divided by cached prompt tokens newly written. Values above 1 mean the cache is being reused more than it is being populated. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4656
4764
  "config": {
4657
4765
  "show_legends": false,
4658
4766
  "legends_position": null,
@@ -4710,7 +4818,7 @@
4710
4818
  "queryType": "sql",
4711
4819
  "queries": [
4712
4820
  {
4713
- "query": "SELECT CAST(ROUND(CAST(SUM(cache_read) AS DOUBLE) / NULLIF(SUM(cache_write), 0), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_read_tokens,0) AS cache_read, COALESCE(ai_cache_creation_tokens,0) AS cache_write FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
4821
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(CAST(SUM(cache_read) AS DOUBLE) / NULLIF(SUM(cache_write), 0), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_read_tokens,0) AS cache_read, COALESCE(ai_cache_creation_tokens,0) AS cache_write FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
4714
4822
  "vrlFunctionQuery": "",
4715
4823
  "customQuery": true,
4716
4824
  "fields": {
@@ -4760,7 +4868,7 @@
4760
4868
  "id": "Panel_0043",
4761
4869
  "type": "metric",
4762
4870
  "title": "Cached Prompt Tokens Reused (M)",
4763
- "description": "Thousands of prompt tokens read from existing cache entries. This is actual cache reuse.",
4871
+ "description": "Thousands of prompt tokens read from existing cache entries. This is actual cache reuse. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4764
4872
  "config": {
4765
4873
  "show_legends": false,
4766
4874
  "legends_position": null,
@@ -4818,7 +4926,7 @@
4818
4926
  "queryType": "sql",
4819
4927
  "queries": [
4820
4928
  {
4821
- "query": "SELECT CAST(ROUND(SUM(cache_read) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_read_tokens,0) AS cache_read FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
4929
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(cache_read) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_read_tokens,0) AS cache_read FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
4822
4930
  "vrlFunctionQuery": "",
4823
4931
  "customQuery": true,
4824
4932
  "fields": {
@@ -4868,7 +4976,7 @@
4868
4976
  "id": "Panel_0044",
4869
4977
  "type": "metric",
4870
4978
  "title": "Cached Prompt Tokens Written (M)",
4871
- "description": "Thousands of prompt tokens written into new cache entries on this request. This is cache population, not reuse yet.",
4979
+ "description": "Thousands of prompt tokens written into new cache entries on this request. This is cache population, not reuse yet. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4872
4980
  "config": {
4873
4981
  "show_legends": false,
4874
4982
  "legends_position": null,
@@ -4926,7 +5034,7 @@
4926
5034
  "queryType": "sql",
4927
5035
  "queries": [
4928
5036
  {
4929
- "query": "SELECT CAST(ROUND(SUM(cache_write) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_creation_tokens,0) AS cache_write FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
5037
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(cache_write) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM (SELECT COALESCE(ai_cache_creation_tokens,0) AS cache_write FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
4930
5038
  "vrlFunctionQuery": "",
4931
5039
  "customQuery": true,
4932
5040
  "fields": {
@@ -4976,7 +5084,7 @@
4976
5084
  "id": "Panel_0045",
4977
5085
  "type": "metric",
4978
5086
  "title": "Mean Total Tokens per Request",
4979
- "description": "Average total token volume per request in raw tokens: prompt-side tokens plus output tokens.",
5087
+ "description": "Average total token volume per request in raw tokens: prompt-side tokens plus output tokens. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
4980
5088
  "config": {
4981
5089
  "show_legends": false,
4982
5090
  "legends_position": null,
@@ -5034,7 +5142,7 @@
5034
5142
  "queryType": "sql",
5035
5143
  "queries": [
5036
5144
  {
5037
- "query": "SELECT CAST(ROUND(AVG(token_total), 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0)+COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0)+COALESCE(ai_output_tokens,0) AS token_total FROM neurolink_proxy WHERE http_method IS NOT NULL) t",
5145
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(AVG(token_total), 0) AS BIGINT) AS y_axis_1 FROM (SELECT COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END+COALESCE(ai_output_tokens,0) AS token_total FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id)) t",
5038
5146
  "vrlFunctionQuery": "",
5039
5147
  "customQuery": true,
5040
5148
  "fields": {
@@ -5084,7 +5192,7 @@
5084
5192
  "id": "Panel_0046",
5085
5193
  "type": "line",
5086
5194
  "title": "Input vs Output Tokens per Request (5m)",
5087
- "description": "Average input versus output tokens per request over time in 5-minute buckets, shown as raw tokens.",
5195
+ "description": "Average input versus output tokens per request over time in 5-minute buckets, shown as raw tokens. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5088
5196
  "config": {
5089
5197
  "show_legends": true,
5090
5198
  "legends_position": "bottom",
@@ -5142,7 +5250,7 @@
5142
5250
  "queryType": "sql",
5143
5251
  "queries": [
5144
5252
  {
5145
- "query": "SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'input' AS token_type, CAST(ROUND(AVG(COALESCE(ai_input_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY x_axis_1 UNION ALL SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'output' AS token_type, CAST(ROUND(AVG(COALESCE(ai_output_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
5253
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'input' AS token_type, CAST(ROUND(AVG(COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END), 0) AS BIGINT) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) GROUP BY x_axis_1 UNION ALL SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'output' AS token_type, CAST(ROUND(AVG(COALESCE(ai_output_tokens,0)), 0) AS BIGINT) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
5146
5254
  "vrlFunctionQuery": "",
5147
5255
  "customQuery": true,
5148
5256
  "fields": {
@@ -5208,7 +5316,7 @@
5208
5316
  "id": "Panel_0047",
5209
5317
  "type": "bar",
5210
5318
  "title": "Token Volume by Model (M)",
5211
- "description": "Total token volume by model in thousands, including prompt-side and output tokens.",
5319
+ "description": "Total token volume by model in millions, including prompt-side and output tokens. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5212
5320
  "config": {
5213
5321
  "show_legends": true,
5214
5322
  "legends_position": "bottom",
@@ -5266,7 +5374,7 @@
5266
5374
  "queryType": "sql",
5267
5375
  "queries": [
5268
5376
  {
5269
- "query": "SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0)+COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0)+COALESCE(ai_output_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
5377
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END+COALESCE(ai_output_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) GROUP BY ai_model ORDER BY y_axis_1 DESC",
5270
5378
  "vrlFunctionQuery": "",
5271
5379
  "customQuery": true,
5272
5380
  "fields": {
@@ -5324,7 +5432,7 @@
5324
5432
  "id": "Panel_0048",
5325
5433
  "type": "line",
5326
5434
  "title": "Cache Reuse vs Cache Write Trend (5m, M)",
5327
- "description": "Cached prompt tokens reused versus newly written over time in 5-minute buckets, shown in millions.",
5435
+ "description": "Cached prompt tokens reused versus newly written over time in 5-minute buckets, shown in millions. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5328
5436
  "config": {
5329
5437
  "show_legends": true,
5330
5438
  "legends_position": "bottom",
@@ -5382,7 +5490,7 @@
5382
5490
  "queryType": "sql",
5383
5491
  "queries": [
5384
5492
  {
5385
- "query": "SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'cache_read' AS cache_type, CAST(ROUND(SUM(COALESCE(ai_cache_read_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY x_axis_1 UNION ALL SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'cache_write' AS cache_type, CAST(ROUND(SUM(COALESCE(ai_cache_creation_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
5493
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'cache_read' AS cache_type, CAST(ROUND(SUM(COALESCE(ai_cache_read_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) GROUP BY x_axis_1 UNION ALL SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, 'cache_write' AS cache_type, CAST(ROUND(SUM(COALESCE(ai_cache_creation_tokens,0)) / 1000000.0, 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) GROUP BY x_axis_1 ORDER BY x_axis_1 ASC",
5386
5494
  "vrlFunctionQuery": "",
5387
5495
  "customQuery": true,
5388
5496
  "fields": {
@@ -5569,8 +5677,8 @@
5569
5677
  {
5570
5678
  "id": "Panel_cost_01",
5571
5679
  "type": "metric",
5572
- "title": "Total Cost in Range (est., USD)",
5573
- "description": "SQL-derived total spend over the selected window (tokens x per-model price; estimate).",
5680
+ "title": "Known API-equivalent Cost (USD)",
5681
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5574
5682
  "config": {
5575
5683
  "show_legends": false,
5576
5684
  "legends_position": null,
@@ -5628,7 +5736,7 @@
5628
5736
  "queryType": "sql",
5629
5737
  "queries": [
5630
5738
  {
5631
- "query": "SELECT CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0),2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
5739
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(ai_cost_api_equivalent_usd), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL",
5632
5740
  "vrlFunctionQuery": "",
5633
5741
  "customQuery": true,
5634
5742
  "fields": {
@@ -5677,8 +5785,8 @@
5677
5785
  {
5678
5786
  "id": "Panel_cost_02",
5679
5787
  "type": "metric",
5680
- "title": "Cost per Request (est., USD)",
5681
- "description": "Mean USD cost per proxied request (estimate).",
5788
+ "title": "API Cost per Priced Usage Owner (USD)",
5789
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5682
5790
  "config": {
5683
5791
  "show_legends": false,
5684
5792
  "legends_position": null,
@@ -5736,7 +5844,7 @@
5736
5844
  "queryType": "sql",
5737
5845
  "queries": [
5738
5846
  {
5739
- "query": "SELECT CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0)/NULLIF(COUNT(*),0),4) AS DECIMAL(18,4)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
5847
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(AVG(ai_cost_api_equivalent_usd), 4) AS DECIMAL(18,4)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL",
5740
5848
  "vrlFunctionQuery": "",
5741
5849
  "customQuery": true,
5742
5850
  "fields": {
@@ -5785,8 +5893,8 @@
5785
5893
  {
5786
5894
  "id": "Panel_cost_03",
5787
5895
  "type": "metric",
5788
- "title": "Cache $ Savings (est., USD)",
5789
- "description": "Estimated USD saved by cache reads vs paying full input price (cache-read tokens x (input-cacheRead) rate).",
5896
+ "title": "Known API Cache Savings (USD)",
5897
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5790
5898
  "config": {
5791
5899
  "show_legends": false,
5792
5900
  "legends_position": null,
@@ -5844,7 +5952,7 @@
5844
5952
  "queryType": "sql",
5845
5953
  "queries": [
5846
5954
  {
5847
- "query": "SELECT CAST(ROUND(SUM(COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 13.5 WHEN ai_model LIKE 'claude-opus%' THEN 4.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.9 WHEN ai_model LIKE 'claude-haiku%' THEN 0.72 ELSE 2.7 END) / 1000000.0),2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
5955
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CAST(ROUND(SUM(ai_cost_cache_savings_usd), 2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL",
5848
5956
  "vrlFunctionQuery": "",
5849
5957
  "customQuery": true,
5850
5958
  "fields": {
@@ -5893,8 +6001,8 @@
5893
6001
  {
5894
6002
  "id": "Panel_cost_04",
5895
6003
  "type": "bar",
5896
- "title": "Cost by Account (est., USD)",
5897
- "description": "Estimated spend per account over the window.",
6004
+ "title": "Known API-equivalent Cost by Account (USD)",
6005
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
5898
6006
  "config": {
5899
6007
  "show_legends": true,
5900
6008
  "legends_position": "bottom",
@@ -5952,7 +6060,7 @@
5952
6060
  "queryType": "sql",
5953
6061
  "queries": [
5954
6062
  {
5955
- "query": "SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0),4) AS DECIMAL(18,4)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
6063
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS x_axis_1, CAST(ROUND(SUM(ai_cost_api_equivalent_usd), 4) AS DECIMAL(18,4)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY y_axis_1 DESC",
5956
6064
  "vrlFunctionQuery": "",
5957
6065
  "customQuery": true,
5958
6066
  "fields": {
@@ -6009,8 +6117,8 @@
6009
6117
  {
6010
6118
  "id": "Panel_cost_05",
6011
6119
  "type": "bar",
6012
- "title": "Cost by Model (est., USD)",
6013
- "description": "Estimated spend per model over the window.",
6120
+ "title": "Known API-equivalent Cost by Model (USD)",
6121
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
6014
6122
  "config": {
6015
6123
  "show_legends": true,
6016
6124
  "legends_position": "bottom",
@@ -6068,7 +6176,7 @@
6068
6176
  "queryType": "sql",
6069
6177
  "queries": [
6070
6178
  {
6071
- "query": "SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0),4) AS DECIMAL(18,4)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
6179
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(ai_cost_api_equivalent_usd), 4) AS DECIMAL(18,4)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
6072
6180
  "vrlFunctionQuery": "",
6073
6181
  "customQuery": true,
6074
6182
  "fields": {
@@ -6125,8 +6233,8 @@
6125
6233
  {
6126
6234
  "id": "Panel_cost_06",
6127
6235
  "type": "area-stacked",
6128
- "title": "Cost Trend by Account (5m, est., USD)",
6129
- "description": "Estimated spend over time, broken down by account.",
6236
+ "title": "Known API Cost by Account (5m, USD)",
6237
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
6130
6238
  "config": {
6131
6239
  "show_legends": true,
6132
6240
  "legends_position": "bottom",
@@ -6184,7 +6292,7 @@
6184
6292
  "queryType": "sql",
6185
6293
  "queries": [
6186
6294
  {
6187
- "query": "SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS account_label, CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0),4) AS DECIMAL(18,4)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY x_axis_1 ASC",
6295
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT histogram(_timestamp, '5 minutes') AS x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END AS account_label, CAST(ROUND(SUM(ai_cost_api_equivalent_usd), 4) AS DECIMAL(18,4)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL AND (account_name IS NOT NULL AND account_name != '' OR COALESCE(account_type,'') IN ('ollama','litellm','vertex')) GROUP BY x_axis_1, CASE WHEN account_name IS NOT NULL AND account_name != '' THEN account_name WHEN COALESCE(account_type,'') IN ('ollama','litellm','vertex') THEN account_type ELSE NULL END ORDER BY x_axis_1 ASC",
6188
6296
  "vrlFunctionQuery": "",
6189
6297
  "customQuery": true,
6190
6298
  "fields": {
@@ -6249,8 +6357,8 @@
6249
6357
  {
6250
6358
  "id": "Panel_cost_07",
6251
6359
  "type": "bar",
6252
- "title": "Effective $/1M Tokens by Model (est.)",
6253
- "description": "Blended effective price per million tokens (cache reads pull this below list price).",
6360
+ "title": "Known API Cost per Million Tokens by Model",
6361
+ "description": "API price-table estimates from complete usage and exact model rates only; not subscription billing or quota consumption. Unknown, inferred, and partial usage remain unpriced. Producer retries are deduplicated; conflicting producer identities are excluded and counted in Traffic & Health; telemetry doctor retains their raw payloads. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
6254
6362
  "config": {
6255
6363
  "show_legends": true,
6256
6364
  "legends_position": "bottom",
@@ -6308,7 +6416,7 @@
6308
6416
  "queryType": "sql",
6309
6417
  "queries": [
6310
6418
  {
6311
- "query": "SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0)/NULLIF(SUM(COALESCE(ai_input_tokens,0)+COALESCE(ai_output_tokens,0)+COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0)),0)*1000000.0,2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
6419
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT ai_model AS x_axis_1, CAST(ROUND(SUM(ai_cost_api_equivalent_usd)/NULLIF(SUM(COALESCE(ai_input_tokens,0) + CASE WHEN ai_input_includes_cached_tokens = true THEN 0 ELSE COALESCE(ai_cache_creation_tokens,0)+COALESCE(ai_cache_read_tokens,0) END+COALESCE(ai_output_tokens,0)),0)*1000000.0,2) AS DECIMAL(18,2)) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND ai_pricing_status = 'exact' AND ai_cost_api_equivalent_usd IS NOT NULL GROUP BY ai_model ORDER BY y_axis_1 DESC",
6312
6420
  "vrlFunctionQuery": "",
6313
6421
  "customQuery": true,
6314
6422
  "fields": {
@@ -6365,8 +6473,8 @@
6365
6473
  {
6366
6474
  "id": "Panel_cost_08",
6367
6475
  "type": "metric",
6368
- "title": "Projected Daily Spend (est., USD)",
6369
- "description": "Run-rate: window spend extrapolated to 24h (noisy for short windows).",
6476
+ "title": "Usage Owners Without Exact Pricing",
6477
+ "description": "Usage-owner records without complete usage and exact model rates. Unknown amounts are excluded from known API-equivalent cost totals rather than valued at zero. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
6370
6478
  "config": {
6371
6479
  "show_legends": false,
6372
6480
  "legends_position": null,
@@ -6424,7 +6532,7 @@
6424
6532
  "queryType": "sql",
6425
6533
  "queries": [
6426
6534
  {
6427
- "query": "SELECT CAST(ROUND(SUM(( COALESCE(ai_input_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 15.0 WHEN ai_model LIKE 'claude-opus%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.0 WHEN ai_model LIKE 'claude-haiku%' THEN 0.8 ELSE 3.0 END) + COALESCE(ai_output_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 75.0 WHEN ai_model LIKE 'claude-opus%' THEN 25.0 WHEN ai_model LIKE 'claude-haiku-4%' THEN 5.0 WHEN ai_model LIKE 'claude-haiku%' THEN 4.0 ELSE 15.0 END) + COALESCE(ai_cache_creation_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 18.75 WHEN ai_model LIKE 'claude-opus%' THEN 6.25 WHEN ai_model LIKE 'claude-haiku-4%' THEN 1.25 WHEN ai_model LIKE 'claude-haiku%' THEN 1.0 ELSE 3.75 END) + COALESCE(ai_cache_read_tokens,0) * (CASE WHEN ai_model LIKE 'claude-opus-4-1%' OR ai_model='claude-opus-4' OR ai_model LIKE 'claude-opus-3%' OR ai_model LIKE 'claude-3-opus%' THEN 1.5 WHEN ai_model LIKE 'claude-opus%' THEN 0.5 WHEN ai_model LIKE 'claude-haiku-4%' THEN 0.1 WHEN ai_model LIKE 'claude-haiku%' THEN 0.08 ELSE 0.3 END) ) / 1000000.0)/NULLIF((MAX(_timestamp)-MIN(_timestamp))/1000000.0,0)*86400.0,2) AS DECIMAL(18,2)) AS y_axis_1 FROM neurolink_proxy WHERE http_method IS NOT NULL",
6535
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT COUNT(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND COALESCE(ai_pricing_status,'unavailable') != 'exact'",
6428
6536
  "vrlFunctionQuery": "",
6429
6537
  "customQuery": true,
6430
6538
  "fields": {
@@ -6705,8 +6813,8 @@
6705
6813
  {
6706
6814
  "id": "Panel_cost_11",
6707
6815
  "type": "table",
6708
- "title": "Top Sessions by Cost (est., USD)",
6709
- "description": "Top 20 sessions by estimated USD cost (proxy-computed ai_cost_total, from trace spans).",
6816
+ "title": "Pricing Gaps by Model",
6817
+ "description": "Usage-owner records without complete usage and exact model rates. Unknown amounts are excluded from known API-equivalent cost totals rather than valued at zero. Conflicting producer events are excluded; see the Traffic & Health conflict counter for coverage gaps.",
6710
6818
  "config": {
6711
6819
  "show_legends": true,
6712
6820
  "legends_position": "bottom",
@@ -6764,17 +6872,17 @@
6764
6872
  "queryType": "sql",
6765
6873
  "queries": [
6766
6874
  {
6767
- "query": "SELECT session_id AS x_axis_1, CAST(ROUND(SUM(CAST(ai_cost_total AS DOUBLE)), 4) AS DECIMAL(18,4)) AS y_axis_1 FROM neurolink_proxy WHERE operation_name = 'proxy.request' AND session_id IS NOT NULL AND session_id != '' AND ai_cost_total IS NOT NULL GROUP BY session_id ORDER BY y_axis_1 DESC LIMIT 20",
6875
+ "query": "WITH proxy_final_payloads AS (SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR)), body ORDER BY _timestamp ASC) AS proxy_copy FROM neurolink_proxy WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind,'request_final')='request_final') proxy_copies WHERE proxy_copy=1), proxy_final_versions AS (SELECT *, COUNT(*) OVER (PARTITION BY COALESCE(service_instance_id,''), COALESCE(proxy_event_id,request_id,CAST(_timestamp AS VARCHAR))) AS proxy_versions FROM proxy_final_payloads), proxy_unique_finals AS (SELECT * FROM proxy_final_versions WHERE proxy_versions=1) SELECT ai_model AS x_axis_1, COUNT(*) AS y_axis_1 FROM proxy_unique_finals WHERE http_method IS NOT NULL AND COALESCE(proxy_record_kind, 'request_final') = 'request_final' AND (proxy_usage_owner_request_id IS NULL OR proxy_usage_owner_request_id = request_id) AND COALESCE(ai_pricing_status,'unavailable') != 'exact' GROUP BY ai_model ORDER BY y_axis_1 DESC LIMIT 20",
6768
6876
  "vrlFunctionQuery": "",
6769
6877
  "customQuery": true,
6770
6878
  "fields": {
6771
6879
  "stream": "neurolink_proxy",
6772
- "stream_type": "traces",
6880
+ "stream_type": "logs",
6773
6881
  "x": [
6774
6882
  {
6775
6883
  "label": "Session",
6776
6884
  "alias": "x_axis_1",
6777
- "column": "x_axis_1",
6885
+ "column": "ai_model",
6778
6886
  "color": null,
6779
6887
  "sortBy": "DESC"
6780
6888
  }