diff --git a/zipkin-lens/README.md b/zipkin-lens/README.md index 9c836b0f88a..41e1b27ff76 100644 --- a/zipkin-lens/README.md +++ b/zipkin-lens/README.md @@ -19,6 +19,9 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. +By default, API requests are proxied to `http://localhost:9411`. You can change this target using +the `API_BASE` environment variable, e.g., `API_BASE=http://tracing.company.com npm start`. + ### `npm test` Launches the test runner in the interactive watch mode.
diff --git a/zipkin-lens/package.json b/zipkin-lens/package.json index 279c49dc4a0..e2454a8145d 100755 --- a/zipkin-lens/package.json +++ b/zipkin-lens/package.json @@ -51,6 +51,7 @@ "eslint-plugin-react-hooks": "^1.6.1", "fetch-mock": "^7.3.0", "history": "^4.10.1", + "http-proxy-middleware": "^1.0.3", "lodash": "^4.17.14", "moment": "^2.24.0", "mvy": "0.2.1", @@ -99,6 +100,5 @@ "last 1 firefox version", "last 1 safari version" ] - }, - "proxy": "http://localhost:9411" + } } diff --git a/zipkin-lens/src/components/TracePage/TraceSummaryHeader.jsx b/zipkin-lens/src/components/TracePage/TraceSummaryHeader.jsx index 56b65b1a30d..205cdfd7f0d 100644 --- a/zipkin-lens/src/components/TracePage/TraceSummaryHeader.jsx +++ b/zipkin-lens/src/components/TracePage/TraceSummaryHeader.jsx @@ -106,6 +106,10 @@ const TraceSummaryHeader = React.memo(({ traceSummary, rootSpanIndex }) => { ? config.logsUrl.replace(/{traceId}/g, traceSummary.traceId) : undefined; + const traceJsonUrl = traceSummary + ? `${api.TRACE}/${traceSummary.traceId}` + : undefined; + const archivePostUrl = config.archivePostUrl && traceSummary ? config.archivePostUrl : undefined; @@ -180,24 +184,6 @@ const TraceSummaryHeader = React.memo(({ traceSummary, rootSpanIndex }) => { }); }, [archivePostUrl, archiveUrl, traceSummary, enqueueSnackbar]); - const handleSaveButtonClick = useCallback(() => { - if (!traceSummary || !traceSummary.traceId) { - return; - } - fetch(`${api.TRACE}/${traceSummary.traceId}`) - .then((resp) => resp.blob()) - .then((blob) => { - const a = document.createElement('a'); - a.href = window.URL.createObjectURL(blob); - a.download = `${traceSummary.traceId}.json`; - a.click(); - // See: https://stackoverflow.com/questions/30694453/blob-createobjecturl-download-not-working-in-firefox-but-works-when-debugging - setTimeout(() => { - window.URL.revokeObjectURL(a.href); - }, 100); - }); - }, [traceSummary]); - const traceInfo = traceSummary ? ( {[ @@ -255,7 +241,9 @@ const TraceSummaryHeader = React.memo(({ traceSummary, rootSpanIndex }) => {