Files
magpie/internal/gui/assets/plugins/otel/i18n.js
T
yetone ef0a03e137 otel: Langfuse is set up from its host and the project's two keys
A user on X asked for Langfuse built in. magpie could already export to
Langfuse over OTLP, but Settings › Observability had the user type the
endpoint .../api/public/otel and a percent-encoded
Authorization=Basic%20<base64(pk:sk)> header by hand.

Settings › Observability now has a Collector row: OTLP or Langfuse.
With Langfuse, the user picks the host (Cloud EU, Cloud US, or
Self-hosted with an address, which also covers Langfuse's JP and HIPAA
regions) and fills in the public and secret keys. Once both keys are
there, magpie saves:
- the endpoint <host>/api/public/otel;
- Authorization: Basic base64(pk:sk), in otel.headers as before, so the
  secret is stored where it was and a backup without keys leaves it out;
- on a first setup, also x-langfuse-ingestion-version: 4, metrics off and
  export on. langfuse.com/docs/opentelemetry/get-started (read 10-26)
  gives the same header for every region and for self-hosted, and says
  that without it OTLP data can arrive up to 10 minutes late.
A Langfuse endpoint set up by hand opens in this view with its keys
decoded into the fields. Opening it saves nothing. Changing a key or the
host keeps the user's other headers, their metrics and export choices,
and an ingestion header they set or left out. Switching from another
collector leaves that collector's headers behind and does not send them
to Langfuse.

The Observability page moved from app.js into the otel plugin
(assets/plugins/otel/page.js, with i18n.js for its words, in Client),
because app.js had 13 bytes of budget left. The app.js and core budgets
are lowered to what is left (1,321,319 and 1,537,645; app.js is
1,321,313 after rebasing on 2620dc319). "Collector" and "Secret key" go
in the core i18n.js because other files use the same words.

Docs: reference.md's Langfuse paragraph (with the env form for magpie
serve) and the en/zh/ja privacy pages.

Run (macOS):
- go test ./... -timeout 45m -count=1 at the pre-rebase head (parent
  e5dd86965): every package ok but internal/provider, which crashed in
  TestUnreadLoginsWriteErrorsKeepCredentials with "close of synctest
  channel from outside bubble" in filememo.Forget. That is #3632, red on
  main since 091153bf7.
