1916 lines
156 KiB
JSON
1916 lines
156 KiB
JSON
{
|
|
"annotations":{"list":[{"builtIn":1,"datasource":{"type":"grafana","uid":"-- Grafana --"},"enable":true,"hide":true,"iconColor":"#BF6C50","name":"Annotations & Alerts","type":"dashboard"}]},
|
|
"description":"Claude Code Observability",
|
|
"editable":true,
|
|
"fiscalYearStartMonth":0,
|
|
"graphTooltip":1,
|
|
"id":null,
|
|
"links":[],
|
|
"panels":[
|
|
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"panels":[],"title":"Overview","type":"row"},
|
|
{
|
|
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
|
|
"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#BF6C50","value":0}]},"unit":"short"},"overrides":[]},
|
|
"gridPos":{"h":3,"w":3,"x":0,"y":1},
|
|
"id":2,
|
|
"options":{"colorMode":"background","graphMode":"area","justifyMode":"center","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":18,"valueSize":24},"textMode":"value_and_name","wideLayout":true},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"editorMode":"code","expr":"sum(increase({__name__=~\"claude_code.session.count\"}[$__range]))","legendFormat":"Session","range":true,"refId":"A"}],
|
|
"type":"stat"
|
|
},
|
|
{
|
|
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
|
|
"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#BF6C50","value":0}]},"unit":"currencyUSD"},"overrides":[]},
|
|
"gridPos":{"h":3,"w":3,"x":3,"y":1},
|
|
"id":3,
|
|
"options":{"colorMode":"background","graphMode":"area","justifyMode":"center","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":18,"valueSize":24},"textMode":"value_and_name","wideLayout":true},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"editorMode":"code","expr":"sum(increase({__name__=~\"claude_code.cost.usage\"}[$__range]))","legendFormat":"Cost","range":true,"refId":"A"}],
|
|
"type":"stat"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"duration_ms"},"properties":[{"id":"unit","value":"ms"},{"id":"custom.width","value":100},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0},{"color":"#C9A257","value":2000},{"color":"#C45B47","value":5000}]}}]},
|
|
{"matcher":{"id":"byName","options":"SessionID"},"properties":[{"id":"custom.width","value":308},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.SessionID}","url":"/d/claude-code?var-session=${__data.fields.SessionID}&${__url_time_range}"}]}]},{"matcher":{"id":"byName","options":"service.version"},"properties":[{"id":"custom.width","value":120}]},
|
|
{"matcher":{"id":"byName","options":"os.type"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"os.version"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"host.arch"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"terminal.type"},"properties":[{"id":"custom.width","value":133}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"event.name"},
|
|
"properties":[{"id":"custom.width","value":100},{"id":"custom.align","value":"center"},{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1},"tool_decision":{"color":"#5b9cd5","index":3},"tool_result":{"color":"#346f36cc","index":2},"user_prompt":{"color":"#3e668f","index":0}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]
|
|
},
|
|
{"matcher":{"id":"byName","options":"event.timestamp"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"markdown"}},{"id":"custom.minWidth","value":200}]},
|
|
{"matcher":{"id":"byName","options":"len"},"properties":[{"id":"custom.width","value":70},{"id":"unit","value":"short"}]},{"matcher":{"id":"byName","options":"model"},"properties":[{"id":"custom.width","value":139}]},{"matcher":{"id":"byName","options":"input_tokens"},"properties":[{"id":"custom.width","value":110}]},
|
|
{"matcher":{"id":"byName","options":"output_tokens"},"properties":[{"id":"custom.width","value":110}]},{"matcher":{"id":"byName","options":"cache_creation_tokens"},"properties":[{"id":"custom.width","value":170}]},{"matcher":{"id":"byName","options":"cache_read_tokens"},"properties":[{"id":"custom.width","value":170}]},
|
|
{"matcher":{"id":"byName","options":"cost_usd"},"properties":[{"id":"custom.width","value":110},{"id":"decimals","value":5},{"id":"unit","value":"currencyUSD"}]},{"matcher":{"id":"byName","options":"decision_source"},"properties":[{"id":"custom.width","value":130}]},{"matcher":{"id":"byName","options":"decision_type"},"properties":[{"id":"custom.width","value":110}]},
|
|
{"matcher":{"id":"byName","options":"success"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"tool_name"},"properties":[{"id":"custom.width","value":100}]},{"matcher":{"id":"byName","options":"tool_parameters"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":200},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},
|
|
{"matcher":{"id":"byName","options":"tool_result_size_bytes"},"properties":[{"id":"custom.width","value":180}]},{"matcher":{"id":"byName","options":"decision"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"source"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"use_id"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byName","options":"Logs"},"properties":[{"id":"custom.width","value":100}]},{"matcher":{"id":"byName","options":"IP"},"properties":[{"id":"custom.width","value":120},{"id":"links","value":[{"title":"Node Instance : ${__data.fields.IP}","url":"/d/node-instance?var-id=${__data.fields.IP}&{__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"First Seen"},"properties":[{"id":"custom.width","value":160}]},{"matcher":{"id":"byName","options":"Last Seen"},"properties":[{"id":"custom.width","value":160}]},{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":120}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":6,"w":18,"x":6,"y":1},
|
|
"id":56,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:claude ","queryType":"instant","refId":"A"}],
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"_stream_id":true,
|
|
"cache_creation_tokens":true,
|
|
"cache_read_tokens":true,
|
|
"cls":true,
|
|
"cost_usd":true,
|
|
"decision":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"duration_ms":true,
|
|
"error":true,
|
|
"event.name":true,
|
|
"event.timestamp":true,
|
|
"id":true,
|
|
"input_tokens":true,
|
|
"ins":true,
|
|
"ip":false,
|
|
"job":true,
|
|
"labels":true,
|
|
"model":true,
|
|
"output_tokens":true,
|
|
"prompt":true,
|
|
"prompt_length":true,
|
|
"severity":true,
|
|
"source":true,
|
|
"success":true,
|
|
"tool_name":true,
|
|
"tool_parameters":true,
|
|
"tool_result_size_bytes":true,
|
|
"unit":false,
|
|
"use_id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{
|
|
"Line":23,
|
|
"Time":1,
|
|
"_stream_id":26,
|
|
"cache_creation_tokens":19,
|
|
"cache_read_tokens":20,
|
|
"cost_usd":21,
|
|
"decision":35,
|
|
"decision_source":29,
|
|
"decision_type":30,
|
|
"detected_level":24,
|
|
"duration_ms":13,
|
|
"error":37,
|
|
"event.name":12,
|
|
"event.timestamp":11,
|
|
"host.arch":9,
|
|
"input_tokens":17,
|
|
"ip":27,
|
|
"job":28,
|
|
"labels":25,
|
|
"model":16,
|
|
"os.type":7,
|
|
"os.version":8,
|
|
"output_tokens":18,
|
|
"prompt":14,
|
|
"prompt_length":15,
|
|
"scope.name":3,
|
|
"scope.version":4,
|
|
"service.name":5,
|
|
"service.version":6,
|
|
"session.id":0,
|
|
"severity":22,
|
|
"source":36,
|
|
"success":31,
|
|
"terminal.type":10,
|
|
"tool_name":32,
|
|
"tool_parameters":33,
|
|
"tool_result_size_bytes":34,
|
|
"use_id":38,
|
|
"user.id":2
|
|
},
|
|
"renameByName":{"cache_creation_tokens":"","cache_read_tokens":"","duration_ms":"","labels":"","prompt_length":"len","scope.name":"","service.name":"","session.id":"","unit":"","user.id":""}
|
|
}
|
|
},{
|
|
"id":"groupBy",
|
|
"options":{
|
|
"fields":{
|
|
"Time" :{ "aggregations":["min","max","count"],"operation":"aggregate" },
|
|
"host.arch" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"ip" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"os.type" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"os.version" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"scope.name" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"scope.version" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"service.name" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"service.version":{ "aggregations":[] ,"operation":"groupby" },
|
|
"session.id" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"terminal.type" :{ "aggregations":[] ,"operation":"groupby" },
|
|
"user.id" :{ "aggregations":[] ,"operation":"groupby" }
|
|
}
|
|
}
|
|
},{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{"scope.name":true,"scope.version":true},
|
|
"includeByName":{},
|
|
"indexByName":{"Time (count)":2,"Time (max)":4,"Time (min)":3,"host.arch":12,"ip":1,"os.type":10,"os.version":11,"scope.name":6,"scope.version":7,"service.name":8,"service.version":9,"session.id":0,"terminal.type":13,"user.id":5},
|
|
"orderByMode":"manual",
|
|
"renameByName":{"Time (count)":"Logs","Time (max)":"Last Seen","Time (min)":"First Seen","Time (range)":"Time","host.arch":"Arch","ip":"IP","os.type":"OS","os.version":"OS Version","service.name":"Service","service.version":"Version","session.id":"SessionID","terminal.type":"Term","user.id":"UserID"}
|
|
}
|
|
}
|
|
],
|
|
"type":"table"
|
|
},
|
|
{
|
|
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
|
|
"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#BF6C50","value":0}]},"unit":"short"},"overrides":[]},
|
|
"gridPos":{"h":3,"w":3,"x":0,"y":4},
|
|
"id":4,
|
|
"options":{"colorMode":"background","graphMode":"area","justifyMode":"center","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":18,"valueSize":24},"textMode":"value_and_name","wideLayout":true},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"editorMode":"code","expr":"sum(increase({__name__=~\"claude_code.token.usage\"}[$__range]))","legendFormat":"Tokens","range":true,"refId":"A"}],
|
|
"type":"stat"
|
|
},
|
|
{
|
|
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
|
|
"fieldConfig":{"defaults":{"color":{"mode":"thresholds"},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#BF6C50","value":0}]},"unit":"s"},"overrides":[]},
|
|
"gridPos":{"h":3,"w":3,"x":3,"y":4},
|
|
"id":5,
|
|
"options":{"colorMode":"background","graphMode":"area","justifyMode":"center","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":18,"valueSize":24},"textMode":"auto","wideLayout":true},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"editorMode":"code","expr":"sum(increase({__name__=~\"claude_code.active_time.total\"}[$__range]))","legendFormat":"Active Time","range":true,"refId":"A"}],
|
|
"type":"stat"
|
|
},
|
|
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":7},"id":60,"panels":[],"title":"Session : $session","type":"row"},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":24,"x":0,"y":8},
|
|
"id":61,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[
|
|
{ "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.user_prompt session.id:\"$session\" | stats count() as requests" , "legendFormat":"User Prompt" ,"queryType":"statsRange","refId":"A" },
|
|
{ "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats count() as requests" ,"hide":false,"legendFormat":"API Request" ,"queryType":"statsRange","refId":"B" },
|
|
{ "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.tool_decision session.id:\"$session\" | stats count() as requests","hide":false,"legendFormat":"Tool Decision","queryType":"statsRange","refId":"C" },
|
|
{ "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.tool_result session.id:\"$session\" | stats count() as requests" ,"hide":false,"legendFormat":"Tool Result" ,"queryType":"statsRange","refId":"D" }
|
|
],
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"User Prompt \u27a1\ufe0f API Request \u27a1\ufe0f Tool Decision \u27a1\ufe0f Tool\n\nDocs: https://code.claude.com/docs/en/monitoring-usage\n\n\n\nUser Prompt: input prompt content and its length\n\nAPI Requests: Model, token consumption and cost\n\nTool Decision: accept / reject by (Source)\n\nTool: Parameters, result size, error, and use_id",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{"id":"custom.width","value":110},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},
|
|
{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":4}},"type":"special"}]}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":200 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Params"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":180},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.width","value":200},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":21,"w":24,"x":0,"y":12},
|
|
"id":57,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:claude session.id:\"$session\"","queryType":"instant","refId":"A"}],
|
|
"title":"Events",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"Time":true,
|
|
"_stream_id":true,
|
|
"cls":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"event.timestamp":false,
|
|
"host.arch":true,
|
|
"id":true,
|
|
"ins":true,
|
|
"ip":true,
|
|
"job":true,
|
|
"labels":true,
|
|
"os.type":true,
|
|
"os.version":true,
|
|
"scope.name":true,
|
|
"scope.version":true,
|
|
"service.name":true,
|
|
"service.version":true,
|
|
"session.id":true,
|
|
"severity":true,
|
|
"terminal.type":true,
|
|
"unit":false,
|
|
"user.id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{
|
|
"Line":29,
|
|
"Time":0,
|
|
"_stream_id":32,
|
|
"cache_creation_tokens":20,
|
|
"cache_read_tokens":19,
|
|
"cost_usd":21,
|
|
"decision":23,
|
|
"decision_source":27,
|
|
"decision_type":26,
|
|
"detected_level":30,
|
|
"duration_ms":13,
|
|
"error":37,
|
|
"event.name":12,
|
|
"event.timestamp":11,
|
|
"host.arch":9,
|
|
"input_tokens":17,
|
|
"ip":33,
|
|
"job":34,
|
|
"labels":31,
|
|
"model":16,
|
|
"os.type":7,
|
|
"os.version":8,
|
|
"output_tokens":18,
|
|
"prompt":14,
|
|
"prompt_length":15,
|
|
"scope.name":3,
|
|
"scope.version":4,
|
|
"service.name":5,
|
|
"service.version":6,
|
|
"session.id":1,
|
|
"severity":28,
|
|
"source":24,
|
|
"success":25,
|
|
"terminal.type":10,
|
|
"tool_name":22,
|
|
"tool_parameters":35,
|
|
"tool_result_size_bytes":36,
|
|
"use_id":38,
|
|
"user.id":2
|
|
},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Params",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"type":"table"
|
|
},
|
|
{
|
|
"collapsed":true,
|
|
"gridPos":{"h":1,"w":24,"x":0,"y":33},
|
|
"id":55,
|
|
"panels":[
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":24,"x":0,"y":34},
|
|
"id":59,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.user_prompt | stats by (session.id) count() as requests","legendFormat":"{{ session.id }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Prompt by Session",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"User Prompt \u27a1\ufe0f API Request \u27a1\ufe0f Tool Decision \u27a1\ufe0f Tool\n\nDocs: https://code.claude.com/docs/en/monitoring-usage\n\n\n\nUser Prompt: input prompt content and its length\n\nAPI Requests: Model, token consumption and cost\n\nTool Decision: accept / reject by (Source)\n\nTool: Parameters, result size, error, and use_id",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{"id":"custom.width","value":110},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},
|
|
{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":4}},"type":"special"}]}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":150 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Params"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":180},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.width","value":200},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
|
|
{"matcher":{"id":"byName","options":"Seq"},"properties":[{"id":"custom.width","value":50}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":7,"w":24,"x":0,"y":38},
|
|
"id":58,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":true,"displayName":"Time"}]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.user_prompt","queryType":"instant","refId":"A"}],
|
|
"title":"Claude Code Prompts",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"Time":true,
|
|
"_stream_id":true,
|
|
"cls":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"event.name":true,
|
|
"event.timestamp":false,
|
|
"host.arch":true,
|
|
"id":true,
|
|
"ins":true,
|
|
"ip":true,
|
|
"job":true,
|
|
"labels":true,
|
|
"os.type":true,
|
|
"os.version":true,
|
|
"scope.name":true,
|
|
"scope.version":true,
|
|
"service.name":true,
|
|
"service.version":true,
|
|
"session.id":false,
|
|
"severity":true,
|
|
"terminal.type":true,
|
|
"unit":false,
|
|
"user.id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{"Line":17,"Time":0,"_stream_id":20,"detected_level":18,"event.name":14,"event.sequence":3,"event.timestamp":1,"host.arch":12,"ip":21,"job":22,"labels":19,"os.type":10,"os.version":11,"prompt":15,"prompt_length":4,"scope.name":6,"scope.version":7,"service.name":8,"service.version":9,"session.id":2,"severity":16,"terminal.type":13,"user.id":5},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.sequence":"Seq",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Params",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"type":"table"
|
|
}
|
|
],
|
|
"title":"All Sessions",
|
|
"type":"row"
|
|
},
|
|
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":34},"id":65,"panels":[],"title":"User Prompt","type":"row"},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":3,"w":24,"x":0,"y":35},
|
|
"id":66,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":false},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.user_prompt session.id:\"$session\" | stats count() as requests","legendFormat":"Prompt","queryType":"statsRange","refId":"A"}],
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"User Prompt \u27a1\ufe0f API Request \u27a1\ufe0f Tool Decision \u27a1\ufe0f Tool\n\nDocs: https://code.claude.com/docs/en/monitoring-usage\n\n\n\nUser Prompt: input prompt content and its length\n\nAPI Requests: Model, token consumption and cost\n\nTool Decision: accept / reject by (Source)\n\nTool: Parameters, result size, error, and use_id",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{"id":"custom.width","value":110},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},
|
|
{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":4}},"type":"special"}]}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":150 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Params"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":180},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.width","value":200},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
|
|
{"matcher":{"id":"byName","options":"Seq"},"properties":[{"id":"custom.width","value":50}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":8,"w":24,"x":0,"y":38},
|
|
"id":67,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":true,"displayName":"Time"}]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.user_prompt session.id:\"$session\"","queryType":"instant","refId":"A"}],
|
|
"title":"User Prompt",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"Time":true,
|
|
"_stream_id":true,
|
|
"cls":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"event.name":true,
|
|
"event.timestamp":false,
|
|
"host.arch":true,
|
|
"id":true,
|
|
"ins":true,
|
|
"ip":true,
|
|
"job":true,
|
|
"labels":true,
|
|
"os.type":true,
|
|
"os.version":true,
|
|
"scope.name":true,
|
|
"scope.version":true,
|
|
"service.name":true,
|
|
"service.version":true,
|
|
"session.id":false,
|
|
"severity":true,
|
|
"terminal.type":true,
|
|
"unit":false,
|
|
"user.id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{"Line":17,"Time":0,"_stream_id":20,"detected_level":18,"event.name":14,"event.sequence":3,"event.timestamp":1,"host.arch":12,"ip":21,"job":22,"labels":19,"os.type":10,"os.version":11,"prompt":15,"prompt_length":4,"scope.name":6,"scope.version":7,"service.name":8,"service.version":9,"session.id":2,"severity":16,"terminal.type":13,"user.id":5},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.sequence":"Seq",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Params",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"type":"table"
|
|
},
|
|
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":46},"id":69,"panels":[],"title":"API Request","type":"row"},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":5,"w":12,"x":0,"y":47},
|
|
"id":71,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) count() as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"API Request by Model",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":5,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"currencyUSD"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":5,"w":12,"x":12,"y":47},
|
|
"id":76,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) sum(cost_usd) as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Cost by Model",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{"id":"custom.width","value":110},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},
|
|
{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":4}},"type":"special"}]}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} },
|
|
{ "id":"custom.minWidth" ,"value":160 }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}},{"id":"custom.align","value":"auto"}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Parameters"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":80},{"id":"custom.cellOptions","value":{"type":"json-view"}},{"id":"custom.width","value":100}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}},{"id":"custom.minWidth","value":150},{"id":"mappings","value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}]}]},
|
|
{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
|
|
{"matcher":{"id":"byName","options":"Seq"},"properties":[{"id":"custom.width","value":50}]},{"matcher":{"id":"byName","options":"Command"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"json-view"}},{"id":"custom.minWidth","value":300}]},
|
|
{"matcher":{"id":"byName","options":"Bash"},"properties":[{"id":"custom.width","value":80},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Description"},"properties":[{"id":"custom.minWidth","value":200},{"id":"custom.align","value":"left"}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":16,"w":12,"x":0,"y":52},
|
|
"id":70,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":true,"displayName":"Time"}]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\"","queryType":"instant","refId":"A"}],
|
|
"title":"API Requests",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"Time":true,
|
|
"_stream_id":true,
|
|
"cls":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"event.name":true,
|
|
"event.timestamp":false,
|
|
"host.arch":true,
|
|
"id":true,
|
|
"ins":true,
|
|
"ip":true,
|
|
"job":true,
|
|
"labels":true,
|
|
"os.type":true,
|
|
"os.version":true,
|
|
"prompt_length":true,
|
|
"scope.name":true,
|
|
"scope.version":true,
|
|
"service.name":true,
|
|
"service.version":true,
|
|
"session.id":true,
|
|
"severity":true,
|
|
"terminal.type":true,
|
|
"unit":false,
|
|
"user.id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{
|
|
"Line":15,
|
|
"Time":0,
|
|
"_stream_id":18,
|
|
"cache_creation_tokens":26,
|
|
"cache_read_tokens":25,
|
|
"cost_usd":22,
|
|
"detected_level":16,
|
|
"duration_ms":21,
|
|
"event.name":12,
|
|
"event.timestamp":1,
|
|
"host.arch":10,
|
|
"input_tokens":23,
|
|
"ip":19,
|
|
"job":20,
|
|
"labels":17,
|
|
"model":13,
|
|
"os.type":8,
|
|
"os.version":9,
|
|
"output_tokens":24,
|
|
"scope.name":4,
|
|
"scope.version":5,
|
|
"service.name":6,
|
|
"service.version":7,
|
|
"session.id":2,
|
|
"severity":14,
|
|
"terminal.type":11,
|
|
"user.id":3
|
|
},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.sequence":"Seq",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Parameters",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
},
|
|
{"id":"extractFields","options":{"delimiter":",","source":"Parameters"}},
|
|
{"id":"organize","options":{"excludeByName":{},"includeByName":{},"indexByName":{"Elapse":2,"Error":7,"Parameters":9,"Size":3,"Success":4,"Time":0,"Tool":1,"UseID":10,"bash_command":8,"description":6,"full_command":5},"renameByName":{"Error":"Error","Size":"","Success":"","UseID":"","bash_command":"Bash","description":"Description","full_command":"Command"}}}
|
|
],
|
|
"type":"table"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":12,"x":12,"y":52},
|
|
"id":72,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) sum(input_tokens) as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Input Tokens",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":12,"x":12,"y":56},
|
|
"id":73,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) sum(output_tokens) as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Output Tokens",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":12,"x":12,"y":60},
|
|
"id":74,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) sum(cache_read_tokens) as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Cache Read Tokens",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":4,"w":12,"x":12,"y":64},
|
|
"id":75,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.api_request session.id:\"$session\" | stats by (model) sum(cache_creation_tokens) as requests","legendFormat":"{{ model }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Cache Creation Tokens",
|
|
"type":"timeseries"
|
|
},
|
|
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":68},"id":62,"panels":[],"title":"Tool Using","type":"row"},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":5,"w":12,"x":0,"y":69},
|
|
"id":63,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.tool_result session.id:\"$session\" | stats by (tool_name) count() as requests","legendFormat":"{{ tool_name }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Event by Tool Name",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"fieldConfig":{
|
|
"defaults":{
|
|
"color":{"mode":"palette-classic"},
|
|
"custom":{
|
|
"axisBorderShow":false,
|
|
"axisCenteredZero":false,
|
|
"axisColorMode":"text",
|
|
"axisLabel":"",
|
|
"axisPlacement":"auto",
|
|
"barAlignment":0,
|
|
"barWidthFactor":0.6,
|
|
"drawStyle":"bars",
|
|
"fillOpacity":80,
|
|
"gradientMode":"none",
|
|
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
|
|
"insertNulls":false,
|
|
"lineInterpolation":"linear",
|
|
"lineWidth":1,
|
|
"pointSize":5,
|
|
"scaleDistribution":{"type":"linear"},
|
|
"showPoints":"never",
|
|
"showValues":false,
|
|
"spanNulls":false,
|
|
"stacking":{"group":"A","mode":"normal"},
|
|
"thresholdsStyle":{"mode":"off"}
|
|
},
|
|
"decimals":0,
|
|
"mappings":[],
|
|
"thresholds":{"mode":"absolute","steps":[{"color":"#5B8C7A","value":0}]},
|
|
"unit":"short"
|
|
},
|
|
"overrides":[]
|
|
},
|
|
"gridPos":{"h":5,"w":12,"x":12,"y":69},
|
|
"id":68,
|
|
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":true,"mode":"multi","sort":"desc"}},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.tool_result session.id:\"$session\" | stats by (decision_type) count() as requests","legendFormat":"{{ decision_type }}","queryType":"statsRange","refId":"A"}],
|
|
"title":"Accept / Reject",
|
|
"type":"timeseries"
|
|
},
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"User Prompt \u27a1\ufe0f API Request \u27a1\ufe0f Tool Decision \u27a1\ufe0f Tool\n\nDocs: https://code.claude.com/docs/en/monitoring-usage\n\n\n\nUser Prompt: input prompt content and its length\n\nAPI Requests: Model, token consumption and cost\n\nTool Decision: accept / reject by (Source)\n\nTool: Parameters, result size, error, and use_id",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{"id":"custom.width","value":110},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},
|
|
{"id":"mappings","value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":4}},"type":"special"}]}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":150 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}},{"id":"custom.align","value":"auto"}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Parameters"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":80},{"id":"custom.cellOptions","value":{"type":"json-view"}},{"id":"custom.width","value":100}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}},{"id":"custom.minWidth","value":150},{"id":"mappings","value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}]}]},
|
|
{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
|
|
{"matcher":{"id":"byName","options":"Seq"},"properties":[{"id":"custom.width","value":50}]},{"matcher":{"id":"byName","options":"Command"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"json-view"}},{"id":"custom.minWidth","value":300},{"id":"custom.width","value":557}]},
|
|
{"matcher":{"id":"byName","options":"Bash"},"properties":[{"id":"custom.width","value":80},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Description"},"properties":[{"id":"custom.minWidth","value":200},{"id":"custom.align","value":"left"}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":14,"w":24,"x":0,"y":74},
|
|
"id":64,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":true,"displayName":"Time"}]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"_msg:claude_code.tool_result session.id:\"$session\"","queryType":"instant","refId":"A"}],
|
|
"title":"Tool Results",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{
|
|
"Line":true,
|
|
"Time":true,
|
|
"_stream_id":true,
|
|
"cls":true,
|
|
"decision_source":true,
|
|
"decision_type":true,
|
|
"detected_level":true,
|
|
"event.name":true,
|
|
"event.timestamp":false,
|
|
"host.arch":true,
|
|
"id":true,
|
|
"ins":true,
|
|
"ip":true,
|
|
"job":true,
|
|
"labels":true,
|
|
"os.type":true,
|
|
"os.version":true,
|
|
"prompt_length":true,
|
|
"scope.name":true,
|
|
"scope.version":true,
|
|
"service.name":true,
|
|
"service.version":true,
|
|
"session.id":true,
|
|
"severity":true,
|
|
"terminal.type":true,
|
|
"unit":false,
|
|
"user.id":true
|
|
},
|
|
"includeByName":{},
|
|
"indexByName":{
|
|
"Line":15,
|
|
"Time":0,
|
|
"_stream_id":18,
|
|
"decision_source":21,
|
|
"decision_type":22,
|
|
"detected_level":16,
|
|
"duration_ms":23,
|
|
"error":27,
|
|
"event.name":12,
|
|
"event.timestamp":1,
|
|
"host.arch":10,
|
|
"ip":19,
|
|
"job":20,
|
|
"labels":17,
|
|
"os.type":8,
|
|
"os.version":9,
|
|
"scope.name":4,
|
|
"scope.version":5,
|
|
"service.name":6,
|
|
"service.version":7,
|
|
"session.id":2,
|
|
"severity":14,
|
|
"success":24,
|
|
"terminal.type":11,
|
|
"tool_name":13,
|
|
"tool_parameters":25,
|
|
"tool_result_size_bytes":26,
|
|
"use_id":28,
|
|
"user.id":3
|
|
},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.sequence":"Seq",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Parameters",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
},
|
|
{"id":"extractFields","options":{"delimiter":",","source":"Parameters"}},
|
|
{"id":"organize","options":{"excludeByName":{},"includeByName":{},"indexByName":{"Elapse":2,"Error":7,"Parameters":9,"Size":3,"Success":4,"Time":0,"Tool":1,"UseID":10,"bash_command":8,"description":6,"full_command":5},"renameByName":{"Error":"Error","Size":"","Success":"","UseID":"","bash_command":"Bash","description":"Description","full_command":"Command"}}}
|
|
],
|
|
"type":"table"
|
|
},
|
|
{
|
|
"collapsed":true,
|
|
"gridPos":{"h":1,"w":24,"x":0,"y":88},
|
|
"id":50,
|
|
"panels":[
|
|
{
|
|
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
|
|
"description":"https://code.claude.com/docs/en/monitoring-usage",
|
|
"fieldConfig":{
|
|
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":true},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
|
|
"overrides":[
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":160}]},
|
|
{"matcher":{"id":"byName","options":"Session"},"properties":[{"id":"custom.width","value":300},{"id":"custom.cellOptions","value":{"type":"auto"}},{"id":"color","value":{"fixedColor":"#6c6c6ce0","mode":"fixed"}},{"id":"links","value":[{"title":"Claude Code : ${__data.fields.Session}","url":"/d/claude-code?var-session=${__data.fields.Session}&${__url_time_range}"}]}]},
|
|
{"matcher":{"id":"byName","options":"UserID"},"properties":[{"id":"custom.width","value":550}]},{"matcher":{"id":"byName","options":"Scope"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Service"},"properties":[{"id":"custom.width","value":100}]},
|
|
{"matcher":{"id":"byName","options":"Ver"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"OS"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"OS Ver"},"properties":[{"id":"custom.width","value":220}]},{"matcher":{"id":"byName","options":"Arch"},"properties":[{"id":"custom.width","value":60}]},
|
|
{"matcher":{"id":"byName","options":"Term"},"properties":[{"id":"custom.width","value":100}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Event"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":110 },
|
|
{ "id":"custom.align" ,"value":"center" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"api_request":{"color":"#f79f64","index":1,"text":"API"},"tool_decision":{"color":"#5b9cd5","index":3,"text":"Decision"},"tool_result":{"color":"#346f36cc","index":2,"text":"Tool"},"user_prompt":{"color":"#3e668f","index":0,"text":"Prompt"}},"type":"value"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":200}]},{"matcher":{"id":"byName","options":"Prompt"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"custom.minWidth","value":200}]},
|
|
{"matcher":{"id":"byName","options":"Len"},"properties":[{"id":"custom.width","value":60},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Model"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":150 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"custom.align" ,"value":"left" },
|
|
{ "id":"mappings" ,"value":[{"options":{"pattern":"claude-opus.*|glm-4.7.*","result":{"color":"#f79f64","index":0}},"type":"regex"},{"options":{"pattern":"claude-sonnet.*|glm-4.6.*","result":{"color":"#346f36cc","index":1}},"type":"regex"},{"options":{"pattern":"claude-haiku.*|glm-4.5.*","result":{"color":"#5b9cd5","index":2}},"type":"regex"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"pill"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Elapse"},
|
|
"properties":[
|
|
{ "id":"unit" ,"value":"ms" },
|
|
{ "id":"custom.width" ,"value":95 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#fcdb72","value":""},{"color":"#346f36cc","value":100},{"color":"rgba(237, 129, 40, 0.89)","value":1000},{"color":"#d44a3a","value":10000}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Token.In"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Token.Out"},"properties":[{"id":"custom.width","value":90}]},{"matcher":{"id":"byName","options":"T$.Create"},"properties":[{"id":"custom.width","value":90}]},
|
|
{"matcher":{"id":"byName","options":"T$.Read"},"properties":[{"id":"custom.width","value":90},{"id":"unit","value":"short"}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Cost"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"decimals" ,"value":4 },
|
|
{ "id":"unit" ,"value":"currencyUSD" },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":0.001},{"color":"#fcdb72","value":0.01},{"color":"rgba(237, 129, 40, 0.89)","value":0.1},{"color":"#d44a3a","value":1}]} },
|
|
{ "id":"mappings" ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Success"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":75 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-background"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"false":{"color":"#d44a3a","index":1,"text":"failed"},"true":{"color":"#346f36cc","index":0,"text":"success"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}] },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Decision"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Type"},
|
|
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#d44a3a","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Source"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},{
|
|
"matcher":{"id":"byName","options":"Deci.Src"},
|
|
"properties":[
|
|
{ "id":"custom.width" ,"value":80 },
|
|
{ "id":"custom.cellOptions","value":{"type":"color-text"} },
|
|
{ "id":"mappings" ,"value":[{"options":{"config":{"color":"#346f36cc","index":0},"user_abort":{"color":"#cc4637d9","index":3},"user_permanent":{"color":"#3e668f","index":1},"user_reject":{"color":"#b783af","index":4},"user_temporary":{"color":"#5b9cd5","index":2}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":5}},"type":"special"}] }
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Decision2"},"properties":[{"id":"custom.width","value":90},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"mappings","value":[{"options":{"accept":{"color":"#346f36cc","index":0},"reject":{"color":"#cc4637d9","index":1}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]},
|
|
{
|
|
"matcher":{"id":"byName","options":"Tool"},
|
|
"properties":[
|
|
{"id":"custom.width","value":85},{"id":"custom.cellOptions","value":{"type":"color-text"}},
|
|
{
|
|
"id":"mappings",
|
|
"value":[
|
|
{ "options":{"Bash":{"color":"#cc4637d9","index":0},"Edit":{"color":"#f79f64","index":3},"Glob":{"color":"#4bb39ce0","index":5},"Grep":{"color":"#b783af","index":4},"Read":{"color":"#5b9cd5","index":1},"Task":{"color":"#fcdb72","index":6},"WebFetch":{"color":"#ba7552","index":7},"WebSearch":{"color":"#a64d4d","index":8},"Write":{"color":"#346f36cc","index":2}},"type":"value" },
|
|
{ "options":{"match":"null+nan","result":{"color":"transparent","index":9}} ,"type":"special" }
|
|
]
|
|
},
|
|
{"id":"custom.cellOptions","value":{"type":"pill"}}
|
|
]
|
|
},
|
|
{"matcher":{"id":"byName","options":"Params"},"properties":[{"id":"custom.align","value":"left"},{"id":"custom.minWidth","value":180},{"id":"custom.cellOptions","value":{"type":"json-view"}}]},{"matcher":{"id":"byName","options":"Size"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"decbytes"}]},
|
|
{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"custom.width","value":200},{"id":"custom.align","value":"left"},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"color","value":{"fixedColor":"#d44a3a","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"UseID"},"properties":[{"id":"custom.width","value":250}]},
|
|
{"matcher":{"id":"byRegexp","options":"/Token|T\\$.*/"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":100},{"color":"#f79f64","value":1000},{"color":"#cc4637d9","value":10000}]}},{"id":"unit","value":"none"},{"id":"custom.cellOptions","value":{"type":"color-text"}}]}
|
|
]
|
|
},
|
|
"gridPos":{"h":25,"w":24,"x":0,"y":89},
|
|
"id":54,
|
|
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[]},
|
|
"pluginVersion":"12.3.1",
|
|
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:claude ","queryType":"instant","refId":"A"}],
|
|
"title":"Claude Code Logs",
|
|
"transformations":[
|
|
{"id":"extractFields","options":{"format":"auto","jsonPaths":[],"keepTime":false,"replace":false,"source":"labels"}},
|
|
{
|
|
"id":"organize",
|
|
"options":{
|
|
"excludeByName":{"Line":true,"_stream_id":true,"cls":true,"decision_source":true,"decision_type":true,"detected_level":true,"id":true,"ins":true,"ip":true,"job":true,"labels":true,"severity":true,"unit":false},
|
|
"includeByName":{},
|
|
"indexByName":{
|
|
"Line":29,
|
|
"Time":0,
|
|
"_stream_id":32,
|
|
"cache_creation_tokens":20,
|
|
"cache_read_tokens":19,
|
|
"cost_usd":21,
|
|
"decision":23,
|
|
"decision_source":27,
|
|
"decision_type":26,
|
|
"detected_level":30,
|
|
"duration_ms":13,
|
|
"error":37,
|
|
"event.name":12,
|
|
"event.timestamp":11,
|
|
"host.arch":9,
|
|
"input_tokens":17,
|
|
"ip":33,
|
|
"job":34,
|
|
"labels":31,
|
|
"model":16,
|
|
"os.type":7,
|
|
"os.version":8,
|
|
"output_tokens":18,
|
|
"prompt":14,
|
|
"prompt_length":15,
|
|
"scope.name":3,
|
|
"scope.version":4,
|
|
"service.name":5,
|
|
"service.version":6,
|
|
"session.id":1,
|
|
"severity":28,
|
|
"source":24,
|
|
"success":25,
|
|
"terminal.type":10,
|
|
"tool_name":22,
|
|
"tool_parameters":35,
|
|
"tool_result_size_bytes":36,
|
|
"use_id":38,
|
|
"user.id":2
|
|
},
|
|
"renameByName":{
|
|
"cache_creation_tokens":"T$.Create",
|
|
"cache_read_tokens":"T$.Read",
|
|
"cost_usd":"Cost",
|
|
"decision":"Decision",
|
|
"decision_source":"Deci.Src",
|
|
"decision_type":"Decision2",
|
|
"duration_ms":"Elapse",
|
|
"error":"Error",
|
|
"event.name":"Event",
|
|
"event.timestamp":"Time",
|
|
"host.arch":"Arch",
|
|
"input_tokens":"Token.In",
|
|
"labels":"",
|
|
"model":"Model",
|
|
"os.type":"OS",
|
|
"os.version":"OS Ver",
|
|
"output_tokens":"Token.Out",
|
|
"prompt":"Prompt",
|
|
"prompt_length":"Len",
|
|
"scope.name":"Scope",
|
|
"scope.version":"Version",
|
|
"service.name":"Service",
|
|
"service.version":"Ver",
|
|
"session.id":"Session",
|
|
"source":"Source",
|
|
"success":"Success",
|
|
"terminal.type":"Term",
|
|
"tool_name":"Tool",
|
|
"tool_parameters":"Params",
|
|
"tool_result_size_bytes":"Size",
|
|
"unit":"",
|
|
"use_id":"UseID",
|
|
"user.id":"UserID"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"type":"table"
|
|
}
|
|
],
|
|
"title":"Full Logs",
|
|
"type":"row"
|
|
}
|
|
],
|
|
"preload":false,
|
|
"refresh":"30s",
|
|
"schemaVersion":42,
|
|
"tags":["Claude","NODE","Pigsty"],
|
|
"templating":{"list":[{"current":{},"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"definition":"job:claude","description":"Claude Code SessionID","label":"Session","name":"session","options":[],"query":{"field":"session.id","limit":1000,"query":"job:claude","refId":"VictoriaLogsVariableQueryEditor-VariableQuery","type":"fieldValue"},"refresh":1,"regex":"","type":"query"}]},
|
|
"time":{"from":"now-1h","to":"now"},
|
|
"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m"]},
|
|
"timezone":"browser",
|
|
"title":"Claude Code",
|
|
"uid":"claude-code",
|
|
"version":1,
|
|
"weekStart":"",
|
|
"author":"Ruohang Feng (rh@vonng.com)",
|
|
"license":"https://pigsty.io/docs/about/license/"
|
|
} |