Skip to content

Commit 9d1491c

Browse files
authored
docs: create how-to-guides section (#708)
1 parent 5e2f7ca commit 9d1491c

20 files changed

+70
-47
lines changed

docs/guides/onboarding-checklist/add-auto-tracing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ main()
2222
```
2323

2424
!!! note
25-
Generator functions will not be traced for reasons explained [here](../advanced/generators.md).
25+
Generator functions will not be traced for reasons explained [here](../../reference/advanced/generators.md).
2626

2727
## Only tracing functions above a minimum duration
2828

docs/guides/web-ui/live.md

+17-8
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ To search the live view, click `Search your spans` (keyboard shortcut `/`), this
1212

1313
### SQL Search
1414

15-
For confident SQL users, write your queries directly here. For devs who want a bit of help, try the new [PydanticAI](https://ai.pydantic.dev/) feature which generates a SQL query based on your prompt. You can also review the fields available and populate your SQL automatically using the `Reference` list, see more on this below.
15+
For confident SQL users, write your queries directly here. For devs who want a bit of help,
16+
try the new [PydanticAI](https://ai.pydantic.dev/) feature which generates a SQL query based on your prompt.
17+
You can also review the fields available and populate your SQL automatically using the `Reference` list, see more on this below.
1618

17-
**WHERE clause**
18-
As the greyed out `SELECT * FROM RECORDS WHERE` implies, you're searching inside the `WHERE` clause of a SQL query. It has auto-complete & schema hints, so try typing something to get a reminder. To run your query click `Run` or keyboard shortcut `cmd+enter` (or `ctrl+enter` on windows/linux).
19+
**WHERE clause**
20+
As the greyed out `SELECT * FROM RECORDS WHERE` implies, you're searching inside the `WHERE` clause of a SQL query.
21+
It has auto-complete & schema hints, so try typing something to get a reminder. To run your query click `Run` or
22+
keyboard shortcut `cmd+enter` (or `ctrl+enter` on Windows/Linux).
1923

2024
Note: you can run more complex queries on the [explore screen](explore.md)
2125

@@ -62,7 +66,7 @@ If you're not sure where to start, scroll down to the `Start here` for beginner-
6266

6367
### Ask in Language -> Get SQL
6468

65-
Write your question in your native language, and the model will convert that question to a SQL query.
69+
Write your question in your native language, and the model will convert that question to a SQL query.
6670

6771
![Search box natural language](../../images/guide/live-view-natural-language.png)
6872

@@ -74,18 +78,23 @@ Under the hood this feature uses an LLM running with [PydanticAI](https://github
7478

7579
Reference: A list of pre-populated query clauses. Clicking any of the clauses will populate the SQL editor, and (where applicable) you can choose a value from the autopopulated dropdown.
7680

77-
This list gives you a powerful way to rapidly generate the query you need, while simultaneously learning more about all the ways you can search your data. Clicking multiple clauses will add them to your query with a SQL `AND` statement. If you'd like something other than an `AND` statement, you can replace this with alternative SQL operators like `OR`, or `NOT`.
78-
81+
This list gives you a powerful way to rapidly generate the query you need, while simultaneously
82+
learning more about all the ways you can search your data. Clicking multiple clauses will add them
83+
to your query with a SQL `AND` statement. If you'd like something other than an `AND` statement, you
84+
can replace this with alternative SQL operators like `OR`, or `NOT`.
7985

8086
## Details panel closed
8187

8288
![Logfire live view collapsed](../../images/guide/live-view-collapsed-annotated.png)
8389

8490
This is what you'll see when you come to the live view of a project with some data.
8591

86-
1. **Organization and project labels:** In this example, the organization is `christophergs`, and the project is `docs-app`. You can click the organization name to go to the organization overview page; the project name is a link to this page.
92+
1. **Organization and project labels:** In this example, the organization is `christophergs`, and
93+
the project is `docs-app`. You can click the organization name to go to the organization overview page;
94+
the project name is a link to this page.
8795

88-
2. **Environment:** In the above screenshot, this is set to `all envs`. See the [environments docs](../advanced/environments.md) for details.
96+
2. **Environment:** In the above screenshot, this is set to `all envs`.
97+
See the [environments docs](../../how-to-guides/environments.md) for details.
8998

9099
3. **Timeline:** This shows a histogram of the counts of spans matching your query over time. The blue-highlighted section corresponds to the time range currently visible in the scrollable list of traces below. You can click at points on this line to move to viewing logs from that point in time.
91100

docs/guides/advanced/alternative-clients.md renamed to docs/how-to-guides/alternative-clients.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ these [environment variables](https://opentelemetry.io/docs/languages/sdk-config
77
- `OTEL_EXPORTER_OTLP_ENDPOINT=https://logfire-api.pydantic.dev` for both traces and metrics, or:
88
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://logfire-api.pydantic.dev/v1/traces` for just traces
99
- `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://logfire-api.pydantic.dev/v1/metrics` for just metrics
10-
- `OTEL_EXPORTER_OTLP_HEADERS='Authorization=your-write-token'` - see [Creating Write Tokens](./creating-write-tokens.md)
10+
- `OTEL_EXPORTER_OTLP_HEADERS='Authorization=your-write-token'` - see [Create Write Tokens](./create-write-tokens.md)
1111
to obtain a write token and replace `your-write-token` with it.
1212
- `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf` to export in Protobuf format over HTTP (not gRPC).
1313
The **Logfire** backend supports both Protobuf and JSON, but only over HTTP for now. Some SDKs (such as Python) already use this value as the default so setting this isn't required, but other SDKs use `grpc` as the default.

docs/guides/advanced/creating-write-tokens.md renamed to docs/how-to-guides/create-write-tokens.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
To send data to **Logfire**, you need to create a write token.
22
A write token is a unique identifier that allows you to send data to a specific **Logfire** project.
3-
If you set up Logfire according to the [getting started guide](../../index.md), you already have a write token locally tied to the project you created.
3+
If you set up Logfire according to the [getting started guide](../index.md), you already have a write token locally tied to the project you created.
44
But if you want to configure other computers to write to that project, for example in a deployed application, you need to create a new write token.
55

66
You can create a write token by following these steps:

docs/guides/advanced/environments.md renamed to docs/how-to-guides/environments.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ If you are using languages other than Python, you can set the environment like t
2323
---
2424

2525
Once set, you will see your environment in the Logfire UI `all envs` dropdown,
26-
which is present on the [Live View](../web-ui/live.md), [Dashboards](../web-ui/dashboards.md) and [Explore](../web-ui/explore.md) pages:
26+
which is present on the [Live View](../guides/web-ui/live.md), [Dashboards](../guides/web-ui/dashboards.md)
27+
and [Explore](../guides/web-ui/explore.md) pages:
2728

28-
![Environments](../../images/guide/environments.png)
29+
![Environments](../images/guide/environments.png)
2930

3031
!!! info
3132
When using an environment for the first time, it may take a **few minutes** for the environment to appear in the UI.
@@ -55,5 +56,5 @@ environment name.
5556
## Should I use environments or projects?
5657

5758
Environments are more lightweight than projects. Projects give you the ability to assign specific
58-
user groups and permissions levels (see this [organization structure diagram](../../reference/organization-structure.md)
59+
user groups and permissions levels (see this [organization structure diagram](../reference/organization-structure.md)
5960
for details). So if you need to allow different team members to view dev vs. prod traces, then projects would be a better fit.

docs/guides/advanced/link-to-code-source.md renamed to docs/how-to-guides/link-to-code-source.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
We support linking to the source code on GitHub, GitLab, and any other VCS provider that uses the same URL format.
77

8-
![Link to GitHub](../../images/guide/link-to-github.gif)
8+
![Link to GitHub](../images/guide/link-to-github.gif)
99

1010
## Usage
1111

@@ -40,5 +40,5 @@ OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},vcs.repository.ref.revision
4040
OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},vcs.root.path=.
4141
```
4242

43-
[help]: ../../help.md
43+
[help]: ../help.md
4444
[otel-resource-attributes]: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration

docs/guides/advanced/query-api.md renamed to docs/how-to-guides/query-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ See [here](#additional-configuration) for more details about the available respo
1010

1111
## How to Create a Read Token
1212

13-
If you've set up Logfire following the [getting started guide](../../index.md), you can generate read tokens from
13+
If you've set up Logfire following the [getting started guide](../index.md), you can generate read tokens from
1414
the Logfire web interface, for use accessing the Logfire Query API.
1515

1616
To create a read token:
File renamed without changes.

docs/guides/advanced/scrubbing.md renamed to docs/how-to-guides/scrubbing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ User details: User(id=123, password='secret')
8585
This is necessary so that safe messages such as 'Password is correct' are not redacted completely.
8686

8787
Using f-strings (e.g. `logfire.info(f'User details: {user}')`) *is* safe if `inspect_arguments` is enabled (the default in Python 3.11+) and working correctly.
88-
[See here](../onboarding-checklist/add-manual-tracing.md#f-strings) for more information.
88+
[See here](../guides/onboarding-checklist/add-manual-tracing.md#f-strings) for more information.
8989

90-
In short, don't format the message yourself. This is also a good practice in general for [other reasons](../onboarding-checklist/add-manual-tracing.md#messages-and-span-names).
90+
In short, don't format the message yourself. This is also a good practice in general for [other reasons](../guides/onboarding-checklist/add-manual-tracing.md#messages-and-span-names).
9191

9292
### Keep sensitive data out of URLs
9393

docs/index.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ logfire auth
5252
## Instrument your project {#instrument}
5353
=== ":material-cog-outline: Development"
5454
!!! tip "Development setup"
55-
During development, we recommend using the CLI to configure Logfire. You can also use a [write token](guides/advanced/creating-write-tokens.md).
55+
During development, we recommend using the CLI to configure Logfire.
56+
You can also use a [write token](how-to-guides/create-write-tokens.md).
5657

5758
1. Set your project
5859

@@ -72,8 +73,8 @@ logfire auth
7273
logfire.info('Hello, {name}!', name='world') # (2)!
7374
```
7475

