Skip to content

Commit edf7b83

Browse files
committed
chore: add some docs
1 parent 3fb3182 commit edf7b83

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

packages/build/docs/tracing.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Tracing in Netlify Build
2+
3+
Netlify Build relies on Open Telemetry tracing to emit trace data:
4+
5+
- https://opentelemetry.io/docs/instrumentation/js/
6+
7+
In production, trace data is exported to [Honeycomb](https://ui.honeycomb.io). Buildbot is responsible for passing over
8+
trace information which allows build executions to be stitched together into a single trace across Buildbot and
9+
`@netlify/build`. The initialisation for this tracing SDK is done
10+
[here](https://github.com/netlify/build/blob/main/packages/build/src/tracing/main.ts). We also use an open telemetry
11+
collector in production.
12+
13+
## Adding more instrumentation
14+
15+
More data can be added by either generating more spans or adding more attributes to relevant stages. Check the Open
16+
Telemetry docs for manual instrumentation:
17+
18+
- https://opentelemetry.io/docs/instrumentation/js/manual/
19+
20+
We also have some utility methods you can leverage to do this:
21+
22+
- https://github.com/netlify/build/blob/main/packages/build/src/tracing/main.ts
23+
24+
## Exporting data locally
25+
26+
You can export trace data when running `@netlify/build` locally, to do so you just need to leverage the `tracing`
27+
[flag properties](https://github.com/netlify/build/blob/main/packages/build/src/core/flags.js#L194) to point to
28+
Honeycomb directly. For example:
29+
30+
```
31+
node packages/build/bin.js --debug --tracing.enabled=true --tracing.apiKey=<honeycomb-tracing-api-key> --tracing.httpProtocol=https --tracing.host=api.honeycomb.io --tracing.port=443 ../my-site
32+
```
33+
34+
The tracing API Key should be an Honeycomb environment API key. If testing things locally you can use the `dev`
35+
environment.

0 commit comments

Comments
 (0)