惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
宝玉的分享
宝玉的分享
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
WordPress大学
WordPress大学
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
罗磊的独立博客
The Cloudflare Blog
V
V2EX
月光博客
月光博客
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
GbyAI
GbyAI
博客园 - 【当耐特】
T
Tailwind CSS Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(docker): add observability smoke · openclaw/openclaw...
vincentkoc · 2026-04-27 · via Recent Commits to openclaw:main

@@ -0,0 +1,156 @@

1+

# Docker Prometheus smoke

2+3+

```yaml qa-scenario

4+

id: docker-prometheus-smoke

5+

title: Docker Prometheus smoke

6+

surface: telemetry

7+

coverage:

8+

primary:

9+

- telemetry.prometheus

10+

secondary:

11+

- harness.qa-lab

12+

- docker.e2e

13+

objective: Verify a QA-lab gateway run emits protected, bounded Prometheus diagnostics metrics through the diagnostics-prometheus plugin.

14+

successCriteria:

15+

- The diagnostics-prometheus plugin exposes the protected scrape route.

16+

- An unauthenticated scrape is rejected.

17+

- A minimal QA-channel agent turn completes.

18+

- The authenticated scrape includes release-critical diagnostics metric families.

19+

- Prometheus output omits prompt content, session keys, auth tokens, raw ids, and file paths.

20+

plugins:

21+

- diagnostics-prometheus

22+

gatewayConfigPatch:

23+

diagnostics:

24+

enabled: true

25+

docsRefs:

26+

- docs/gateway/prometheus.md

27+

- docs/concepts/qa-e2e-automation.md

28+

codeRefs:

29+

- extensions/diagnostics-prometheus/src/service.ts

30+

- src/diagnostics/internal-diagnostics.ts

31+

- extensions/qa-lab/src/suite.ts

32+

execution:

33+

kind: flow

34+

summary: Complete a minimal QA-lab turn and scrape the protected Prometheus route.

35+

config:

36+

prompt: Reply exactly DOCKER-PROMETHEUS-OK. Do not repeat DOCKER-PROMETHEUS-SECRET.

37+

secretNeedle: DOCKER-PROMETHEUS-SECRET

38+

```

39+40+

```yaml qa-flow

41+

steps:

42+

- name: emits protected low-cardinality prometheus metrics

43+

actions:

44+

- call: waitForGatewayHealthy

45+

args:

46+

- ref: env

47+

- 60000

48+

- call: waitForQaChannelReady

49+

args:

50+

- ref: env

51+

- 60000

52+

- call: reset

53+

- set: startCursor

54+

value:

55+

expr: state.getSnapshot().messages.length

56+

- call: runAgentPrompt

57+

args:

58+

- ref: env

59+

- sessionKey: agent:qa:docker-prometheus-smoke

60+

message:

61+

expr: config.prompt

62+

timeoutMs:

63+

expr: liveTurnTimeoutMs(env, 30000)

64+

- call: waitForCondition

65+

saveAs: outbound

66+

args:

67+

- lambda:

68+

expr: "state.getSnapshot().messages.slice(startCursor).filter((candidate) => candidate.direction === 'outbound' && candidate.conversation.id === 'qa-operator' && String(candidate.text ?? '').trim().length > 0).at(-1)"

69+

- expr: liveTurnTimeoutMs(env, 30000)

70+

- expr: "env.providerMode === 'mock-openai' ? 100 : 250"

71+

- assert:

72+

expr: "String(outbound.text ?? '').trim().length > 0"

73+

message: "expected non-empty qa output before scraping metrics"

74+

- set: prometheusUrl

75+

value:

76+

expr: "`${env.gateway.baseUrl}/api/diagnostics/prometheus`"

77+

- set: gatewayToken

78+

value:

79+

expr: "String(env.gateway.token ?? env.gateway.runtimeEnv.OPENCLAW_GATEWAY_TOKEN ?? '')"

80+

- assert:

81+

expr: "gatewayToken.length > 0"

82+

message: "expected QA gateway token to be available for protected scrape"

83+

- set: unauthenticatedScrape

84+

value:

85+

expr: |-

86+

(async () => {

87+

const response = await fetch(prometheusUrl);

88+

await response.text().catch(() => "");

89+

return { status: response.status };

90+

})()

91+

- assert:

92+

expr: "unauthenticatedScrape.status === 401 || unauthenticatedScrape.status === 403"

93+

message:

94+

expr: "`expected unauthenticated prometheus scrape to be rejected, got ${unauthenticatedScrape.status}`"

95+

- set: authenticatedScrape

96+

value:

97+

expr: |-

98+

(async () => {

99+

const response = await fetch(prometheusUrl, {

100+

headers: { authorization: `Bearer ${gatewayToken}` },

101+

});

102+

const text = await response.text();

103+

return {

104+

status: response.status,

105+

contentType: response.headers.get("content-type") ?? "",

106+

text,

107+

};

108+

})()

109+

- assert:

110+

expr: "authenticatedScrape.status === 200"

111+

message:

112+

expr: "`expected authenticated prometheus scrape to return 200, got ${authenticatedScrape.status}`"

113+

- assert:

114+

expr: "authenticatedScrape.contentType.includes('text/plain')"

115+

message:

116+

expr: "`expected prometheus text content type, got ${authenticatedScrape.contentType}`"

117+

- set: prometheusText

118+

value:

119+

expr: "String(authenticatedScrape.text ?? '')"

120+

- assert:

121+

expr: "prometheusText.includes('# TYPE openclaw_run_completed_total counter')"

122+

message: "missing run completion counter"

123+

- assert:

124+

expr: "prometheusText.includes('# TYPE openclaw_run_duration_seconds histogram')"

125+

message: "missing run duration histogram"

126+

- assert:

127+

expr: "prometheusText.includes('# TYPE openclaw_model_call_total counter')"

128+

message: "missing model call counter"

129+

- assert:

130+

expr: "prometheusText.includes('# TYPE openclaw_harness_run_total counter')"

131+

message: "missing harness run counter"

132+

- assert:

133+

expr: "!prometheusText.includes(config.secretNeedle)"

134+

message: "prometheus output leaked prompt sentinel"

135+

- assert:

136+

expr: "!prometheusText.includes('DOCKER-PROMETHEUS-OK')"

137+

message: "prometheus output leaked response content"

138+

- assert:

139+

expr: "!prometheusText.includes('agent:qa:docker-prometheus-smoke')"

140+

message: "prometheus output leaked the session key"

141+

- assert:

142+

expr: "!prometheusText.includes(gatewayToken)"

143+

message: "prometheus output leaked the gateway token"

144+

- assert:

145+

expr: "!/runId|sessionId|sessionKey|callId|toolCallId|messageId|providerRequestId/.test(prometheusText)"

146+

message: "prometheus output leaked raw diagnostic identifiers"

147+

- assert:

148+

expr: "!/\\/tmp\\/|\\/private\\/tmp\\/|\\/app\\//.test(prometheusText)"

149+

message: "prometheus output leaked a local file path"

150+

- assert:

151+

expr: "!prometheusText.includes('openclaw.content.')"

152+

message: "prometheus output leaked content attributes"

153+

- assert:

154+

expr: "!/openclaw_prometheus_series_dropped_total(?:\\{[^}]*\\})?\\s+(?!0(?:\\.0+)?(?:\\s|$))/.test(prometheusText)"

155+

message: "prometheus dropped series during the smoke"

156+

```