Skip to content

Commit 7606d01

Browse files
bwplotkaOghenebrume50
authored andcommitted
katacoda: Small cleanup and added playground demo. (thanos-io#3463)
Signed-off-by: Bartlomiej Plotka <[email protected]> Signed-off-by: Oghenebrume50 <[email protected]>
1 parent 0e0891c commit 7606d01

File tree

22 files changed

+573
-121
lines changed

22 files changed

+573
-121
lines changed
+10-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Learn Thanos",
3-
"description": "Introduction, Tips and Advanced Tutorials for Thanos: the CNCF, Global, Scalable System for Prometheus Metrics with cheap, Long-term Storage Capabilities. Course version: v0.2",
3+
"description": "Introduction, Tips and Advanced Tutorials for Thanos: the CNCF, Global, Scalable System for Prometheus Metrics with cheap, Long-term Storage Capabilities. Course version: v0.3",
44
"icon": "fa-thanos",
55
"courses": [
66
{
@@ -14,29 +14,19 @@
1414
"description": "Learn how to extend your metric retention in a cheap and easy way with Thanos."
1515
},
1616
{
17-
"course_id": "3-meta-monitoring",
18-
"title": "Intro: Global and meta alerts with Thanos",
19-
"description": "In progress. Stay Tuned!"
20-
},
21-
{
22-
"course_id": "4-cross-cluster-comm",
23-
"title": "Advanced: Connecting remote Prometheuses to Thanos using simple Envoy setup",
24-
"description": "In progress. Stay Tuned!"
25-
},
26-
{
27-
"course_id": "5-remote-receiver",
28-
"title": "Advanced: Using Prometheus remote write to stream metrics to Thanos",
29-
"description": "In progress. Stay Tuned!"
17+
"course_id": "7-multi-tenancy",
18+
"title": "Advanced: Achieving Multi-Tenancy with Thanos",
19+
"description": "Extend your Prometheus setup for Multiple Teams use with Thanos"
3020
},
3121
{
32-
"course_id": "6-caching",
33-
"title": "Advanced: Query low tail latency with low cost: Introducing caching to Thanos",
34-
"description": "In progress. Stay Tuned!"
22+
"course_id": "x-playground",
23+
"title": "Playground: All-in, Interactive Thanos un-guided Demo",
24+
"description": "Demo playground that spins all the components from previous courser together."
3525
},
3626
{
37-
"course_id": "7-multi-tenancy",
38-
"title": "Advanced: Achieving Multi-Tenancy with Thanos",
39-
"description": "Extend your Prometheus setup for Multiple Teams use with Thanos"
27+
"course_id": "x-more-to-come",
28+
"title": "<Your Tutorial>",
29+
"description": "Anything you want to like to see? Or you want to help? Let us know!"
4030
}
4131
]
4232
}