- The whole GUI suite (make test-ui, concurrency 4, Chromium and WebKit)
  at the same head: 16 reds. Each red file was run alone here and at the
  parent e5dd86965. The same reds came back at both: menu-input-scroll
  (#3402), old-webkit (#3403) and plugin-card-update's webkit Update
  (#3079). The parent also failed fonts' webkit run. page-width,
  api-key-theme, panel-arrange, panel-balance-order, own-requests,
  library-mcp-health-wsl and plugin-list-error passed alone here: 137
  passes, 7 fails, all of them the three filed above.
- At the pushed head (rebased on origin/main c87a0179b): the budget
  tests; otel, otel-langfuse, i18n-keys, settings-sections, builtins,
  idle-ticks and page-width, both engines, 58 pass; go test
  ./internal/otlp ./plugins/otel ./internal/gui, all ok except
  TestRestartHandsTheGatewayOver (#3451). That test failed 1 of 8 here
  and 1 of 8 on origin/main dce7fe609.
- Before the rebase: otel-langfuse (new: first setup, US, self-hosted,
  hand setup kept, another collector's headers dropped, 5 languages at
  1100/520/360px) with otel, i18n-keys, settings-sections, builtins,
  readable-focus, segs-press-redraw, ux-safety, dialog-backdrop-drag and
  mono-icon-redraw: 113 pass. go vet for darwin, linux and windows on the
  touched packages; gofmt -l clean.
- Broken by hand: with every save treated as a first setup and the old
  collector's headers carried over, otel-langfuse's "set up by hand keeps
  its values" and "another collector's headers" went red.
- New TestOTelLangfuseSetup: settings saved as the page writes them reach
  a fake collector at /api/public/otel/v1/traces with the Basic header and
  ingestion version 4, and nothing on /v1/metrics.
- Real app: a -tags dev build in a sandbox HOME (ports 3461/3462). I
  drove its real Settings page with Playwright: Langfuse, then
  Self-hosted http://127.0.0.1:3463, then both keys. settings.json got the
  endpoint, Basic header, version 4 and enabled. A gateway request then
  reached a local fake collector at /api/public/otel/v1/traces with
  Authorization Basic base64(pk-lf-real-ui:sk-lf-real-ui) and
  x-langfuse-ingestion-version 4.

Not tried: a real Langfuse Cloud or self-hosted project (no account here),
so Langfuse accepting the spans and how they show in its UI aren't checked.
The TUI and magpie serve still have no Langfuse shortcut; serve takes the
env form in reference.md. The Linux app (WebKitGTK) and Windows weren't
tried; the change is form fields and segs, with no motion.
2026-10-26 15:11:37 +08:00

49 lines
3.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Settings › Observability's own words in each language, the English the
// key: the kernel adds them to i18n.js's (magpie.strings).
magpie.strings({
zh: {
"Langfuse needs only its host and your project's keys; any other OTLP/HTTP collector takes its address and headers": "Langfuse 只需要地址和项目密钥;其他 OTLP/HTTP 采集服务填地址和请求头",
"Langfuse host": "Langfuse 地址",
"Langfuse Cloud's region, or the address of your own Langfuse": "Langfuse Cloud 的区域,或你自己部署的 Langfuse 地址",
"Cloud EU": "Cloud 欧洲",
"Cloud US": "Cloud 美国",
"Self-hosted": "自部署",
"Public key": "公钥",
"From your Langfuse project's Settings › API Keys. Traces go to {url}": "在 Langfuse 项目的 Settings › API Keys 里获取。链路数据发往 {url}",
"Enter your Langfuse address, such as https://langfuse.example.com": "请填写 Langfuse 地址,比如 https://langfuse.example.com",
},
"zh-TW": {
"Langfuse needs only its host and your project's keys; any other OTLP/HTTP collector takes its address and headers": "Langfuse 只需要位址和專案金鑰;其他 OTLP/HTTP 採集服務填位址和請求標頭",
"Langfuse host": "Langfuse 位址",
"Langfuse Cloud's region, or the address of your own Langfuse": "Langfuse Cloud 的區域,或你自行部署的 Langfuse 位址",
"Cloud EU": "Cloud 歐洲",
"Cloud US": "Cloud 美國",
"Self-hosted": "自行部署",
"Public key": "公鑰",
"From your Langfuse project's Settings › API Keys. Traces go to {url}": "在 Langfuse 專案的 Settings › API Keys 取得。鏈路資料傳送到 {url}",
"Enter your Langfuse address, such as https://langfuse.example.com": "請填寫 Langfuse 位址,例如 https://langfuse.example.com",
},
ja: {
"Langfuse needs only its host and your project's keys; any other OTLP/HTTP collector takes its address and headers": "Langfuse はホストとプロジェクトのキーだけで設定できます。ほかの OTLP/HTTP コレクターはアドレスとヘッダーを入力します",
"Langfuse host": "Langfuse のホスト",
"Langfuse Cloud's region, or the address of your own Langfuse": "Langfuse Cloud のリージョン、またはセルフホストした Langfuse のアドレス",
"Cloud EU": "Cloud EU",
"Cloud US": "Cloud US",
"Self-hosted": "セルフホスト",
"Public key": "公開キー",
"From your Langfuse project's Settings › API Keys. Traces go to {url}": "Langfuse プロジェクトの Settings › API Keys で取得します。トレースの送信先は {url} です",
"Enter your Langfuse address, such as https://langfuse.example.com": "Langfuse のアドレスを入力してください(例: https://langfuse.example.com)",
},
de: {
"Langfuse needs only its host and your project's keys; any other OTLP/HTTP collector takes its address and headers": "Langfuse braucht nur seinen Host und die Schlüssel Ihres Projekts; jeder andere OTLP/HTTP-Collector bekommt Adresse und Header",
"Langfuse host": "Langfuse-Host",
"Langfuse Cloud's region, or the address of your own Langfuse": "Die Region von Langfuse Cloud oder die Adresse Ihres eigenen Langfuse",
"Cloud EU": "Cloud EU",
"Cloud US": "Cloud US",
"Self-hosted": "Selbst gehostet",
"Public key": "Öffentlicher Schlüssel",
"From your Langfuse project's Settings › API Keys. Traces go to {url}": "Aus Settings › API Keys Ihres Langfuse-Projekts. Traces gehen an {url}",
"Enter your Langfuse address, such as https://langfuse.example.com": "Geben Sie Ihre Langfuse-Adresse ein, z. B. https://langfuse.example.com",
},
});