Skip to content

Commit

Permalink
add loki guide
Browse files Browse the repository at this point in the history
  • Loading branch information
LordGhostX committed May 16, 2024
1 parent 5133092 commit 7cd5182
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
56 changes: 48 additions & 8 deletions docs/docs/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Monitoring Juno

# Monitoring Juno :bar_chart:

Juno uses [Prometheus](https://prometheus.io/) and [pprof](https://github.com/google/pprof) to monitor and collect metrics and profiling data, which you can visualise with [Grafana](https://grafana.com/). Insights into your node's performance are useful for debugging, tuning, and understanding what is happening when Juno is running.
Juno uses [Prometheus](https://prometheus.io/) to monitor and collect metrics data, which you can visualise with [Grafana](https://grafana.com/). You can use these insights to understand what is happening when Juno is running.

## Enable the metrics server

Expand All @@ -30,13 +30,53 @@ docker run -d \

## Configure Grafana dashboard

### 1. Follow the [Set up Grafana](https://grafana.com/docs/grafana/latest/setup-grafana/) guide to set up Grafana locally
### 1. Set up Grafana

### 2. Download and [set up](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#configuration-file-location) the [Grafana configuration file](/juno_grafana.json)
Follow the [Set up Grafana](https://grafana.com/docs/grafana/latest/setup-grafana/) guide to set up Grafana locally. You also need to download and [configure](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#configuration-file-location) the [Grafana dashboard file](/juno_grafana.json).

### 3. Configure the data source:
### 2. Set up Prometheus

1. Follow the [Grafana data sources](https://grafana.com/docs/grafana/latest/datasources/) guide to add a data source.
2. Choose **Prometheus** as the data source.
3. Enter `http://localhost:9090/` as the **Prometheus server URL**.
4. Click the **"Save & Test"** button.
Follow the [First steps with Prometheus](https://prometheus.io/docs/introduction/first_steps/) guide to install Prometheus for scraping metrics. Then, add the Juno metrics endpoint in the `prometheus.yml` configuration file:

```yaml title="prometheus.yml" showLineNumbers
scrape_configs:
- job_name: "juno"
static_configs:
- targets: ["localhost:9090"]
```
### 3. Set up Grafana Loki
Follow the [Get started with Grafana Loki](https://grafana.com/docs/loki/latest/get-started/) guide to set up [Loki](https://grafana.com/oss/loki/) locally. Then, you need to set up Loki to [collect logs](https://grafana.com/docs/loki/latest/send-data/) from Juno.
You might need to configure log paths or use [Promtail](https://grafana.com/docs/loki/latest/send-data/promtail/) (Loki's agent) to push logs to Loki:
```yaml title="Sample Loki Configuration" showLineNumbers
scrape_configs:
- job_name: "juno-logs"
labels:
job: "juno"
__path__: "/path/to/juno/logs/*"
```
:::tip
To have Juno write logs to a file, use the command:
```bash
./build/juno >> /path/juno.log 2>&1
```

:::

### 4. Configure the data sources

1. Follow the [Grafana data sources](https://grafana.com/docs/grafana/latest/datasources/) guide to add data sources.
2. Choose **Prometheus** as a data source:

- Enter the URL where Prometheus is running, e.g., `http://localhost:9090`.
- Click the **"Save & Test"** button.

3. Choose **Loki** as a data source:

- Enter the URL where Loki is running, e.g., `http://localhost:3100`.
- Click the **"Save & Test"** button.
6 changes: 3 additions & 3 deletions docs/docs/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: WebSocket Interface

# WebSocket Interface :globe_with_meridians:

Juno also provides a WebSocket RPC interface to interact with that supports all of [Starknet's JSON-RPC API](https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json) endpoints.
Juno provides a WebSocket RPC interface to interact with that supports all of [Starknet's JSON-RPC API](https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json) endpoints.

## Enable the WebSocket server

Expand Down Expand Up @@ -34,12 +34,12 @@ You can test your WebSocket connection using tools like [wscat](https://github.c

```bash
# wscat
$wscat -c ws://localhost:6061
$ wscat -c ws://localhost:6061
> {"jsonrpc": "2.0", "method": "juno_version", "id": 1}
< {"jsonrpc": "2.0", "result": "v0.11.7", "id": 1}

# websocat
$websocat -v ws://localhost:6061
$ websocat -v ws://localhost:6061
[INFO websocat::lints] Auto-inserting the line mode
[INFO websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[INFO websocat::ws_client_peer] get_ws_client_peer
Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const config = {
href: "https://www.nethermind.io/blogs",
},
{
label: "Release Notes",
label: "Juno Releases",
href: "https://github.com/NethermindEth/juno/releases",
},
],
Expand Down
4 changes: 2 additions & 2 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const sidebars = {
{
type: "html",
value:
'<a href="https://playground.open-rpc.org/?uiSchema[appBar][ui:splitView]=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/master/api/starknet_api_openrpc.json&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false" target="_blank" rel="noopener noreferrer" class="menu__link external-link">Starknet Node API Endpoints <svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg>',
'<a href="https://playground.open-rpc.org/?uiSchema[appBar][ui:splitView]=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/master/api/starknet_api_openrpc.json&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false" target="_blank" rel="noopener noreferrer" class="menu__link external-link">Starknet Node API Endpoints&nbsp;<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg>',
},
{
type: "html",
value:
'<a href="https://rpc-request-builder.vercel.app/" target="_blank" rel="noopener noreferrer" class="menu__link external-link">Starknet RPC Request Builder <svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg>',
'<a href="https://rpc-request-builder.vercel.app/" target="_blank" rel="noopener noreferrer" class="menu__link external-link">Starknet RPC Request Builder&nbsp;<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg>',
},
],
},
Expand Down

0 comments on commit 7cd5182

Please sign in to comment.