tutorials/katacoda/thanos/2-lts/step1.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ mkdir -p /root/prom-eu1 && docker run -i quay.io/thanos/thanosbench:v0.2.0-rc.1
2525
On successful block creation you should see following log lines:
2626
2727
```
28-
level=info ts=2020-10-20T18:28:42.625041939Z caller=block.go:87 msg="all blocks done" count=X
28+
level=info ts=2020-10-20T18:28:42.625041939Z caller=block.go:87 msg="all blocks done" count=13
2929
level=info ts=2020-10-20T18:28:42.625100758Z caller=main.go:118 msg=exiting cmd="block gen"
3030
```
3131
32-
Run `ls -lR /root/prom-eu1` to see dozens of generated TSDB blocks.
32+
Run below command to see dozens of generated TSDB blocks:
33+
34+
```
35+
ls -lR /root/prom-eu1
36+
```{{execute}}
3337
3438
## Prometheus Configuration File
3539
@@ -103,7 +107,7 @@ docker run -d --net=host --rm \
103107
104108
Once started you should be able to reach the Prometheus instance here and query.. 1 year of data!
105109
106-
* [Prometheus-0 EU1](https://[[HOST_SUBDOMAIN]]-9090-[[KATACODA_HOST]].environments.katacoda.com/)
110+
* [Prometheus-0 EU1](https://[[HOST_SUBDOMAIN]]-9090-[[KATACODA_HOST]].environments.katacoda.com/graph?g0.range_input=1y&g0.expr=continuous_app_metric0&g0.tab=0)
107111
108112
## Thanos Sidecar & Querier
109113
@@ -140,6 +144,6 @@ Similar to previous course let's check if the Querier works as intended. Let's l
140144
141145
This should list the sidecar, including the external labels.
142146
143-
On graph you should also see our 5 series for 1y time, thanks to Prometheus and sidecar StorAPI: [Graph](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com).
147+
On graph you should also see our 5 series for 1y time, thanks to Prometheus and sidecar StorAPI: [Graph](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/https://2886795307-9091-ollie02.environments.katacoda.com/graph?g0.range_input=1y&g0.max_source_resolution=0s&g0.expr=continuous_app_metric0&g0.tab=0).
144148
145149
Click `Continue` to see how we can move this data to much cheaper and easier to operate object storage.

tutorials/katacoda/thanos/2-lts/step3.md

+36-6
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,49 @@ docker run -d --net=host --rm \
4141
4242
## How to query Thanos store data?
4343
44-
In this step, we will see how we can query Thanos store data which has access to historical data from the `thanos` bucket, and let's play with this setup a bit.
44+
In this step, we will see how we can query Thanos store data which has access to historical data from the `thanos` bucket, and play with this setup a bit.
4545
46-
Click on the [Querier UI `Graph` page](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/graph) and try querying data for a year or two by inserting metrics [continuous_app_metric0](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/graph?g0.range_input=1y&g0.max_source_resolution=0s&g0.expr=continuous_app_metric0&g0.tab=0). Make sure `deduplication` is selected and you will be able to discover all the data fetched by Thanos store.
46+
Currently querier does not know about store yet. Let's change it by adding Store Gateway gRPC address `--store 127.0.0.1:19191` to Querier:
4747
48-
![](https://github.com/soniasingla/thanos/raw/master/tutorials/katacoda/thanos/2-lts/query.png)
48+
```
49+
docker stop querier && \
50+
docker run -d --net=host --rm \
51+
--name querier \
52+
quay.io/thanos/thanos:v0.16.0 \
53+
query \
54+
--http-address 0.0.0.0:9091 \
55+
--query.replica-label replica \
56+
--store 127.0.0.1:19190 \
57+
--store 127.0.0.1:19191
58+
```{{execute}}
59+
60+
Click on the Querier UI `Graph` page and try querying data for a year or two by inserting metrics `continuous_app_metric0` ([Query UI](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/graph?g0.range_input=1y&g0.max_source_resolution=0s&g0.expr=continuous_app_metric0&g0.tab=0)). Make sure `deduplication` is selected and you will be able to discover all the data fetched by Thanos store.
61+
62+
![](https://github.com/thanos-io/thanos/raw/master/tutorials/katacoda/thanos/2-lts/query.png)
4963
5064
Also, you can check all the active endpoints located by thanos-store by clicking on [Stores](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/stores).
5165
52-
We've added Thanos Query, a web and API frontend that can query a Prometheus instance and Thanos Store at the same time, which gives transparent access to the archived blocks and real-time metrics. The vanilla PromQL Prometheus engine used for evaluating the query deduces what time series and for what time ranges we need to fetch the data. Also, StoreAPIs propagate external labels and the time range they have data for, so we can do basic filtering on this. However, if you don't specify any of these in the query (only "up" series) the querier concurrently asks all the StoreAPI servers. It might cause a duplication of results between sidecar and store data.
66+
### What we know so far?
67+
68+
We've added Thanos Query, a component that can query a Prometheus instance and Thanos Store at the same time,
69+
which gives transparent access to the archived blocks and real-time metrics. The vanilla PromQL Prometheus engine used inside Query deduces
70+
what time series and for what time ranges we need to fetch the data for.
71+
72+
Also, StoreAPIs propagate external labels and the time range they have data for, so we can do basic filtering on this.
73+
However, if you don't specify any of these in the query (only "up" series) the querier concurrently asks all the StoreAPI servers.
74+
75+
The potential duplication of data between Prometheus+sidecar results and store Gateway will be transparently handled and invisible in results.
76+
77+
### Checking what StoreAPIs are involved in query
78+
79+
Another interesting question here is how to ensure if we query the data from bucket only?
80+
81+
We can check this by visitng the [New UI]((https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/new/graph?g0.expr=&g0.tab=0&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=[])), inserting `continuous_app_metric0` metrics again with 1 year time range of graph,
82+
and click on `Enable Store Filtering`.
5383
54-
Now, another interesting question here is how to ensure if we query the data from bucket only?
84+
This allows us to filter stores and helps in debugging from where we are querying the data exactly.
5585
56-
We can check this by visitng the [New UI]((https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/new/graph?g0.expr=&g0.tab=0&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=[])), inserting `continuous_app_metric0` metrics again with 1 year time range of graph, and click on `Enable Store Filtering`. This allows us to filter stores and helps in debugging from where we are querying the data exactly.
86+
Let's chose only `127.0.0.1:19191`, so store gateway. This query will only hit that store to retrieve data, so we are sure that store works.
5787
5888
## Question Time? 🤔
5989

tutorials/katacoda/thanos/2-lts/step4.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# Step 4 - Thanos Compactor
22

3-
In this step, we will install Thanos Compactor which applies the compaction procedure of the Prometheus 2.0 storage engine to block data in object storage.
3+
In this step, we will install Thanos Compactor which applies the compaction, retention, deletion and downsampling operations
4+
on the TSDB block data object storage.
45

56
Before, moving forward, let's take a closer look at what the `Compactor` component does:
67

8+
> Note: Thanos Compactor is currently designed to be run as a singleton. Unavailability (hours) is not problematic as it does not serve any live requests.
79
## Compactor
810

9-
The `Compactor` is an essential component that operates on a single object storage bucket to compact, down-sample, apply retention, to the TSDB blocks held inside, thus, making queries on historical data more efficient. It creates aggregates of old metrics (based upon the rules).
11+
The `Compactor` is an essential component that operates on a single object storage bucket to compact, downsample, apply retention, to the TSDB blocks held inside,
12+
thus, making queries on historical data more efficient. It creates aggregates of old metrics (based upon the rules).
1013

1114
It is also responsible for downsampling of data, performing 5m downsampling after 40 hours, and 1h downsampling after 10 days.
1215

1316
If you want to know more about Thanos Compactor, jump [here](https://thanos.io/tip/components/compact.md/).
1417

15-
**Note**: Thanos Compactor is mandatory if you use object storage otherwise Thanos Store Gateway will be too slow without using a compactor.
18+
> Note: Thanos Compactor is mandatory if you use object storage otherwise Thanos Store Gateway will be too slow without using a compactor.
1619
1720
## Deploying Thanos Compactor
1821

@@ -34,15 +37,20 @@ The flag `wait` is used to make sure all compactions have been processed while `
3437
3538
## Setup Verification
3639
37-
To check if compactor works fine, we can look at the [Bucket View](https://[[HOST_SUBDOMAIN]]-19095-[[KATACODA_HOST]].environments.katacoda.com/loaded).
40+
To check if compactor works fine, we can look at the [Bucket View](https://[[HOST_SUBDOMAIN]]-19095-[[KATACODA_HOST]].environments.katacoda.com/new/loaded).
3841
3942
Now, if we click on the blocks, they will provide us all the metadata (Series, Samples, Resolution, Chunks, and many more things).
4043
4144
## Compaction and Downsampling
4245
43-
When we query large historical data there will be definitely many complexities making the queries slower and slower as we retrieve year's worth of data. Thus, Thanos uses the technique called downsampling (a process of reducing the sampling rate of the signal) to keep the queries responsive, and no special configuration is required to perform this process. The Compactor applies compaction to the bucket data and also completes the downsampling for historical data.
46+
When we query large historical data there are millions of samples that we need to go through which makes the queries slower and slower as we retrieve year's worth of data.
4447
45-
Now, click on the [Querier](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/new/graph?g0.expr=&g0.tab=0&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=[]) and insert metrics `continuous_app_metric0` with 1 year time range of graph, and also, click on `Enable Store Filtering`.
48+
Thus, Thanos uses the technique called downsampling (a process of reducing the sampling rate of the signal) to keep the queries responsive,
49+
and no special configuration is required to perform this process.
50+
51+
The Compactor applies compaction to the bucket data and also completes the downsampling for historical data.
52+
53+
To expierience this, click on the [Querier](https://[[HOST_SUBDOMAIN]]-9091-[[KATACODA_HOST]].environments.katacoda.com/new/graph?g0.expr=&g0.tab=0&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=[]) and insert metrics `continuous_app_metric0` with 1 year time range of graph, and also, click on `Enable Store Filtering`.
4654
4755
Let's try querying `Max 5m downsampling` data, it uses 5m resolution and it will be faster than the raw data. Also, Downsampling is built on top of data, and never done on **young** data.
4856

tutorials/katacoda/thanos/3-meta-monitoring/intro.md

-7
This file was deleted.

tutorials/katacoda/thanos/4-cross-cluster-comm/courseBase.sh

-1
This file was deleted.

tutorials/katacoda/thanos/4-cross-cluster-comm/index.json

-19
This file was deleted.

tutorials/katacoda/thanos/5-remote-receiver/courseBase.sh

-1
This file was deleted.

tutorials/katacoda/thanos/5-remote-receiver/index.json

-19
This file was deleted.

tutorials/katacoda/thanos/5-remote-receiver/intro.md

-7
This file was deleted.

tutorials/katacoda/thanos/6-caching/courseBase.sh

-1
This file was deleted.

tutorials/katacoda/thanos/6-caching/index.json

-19
This file was deleted.

tutorials/katacoda/thanos/6-caching/intro.md

-7
This file was deleted.

tutorials/katacoda/thanos/3-meta-monitoring/index.json renamed to tutorials/katacoda/thanos/x-more-to-come/index.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"title": "Intro: Global and meta alerts with Thanos Ruler",
3-
"description": "In progress. Stay Tuned!",
2+
"title": "<Your Tutorial>",
3+
"description": "Anything you want to like to see? Or you want to help? Let us know!",
44
"details": {
55
"steps": [
66
],

tutorials/katacoda/thanos/4-cross-cluster-comm/intro.md renamed to tutorials/katacoda/thanos/x-more-to-come/intro.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# In progress
1+
# Work in Progress
22

3-
🚧 This tutorial is in progress. 🚧
3+
🚧 More tutorials are in progress. 🚧
44

55
Do you want to see this soon or you want to help us?
66

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
docker pull quay.io/prometheus/prometheus:v2.20.0
4+
docker pull quay.io/thanos/thanos:v0.16.0
5+
docker pull quay.io/thanos/thanosbench:v0.2.0-rc.1
6+
docker pull minio/minio:RELEASE.2019-01-31T00-31-19Z
7+
8+
mkdir /root/editor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Summary
2+
3+
Uff done.
4+
5+
<img src="https://i.imgflip.com/4mw3l5.jpg" title="yoda"/>
6+
7+
### Cleanup if you ran locally
8+
9+
```
10+
docker stop prom-eu1-0
11+
docker stop prom-eu1-1
12+
docker stop prom-us1-0
13+
docker stop prom-eu1-0-sidecar
14+
docker stop prom-eu1-1-sidecar
15+
docker stop prom-us1-0-sidecar
16+
docker stop querier
17+
docker stop minio
18+
docker stop store-gateway
19+
docker stop compactor
20+
```
21+
22+
### Feedback
23+
24+
Do you see any bug, typo in the tutorial or you have some feedback for us?
25+
Let us know on https://github.com/thanos-io/thanos or #thanos slack channel linked on https://thanos.io
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"title": "Playground: All-in, Interactive Thanos un-guided Demo",
3+
"description": "\uD83E\uDD14\uD83E\uDD14",
4+
"difficulty": "YOLO",
5+
"details": {
6+
"steps": [
7+
{
8+
"title": "Yolo Demo Resources",
9+
"text": "step1.md"
10+
},
11+
{
12+
"title": "Yolo Demo Resources",
13+
"text": "step2.md"
14+
}
15+
],
16+
"intro": {
17+
"text": "intro.md",
18+
"courseData": "courseBase.sh"
19+
}
20+
},
21+
"environment": {
22+
"uilayout": "terminal",
23+
"uisettings": "yaml",
24+
"showdashboard": true,
25+
"uieditorpath": "/root/editor"
26+
},
27+
"backend": {
28+
"imageid": "docker-direct"
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Demo Resources
2+
3+
Let's go!
4+
5+
This playground was created for `@rawkode` live demo made by `@bwplotka` and David McKay.
6+
7+
You can watch all here: https://www.youtube.com/watch?v=j4TAGO019HU&feature=emb_title&ab_channel=DavidMcKay
8+
9+
Otherwise, have fun with those resources!
10+
11+
### Feedback
12+
13+
Do you see any bug, typo in the tutorial or you have some feedback for us?
14+
Let us know on https://github.com/thanos-io/thanos or #thanos slack channel linked on https://thanos.io
15+
16+
### Contributed by:
17+
18+
* Bartek [@bwplotka](https://bwplotka.dev/)

0 commit comments

Comments
 (0)