mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 13:11:49 +00:00
docs: add more hints to observability docs; add database intellij docs (#62183)
* docs: add more hints to observability docs; add database intellij docs * localize images
This commit is contained in:
parent
0fb6806f3b
commit
7bc5d6cd9c
@ -51,11 +51,18 @@ The response headers of the response will now include an `x-trace-url` entry, wh
|
||||
|
||||
Note that getting a trace URL requires `urlTemplate` to be configured.
|
||||
|
||||
Alternatively you can use the GraphQL API console: Log in to your Sourcegraph instance of choice, navigate
|
||||
to `/api/console` (e.g. https://sourcegraph.sourcegraph.com/api/console) and add the query parameter `trace=1` to your browser's URL.
|
||||
Open the developer tools' network tab to inspect your request and find the tracing link in the response headers.
|
||||
|
||||
## Tracing backends
|
||||
|
||||
Tracing backends can be configured for Sourcegraph to export traces to.
|
||||
We support exporting traces via [OpenTelemetry](#opentelemetry) (recommended), or directly to [Jaeger](#jaeger).
|
||||
|
||||
When you use `sg`, you can run `sg start otel` to start the tracing backend. Requests with `trace=1` or the according
|
||||
tracing header will then contain a response header with a link to your local tracing backend.
|
||||
|
||||
### OpenTelemetry
|
||||
|
||||
To learn about exporting traces to various backends using OpenTelemetry, review our [OpenTelemetry documentation](./opentelemetry.md).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# How to debug live code
|
||||
|
||||
How to debug a program with Visual Studio Code:
|
||||
How to debug a program with Visual Studio Code. Instructions for debugging Go code with Goland/IntelliJ [here](#attaching-via-goland)
|
||||
|
||||
## Debug TypeScript code
|
||||
|
||||
@ -18,7 +18,7 @@ Requires "Debugger for Chrome" extension.
|
||||
|
||||
## Debug Go code
|
||||
|
||||
Instructions for attaching with Goland [here](#attaching-via-goland)
|
||||
Instructions for attaching with Goland/IntelliJ [here](#attaching-via-goland).
|
||||
|
||||
Install [Delve](https://github.com/derekparker/delve):
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
- [Set up local development with Zoekt and Sourcegraph](zoekt_local_dev.md)
|
||||
- [How to debug live code](debug_live_code.md)
|
||||
- [Ignoring editor config files in Git](ignoring_editor_config_files.md)
|
||||
- [How to inspect the database from IntelliJ](inspect_postgres_from_intellij.md)
|
||||
|
||||
## Testing Sourcegraph & CI
|
||||
|
||||
|
||||
55
doc/dev/how-to/inspect_postgres_from_intellij.md
Normal file
55
doc/dev/how-to/inspect_postgres_from_intellij.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Inspecting the Postgres database with IntelliJ
|
||||
|
||||
This guide teaches you step by step how to use the Database plugin of IntelliJ to set up a connection
|
||||
to your local sourcegraph database, and how to run SQL queries through it.
|
||||
|
||||
If you haven't done so yet, run `sg setup` and `sg start` to make sure your database is up and running.
|
||||
|
||||
Below we'll assume the default config for postgres. It is defined in [`sg.config.yaml`](/sg.config.yaml) (or your overrides),
|
||||
and has `env` keys like `PGPASSWORD` and `PGPORT`.
|
||||
|
||||
## 1. Open the database plugin
|
||||
|
||||
It's usually on the right edge of your IDE.
|
||||
|
||||

|
||||
|
||||
## 2. Create a new PostgreSQL connection
|
||||
|
||||
Click the `+` sign, then Data Source, and then find PostgreSQL.
|
||||
|
||||

|
||||
|
||||
## 3. Credentials and Database
|
||||
|
||||
Enter the credentials as you see them in the [`sg.config.yaml`](/sg.config.yaml) (or your overrides) mentioned above.
|
||||
|
||||
Also enter `sourcegraph` as the database name (or the override that you're using).
|
||||
|
||||

|
||||
|
||||
Below the connection settings you can click on "Test Connection" to make sure that your drivers are working.
|
||||
IntelliJ may prompt you to download the drivers then.
|
||||
|
||||

|
||||
|
||||
## 4. Select the sourcegraph public schemas
|
||||
|
||||
In the `Schema` tab of the connection settings, select the `sourcegraph` database, and its `public` schema. Extend
|
||||
the `sourcegraph` database if you don't see the `public` schema.
|
||||
|
||||

|
||||
|
||||
Click on Ok to wrap it up.
|
||||
|
||||
## Select a table
|
||||
|
||||
Open the datasource on the right, and drill down to a table. You can double-click a table to see its content.
|
||||
|
||||

|
||||
|
||||
## Query
|
||||
|
||||
By click `+` and then Query Console or Shift+CMD+L (on Mac), you can get a regular SQL query editor.
|
||||
|
||||

|
||||
Loading…
Reference in New Issue
Block a user