Skip to content

Commit 85632ec

Browse files
authored
Tweak production proxy setup (#129)
* Tweak production proxy setup * Run proxy.js in watch mode * Update test api port
1 parent 5d8b7d2 commit 85632ec

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ Minor differences:
264264

265265
- Resource attributes that come from the server are prefixed with `resource.`. Since we have all attributes available, we need a way to tell which ones belong to the resource and which belong to the span. Tempo is a bit odd: if you request `select(resource.serviceAttributeName)`, it will appear on the span as `serviceAttributeName`, but because you requested it in the select you can trace it back to a resource attribute. In production, however, we receive all values without requesting them, so the `resource.` prefix is necessary to identify which attributes are resource attributes.
266266

267+
PS: The production API needs to run on the `0.0.0.0` interface before `http://host.docker.internal:5259/tempo` can work in the `bun run server:local` setup.
268+
Check if "applicationUrl" in `launchSettings.json` has this.
269+
267270
## API discrepancies
268271

269272
To differentiate between the Grafana Tempo API and the G-Research–flavoured Tempo API, the plugin uses a panel setting called "Enable G-Research Tempo API support". When enabled, the plugin will use the G-Research custom API features like child count support. When disabled, it works with the standard Grafana Tempo API.

local-tempo-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
volumes:
1313
- ./scripts/proxy.js:/app/proxy.js
1414
working_dir: /app
15-
command: bun run proxy.js
15+
command: bun run --watch proxy.js
1616
ports:
1717
- '3200:3200'
1818
extra_hosts:

scripts/proxy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Bun.serve({
22
port: 3200,
33
hostname: '0.0.0.0',
4+
idleTimeout: 255,
45
async fetch(req) {
56
const url = new URL(req.url);
67
const targetPath = url.pathname;
7-
let targetUrl = `http://host.docker.internal:5359/tempo${targetPath}`;
8+
let targetUrl = `http://host.docker.internal:5259/tempo${targetPath}`;
89
if (url.searchParams.size > 0) {
910
targetUrl += `?${url.searchParams.toString()}`;
1011
}

tests/test-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function filterSpansInPlace(filter, response: SearchResponse) {
1515
}
1616

1717
Bun.serve({
18-
port: 5359,
18+
port: 5259,
1919
hostname: '0.0.0.0',
2020
routes: {
2121
'/tempo/api/echo': new Response('echo', { headers: { 'Content-Type': 'text/plain' } }),

0 commit comments

Comments
 (0)