75-
1. The `configure()` method should be called once before logging to initialize **Logfire**.
76-
2. This will log `Hello world!` with `info` level.
76+
3. The `configure()` method should be called once before logging to initialize **Logfire**.
77+
4. This will log `Hello world!` with `info` level.
7778

7879
!!! info ""
7980
Other [log levels][logfire.Logfire] are also available to use, including `trace`, `debug`, `notice`, `warn`,

docs/integrations/event-streams/airflow.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,4 @@ otel_task_log_event = True
162162
[OpenTelemetry Collector]: https://opentelemetry.io/docs/collector/
163163
[OpenTelemetry Collector installation]: https://opentelemetry.io/docs/collector/installation/
164164
[OpenTelemetry Collector Receiver]: https://opentelemetry.io/docs/collector/configuration/#receivers
165-
[write-token]: ../../guides/advanced/creating-write-tokens.md
165+
[write-token]: ../../how-to-guides/create-write-tokens.md

docs/integrations/web-frameworks/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To replace the `Authorization` header value with `[REDACTED]` to avoid leaking u
4747
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS="Authorization"
4848
```
4949

50-
(although usually it's better to rely on **Logfire**'s [scrubbing](../../guides/advanced/scrubbing.md) feature)
50+
(although usually it's better to rely on **Logfire**'s [scrubbing](../../how-to-guides/scrubbing.md) feature)
5151

5252
## Query HTTP requests duration per percentile
5353

File renamed without changes.

docs/reference/examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This example is a simple Python financial calculator app using Flask and SQLAlch
1818

1919
## JavaScript
2020

21-
Currently we only have a Python SDK, but the Logfire backend and UI support data sent by any OpenTelemetry client. See the [alternative clients guide](../guides/advanced/alternative-clients.md) for details on setting up OpenTelemetry in any language. We're working on a JavaScript SDK, but in the meantime here are some examples of using plain OpenTelemetry in JavaScript:
21+
Currently we only have a Python SDK, but the Logfire backend and UI support data sent by any OpenTelemetry client. See the [alternative clients guide](../how-to-guides/alternative-clients.md) for details on setting up OpenTelemetry in any language. We're working on a JavaScript SDK, but in the meantime here are some examples of using plain OpenTelemetry in JavaScript:
2222

2323
### Cloudflare worker example
2424

docs/roadmap.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Logfire is built on top of OpenTelemetry, which means that it supports all the l
6565
Still, we are planning to create custom SDKs for JavaScript, TypeScript, and Rust, and make sure that the
6666
attributes are displayed in a nice way in the Logfire UI — as they are for Python.
6767

68-
For now, you can check our [Alternative Clients](guides/advanced/alternative-clients.md) section to see how
68+
For now, you can check our [Alternative Clients](how-to-guides/alternative-clients.md) section to see how
6969
you can send data to Logfire from other languages.
7070

7171
See [this GitHub issue][language-support-gh-issue] for more information.

docs/why.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ From the team behind Pydantic, **Logfire** is an observability platform built on
1212

1313
Logfire's dashboard is simple relative to the power it provides, ensuring your entire engineering team will actually use it. Time-to-first-log should be less than 5 minutes.
1414

15-
[:octicons-arrow-right-24: Read more](#simplicity-and-power-)
15+
[:octicons-arrow-right-24: Read more](#simplicity-and-power)
1616

1717
- :snake:{ .lg .middle } __Python-centric Insights__
1818

1919
---
2020

2121
From rich display of **Python objects**, to **event-loop telemetry**, to **profiling Python code & database queries**, Logfire gives you unparalleled visibility into your Python application's behavior.
2222

23-
[:octicons-arrow-right-24: Read more](#python-centric-insights-material-snake)
23+
[:octicons-arrow-right-24: Read more](#python-centric-insights)
2424

2525
- :simple-pydantic:{ .lg .middle } __Pydantic Integration__
2626

@@ -38,23 +38,23 @@ From the team behind Pydantic, **Logfire** is an observability platform built on
3838

3939
Logfire is an opinionated wrapper around OpenTelemetry, allowing you to leverage existing tooling, infrastructure, and instrumentation for many common Python packages, and enabling support for virtually any language.
4040

41-
[:octicons-arrow-right-24: Read more](#opentelemetry-under-the-hood-)
41+
[:octicons-arrow-right-24: Read more](#opentelemetry-under-the-hood)
4242

4343
- :simple-instructure:{ .lg .middle } __Structured Data__
4444

4545
---
4646

4747
Include your Python objects in Logfire calls (lists, dict, dataclasses, Pydantic models, DataFrames, and more), and it'll end up as structured data in our platform ready to be queried.
4848

49-
[:octicons-arrow-right-24: Read more](#structured-data-and-sql--sql)
49+
[:octicons-arrow-right-24: Read more](#sql)
5050

5151
- :abacus:{ .lg .middle } __SQL__
5252

5353
---
5454

5555
Query your data using standard SQL — all the control and (for many) nothing new to learn. Using SQL also means you can query your data with existing BI tools and database querying libraries.
5656

57-
[:octicons-arrow-right-24: Read more](#structured-data-and-sql--sql)
57+
[:octicons-arrow-right-24: Read more](#sql)
5858

5959
</div>
6060

mkdocs.yml

+28-16
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,15 @@ nav:
7979
- Dashboards: guides/web-ui/dashboards.md
8080
- Alerts (Beta): guides/web-ui/alerts.md
8181
- SQL Explorer: guides/web-ui/explore.md
82-
- Advanced User Guide:
83-
- Environments: guides/advanced/environments.md
84-
- Alternative Clients: guides/advanced/alternative-clients.md
85-
- Alternative Backends: guides/advanced/alternative-backends.md
86-
- Sampling: guides/advanced/sampling.md
87-
- Scrubbing: guides/advanced/scrubbing.md
88-
- Generators: guides/advanced/generators.md
89-
- Creating Write Tokens: guides/advanced/creating-write-tokens.md
90-
- Query API: guides/advanced/query-api.md
91-
- Link to Code Source: guides/advanced/link-to-code-source.md
92-
- Testing: guides/advanced/testing.md
93-
- Backfill: guides/advanced/backfill.md
82+
- How To - Guides:
83+
- Create Write Tokens: how-to-guides/create-write-tokens.md
84+
- Use different environments: how-to-guides/environments.md
85+
- Link to Code Source: how-to-guides/link-to-code-source.md
86+
- Use Alternative Clients: how-to-guides/alternative-clients.md
87+
- Use Alternative Backends: how-to-guides/alternative-backends.md
88+
- Implement Sampling Strategies: how-to-guides/sampling.md
89+
- Export your Logfire Data: how-to-guides/query-api.md
90+
- Scrub Sensitive Data: how-to-guides/scrubbing.md
9491
- Integrations:
9592
- Integrations: integrations/index.md
9693
- LLMs:
@@ -133,6 +130,10 @@ nav:
133130
- Stripe: integrations/stripe.md
134131
- AWS Lambda: integrations/aws-lambda.md
135132
- Reference:
133+
- Advanced:
134+
- Generators: reference/advanced/generators.md
135+
- Testing: reference/advanced/testing.md
136+
- Backfill: reference/advanced/backfill.md
136137
- Examples: reference/examples.md
137138
- Configuration: reference/configuration.md
138139
- Organization Structure: reference/organization-structure.md
@@ -225,9 +226,21 @@ plugins:
225226
"guides/web_ui/dashboards.md": "guides/web-ui/dashboards.md"
226227
"guides/web_ui/alerts.md": "guides/web-ui/alerts.md"
227228
"guides/web_ui/explore.md": "guides/web-ui/explore.md"
228-
"guides/advanced/alternative_backends.md": "guides/advanced/alternative-backends.md"
229-
"guides/advanced/creating_write_tokens.md": "guides/advanced/creating-write-tokens.md"
230-
"guides/advanced/index.md": "guides/advanced/environments.md"
229+
"guides/advanced/generators.md": "reference/advanced/generators.md"
230+
"guides/advanced/testing.md": "reference/advanced/testing.md"
231+
"guides/advanced/backfill.md": "reference/advanced/backfill.md"
232+
"guides/advanced/query_api.md": "how-to-guides/query-api.md"
233+
"guides/advanced/query-api.md": "how-to-guides/query-api.md"
234+
"guides/advanced/scrubbing.md": "how-to-guides/scrubbing.md"
235+
"guides/advanced/sampling.md": "how-to-guides/sampling.md"
236+
"guides/advanced/alternative-clients.md": "how-to-guides/alternative-clients.md"
237+
"guides/advanced/link-to-code-source.md": "how-to-guides/link-to-code-source.md"
238+
"guides/advanced/alternative_backends.md": "how-to-guides/alternative-backends.md"
239+
"guides/advanced/alternative-backends.md": "how-to-guides/alternative-backends.md"
240+
"guides/advanced/creating_write_tokens.md": "how-to-guides/create-write-tokens.md"
241+
"guides/advanced/creating-write-tokens.md": "how-to-guides/create-write-tokens.md"
242+
"guides/advanced/index.md": "how-to-guides/environments.md"
243+
"guides/advanced/environments.md": "how-to-guides/environments.md"
231244
"integrations/system_metrics.md": "integrations/system-metrics.md"
232245
"integrations/third_party/index.md": "integrations/index.md"
233246
"integrations/third-party/index.md": "integrations/index.md"
@@ -281,7 +294,6 @@ plugins:
281294
"api/integrations/pydantic.md": "reference/api/pydantic.md"
282295
"api/integrations/logging.md": "reference/api/logfire.md#logfire.LogfireLoggingHandler"
283296
"guides/onboarding_checklist/add_metrics.md": "guides/onboarding-checklist/add-metrics.md"
284-
"guides/advanced/query_api.md": "guides/advanced/query-api.md"
285297
"guides/index.md": "index.md"
286298
"why-logfire/index.md": "why.md"
287299
"why-logfire/pydantic.md": "why.md"

0 commit comments

Comments
 (0)