Skip to content

Commit

Permalink
Merge pull request #111 from grafana/staging
Browse files Browse the repository at this point in the history
Chore: Staging to Prod
  • Loading branch information
Jayclifford345 authored Aug 30, 2024
2 parents 6040b5f + 8d2bc25 commit f5579c1
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/regenerate-tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ jobs:
"${GITHUB_WORKSPACE}/grafana/docs/sources/tutorials/grafana-fundamentals/index.md"
"${GITHUB_WORKSPACE}/killercoda/grafana/grafana-fundamentals"
working-directory: killercoda/tools/transformer
- run: >
./transformer
"${GITHUB_WORKSPACE}/grafana/docs/sources/tutorials/create-alerts-with-logs/index.md"
"${GITHUB_WORKSPACE}/killercoda/grafana/alerting-loki-logs"
working-directory: killercoda/tools/transformer
- run: ./scripts/manage-pr.bash
env:
GH_TOKEN: ${{ github.token }}
Expand Down
2 changes: 1 addition & 1 deletion grafana/alerting-loki-logs/step2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generate sample logs

1. Download and save a python file that generates logs.
1. Download and save a Python file that generates logs.

```bash
wget https://raw.githubusercontent.com/grafana/tutorial-environment/master/app/loki/web-server-logs-simulator.py
Expand Down
4 changes: 1 addition & 3 deletions grafana/alerting-loki-logs/step3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ Besides being an open-source observability tool, Grafana has its own built-in al

In this step, we’ll set up a new [contact point](https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier/). This contact point will use the _webhooks_ integration. In order to make this work, we also need an endpoint for our webhook integration to receive the alert. We will use [Webhook.site](https://webhook.site/) to quickly set up that test endpoint. This way we can make sure that our alert is actually sending a notification somewhere.

1. In your browser, **sign in** to your Grafana Cloud account.

OSS users: To log in, navigate to [http://localhost:3000]({{TRAFFIC_HOST1_3000}}), where Grafana is running.
1. Navigate to [http://localhost:3000]({{TRAFFIC_HOST1_3000}}), where Grafana is running.

1. In another tab, go to [Webhook.site](https://webhook.site/).

Expand Down
10 changes: 5 additions & 5 deletions grafana/alerting-loki-logs/step4.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ In this section, we define queries, expressions (used to manipulate the data), a

1. Paste the query below.

```
sum by (message)(count_over_time({filename="/var/log/web_requests.log"} != `status=200` | pattern `<_> <message> duration<_>` [10m]))
```{{copy}}
```
sum by (message)(count_over_time({filename="/var/log/web_requests.log"} != "status=200" | pattern "<_> <message> duration<_>" [10m]))
```{{copy}}
This query will count the number of log lines with a status code that is not 200 (OK), then sum the result set by message type using an **instant query** and the time interval indicated in brackets. It uses the LogQL pattern parser to add a new label called `message`{{copy}} that contains the level, method, url, and status from the log line.
Expand All @@ -42,7 +42,7 @@ If you’re using your own logs, modify the LogQL query to match your own log me
1. Click **Preview** to run the queries.
It should return a single sample with the value 1 at the current timestamp. And, since `1`{{copy}} is above `0`{{copy}}, the alert condition has been met, and the alert rule state is `Firing`{{copy}}.
It should return alert instances from log lines with a status code that is not 200 (OK), and that has met the alert condition. The condition for the alert rule to fire is any ocurrence that goes over the threshold of `0`{{copy}}. Since the Loki query has returned more than zero alert instances, the alert rule is `Firing`{{copy}}.
![Preview of a firing alert instances](https://grafana.com/media/docs/alerting/expression-loki-alert.png)
Expand All @@ -56,7 +56,7 @@ An [evaluation group](https://grafana.com/docs/grafana/latest/alerting/fundament
To set up the evaluation:
1. In **Folder**, click **+ New folder** and enter a name. For example: _loki-alerts_. This folder will contain our alerts.
1. In **Folder**, click **+ New folder** and enter a name. For example: _web-server-alerts_. This folder will contain our alerts.
1. In the **Evaluation group**, repeat the above step to create a new evaluation group. We will name it _1m-evaluation_.
Expand Down
2 changes: 1 addition & 1 deletion grafana/alerting-loki-logs/step5.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Trigger the alert rule

Since the alert rule that you have created has been configured to always fire, once the evaluation interval has concluded, you should receive an alert notification in the Webhook endpoint.
Since the Python script will continue to generate log data that matches the alert rule condition, once the evaluation interval has concluded, you should receive an alert notification in the Webhook endpoint.

![Firing alert notification details](https://grafana.com/media/docs/alerting/alerting-webhook-firing-alert.png)
18 changes: 18 additions & 0 deletions tempo/quick-start/finish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Next steps

You have successfully set up Tempo and Grafana to explore traces generated by the k6-tracing service. Wondering what to do next? Here are some ideas:

## Alternative: Complete MLTP example

If you would like to use a demo with Tempo, Mimir, Loki, and Grafana, then try the [Introduction to Metrics, Logs, Traces, and Profiling in Grafana](https://github.com/grafana/intro-to-mlt).
`Intro-to-mltp`{{copy}} provides a self-contained environment for learning about Mimir, Loki, Tempo, and Grafana.
The project includes detailed explanations of each component and annotated configurations for a single-instance deployment.
Data from `intro-to-mltp`{{copy}} can also be pushed to Grafana Cloud.

## Further reading

Here are some resources to help you learn more about Tempo:

- [Instrumenting your application](https://grafana.com/docs/tempo/latest/getting-started/instrumentation)

- [Setup Guides for Tempo](https://grafana.com/docs/tempo/latest/setup)
23 changes: 23 additions & 0 deletions tempo/quick-start/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": "Quick start for Tempo",
"description": "Use Docker to quickly view traces using K-6 and Tempo",
"details": {
"intro": {
"text": "intro.md"
},
"steps": [
{
"text": "step1.md"
},
{
"text": "step2.md"
}
],
"finish": {
"text": "finish.md"
}
},
"backend": {
"imageid": "ubuntu"
}
}
10 changes: 10 additions & 0 deletions tempo/quick-start/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Quick start for Tempo

The Tempo repository provides [multiple examples](https://github.com/grafana/tempo/tree/main/example/docker-compose) to help you quickly get started using Tempo and distributed tracing data.

Every example has a `docker-compose.yaml`{{copy}} manifest that includes all of the options needed to explore trace data in Grafana, including resource configuration and trace data generation.

The Tempo examples running with Docker using docker-compose include a version of Tempo and a storage configuration suitable for testing or development.

This quick start guide uses the `local`{{copy}} example running Tempo as a single binary (monolithic). Any data is stored locally in the `tempo-data`{{copy}} folder.
To learn more, read the [local storage example README](https://github.com/grafana/tempo/blob/main/example/docker-compose/local).
30 changes: 30 additions & 0 deletions tempo/quick-start/step1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Clone the Tempo repository and start Docker

1. Clone the Tempo repository:

```bash
git clone https://github.com/grafana/tempo.git
```{{exec}}
1. Go into the examples directory:
```bash
cd tempo/example/docker-compose/local
```{{exec}}
1. Start the services defined in the docker-compose file:
```bash
docker-compose up -d
```{{exec}}
1. Verify that the services are running using `docker-compose ps`{{copy}}. You should see something like:
```console
docker-compose ps
NAME COMMAND SERVICE STATUS PORTS
local-grafana-1 "/run.sh" grafana running 0.0.0.0:3000->3000/tcp
local-k6-tracing-1 "/k6-tracing run /ex…" k6-tracing running
local-prometheus-1 "/bin/prometheus --c…" prometheus running 0.0.0.0:9090->9090/tcp
local-tempo-1 "/tempo -config.file…" tempo running 0.0.0.0:3200->3200/tcp, 0.0.0.0:4317-4318->4317-4318/tcp, 0.0.0.0:9411->9411/tcp, 0.0.0.0:14268->14268/tcp
```{{copy}}
19 changes: 19 additions & 0 deletions tempo/quick-start/step2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Explore the traces in Grafana

As part of the docker-compose manifest, Grafana is now accessible on port 3000. We can use Grafana to explore the traces generated by the k6-tracing service.

1. Open a browser and navigate to [http://localhost:3000]({{TRAFFIC_HOST1_3000}}).

1. Once logged in, navigate to the **Explore** page, select the **Tempo** data source and select the **Search** tab. Select **Run query** to list the recent traces stored in Tempo. Select one to view the trace diagram:

![Query example](https://grafana.com/docs/tempo/latest/setup/assets/setup-linux-run-query.png)

1. A couple of minutes after Tempo has started up successfully, select the **Service graph** tab for the Tempo data source in the **Explore** page. Select **Run query** to view a service graph, generated by Tempo’s metrics-generator.

![Service graph sample](https://grafana.com/docs/tempo/latest/setup/assets/setup-linux-node-graph.png)

1. To stop the services:

```
docker-compose down -v
```{{copy}}
5 changes: 5 additions & 0 deletions tempo/structure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"items": [
{ "path": "quick-start", "title": "Quick start for Tempo"}
]
}

0 comments on commit f5579c1

Please sign in to comment.