Skip to content

Commit 3f04201

Browse files
committed
Merge remote-tracking branch 'upstream/master' into kristjan/python-parser-state2
2 parents 157be78 + 74c251a commit 3f04201

22 files changed

+1319
-16
lines changed
+30
Loading

docs/conf.py

+21-12
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
# General information about the project.
6262
project = "redis-py"
63-
copyright = "2021, Redis Inc"
63+
copyright = "2022, Redis Inc"
6464

6565
# The version info for the project you're documenting, acts as replacement for
6666
# |version| and |release|, also used in various other places throughout the
@@ -104,7 +104,7 @@
104104
# show_authors = False
105105

106106
# The name of the Pygments (syntax highlighting) style to use.
107-
pygments_style = "sphinx"
107+
pygments_style = "tango"
108108

109109
# A list of ignored prefixes for module index sorting.
110110
# modindex_common_prefix = []
@@ -116,19 +116,28 @@
116116

117117
# The theme to use for HTML and HTML Help pages. See the documentation for
118118
# a list of builtin themes.
119-
html_theme = "sphinx_rtd_theme"
119+
html_theme = "furo"
120120

121121
# Theme options are theme-specific and customize the look and feel of a theme
122122
# further. For a list of options available for each theme, see the
123123
# documentation.
124124
html_theme_options = {
125125
"display_version": True,
126-
"prev_next_buttons_location": "bottom",
127-
"style_external_links": False,
128-
# Toc options
129-
"collapse_navigation": True,
130-
"sticky_navigation": True,
131-
"navigation_depth": 4,
126+
"footer_icons": [
127+
{
128+
"name": "GitHub",
129+
"url": "https://github.com/redis/redis-py",
130+
"html": """
131+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
132+
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
133+
</svg>
134+
""",
135+
"class": "",
136+
},
137+
],
138+
"source_repository": "https://github.com/redis/redis-py/",
139+
"source_branch": "master",
140+
"source_directory": "docs/",
132141
}
133142

134143
# Add any paths that contain custom themes here, relative to this directory.
@@ -143,7 +152,7 @@
143152

144153
# The name of an image file (relative to this directory) to place at the top
145154
# of the sidebar.
146-
# html_logo = None
155+
html_logo = "_static/redis-cube-red-white-rgb.svg"
147156

148157
# The name of an image file (within the static path) to use as favicon of the
149158
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -153,7 +162,7 @@
153162
# Add any paths that contain custom static files (such as style sheets) here,
154163
# relative to this directory. They are copied after the builtin static files,
155164
# so a file named "default.css" will overwrite the builtin "default.css".
156-
html_static_path = ["_static"]
165+
html_static_path = ["_static", "images"]
157166

158167
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
159168
# using the given strftime format.
@@ -278,4 +287,4 @@
278287
epub_title = "redis-py"
279288
epub_author = "Redis Inc"
280289
epub_publisher = "Redis Inc"
281-
epub_copyright = "2021, Redis Inc"
290+
epub_copyright = "2022, Redis Inc"

docs/examples.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ Examples
1313
examples/search_vector_similarity_examples
1414
examples/pipeline_examples
1515
examples/timeseries_examples
16-
examples/redis-stream-example.ipynb
16+
examples/redis-stream-example
17+
examples/opentelemetry_api_examples

docs/examples/opentelemetry/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Example for redis-py OpenTelemetry instrumentation
2+
3+
This example demonstrates how to monitor Redis using [OpenTelemetry](https://opentelemetry.io/) and
4+
[Uptrace](https://github.com/uptrace/uptrace). It requires Docker to start Redis Server and Uptrace.
5+
6+
See
7+
[Monitoring redis-py performance with OpenTelemetry](https://redis-py.readthedocs.io/en/latest/opentelemetry.html)
8+
for details.
9+
10+
**Step 1**. Download the example using Git:
11+
12+
```shell
13+
git clone https://github.com/redis/redis-py.git
14+
cd example/opentelemetry
15+
```
16+
17+
**Step 2**. Optionally, create a virtualenv:
18+
19+
```shell
20+
python3 -m venv .venv
21+
source .venv/bin/active
22+
```
23+
24+
**Step 3**. Install dependencies:
25+
26+
```shell
27+
pip install -r requirements.txt
28+
```
29+
30+
**Step 4**. Start the services using Docker and make sure Uptrace is running:
31+
32+
```shell
33+
docker-compose up -d
34+
docker-compose logs uptrace
35+
```
36+
37+
**Step 5**. Run the Redis client example and follow the link from the CLI to view the trace:
38+
39+
```shell
40+
python3 main.py
41+
trace: http://localhost:14318/traces/ee029d8782242c8ed38b16d961093b35
42+
```
43+
44+
![Redis trace](./image/redis-py-trace.png)
45+
46+
You can also open Uptrace UI at [http://localhost:14318](http://localhost:14318) to view available
47+
spans, logs, and metrics.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# See https://prometheus.io/docs/alerting/latest/configuration/ for details.
2+
3+
global:
4+
# The smarthost and SMTP sender used for mail notifications.
5+
smtp_smarthost: "mailhog:1025"
6+
smtp_from: "[email protected]"
7+
smtp_require_tls: false
8+
9+
receivers:
10+
- name: "team-X"
11+
email_configs:
12+
13+
send_resolved: true
14+
15+
# The root route on which each incoming alert enters.
16+
route:
17+
# The labels by which incoming alerts are grouped together. For example,
18+
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would
19+
# be batched into a single group.
20+
group_by: ["alertname", "cluster", "service"]
21+
22+
# When a new group of alerts is created by an incoming alert, wait at
23+
# least 'group_wait' to send the initial notification.
24+
# This way ensures that you get multiple alerts for the same group that start
25+
# firing shortly after another are batched together on the first
26+
# notification.
27+
group_wait: 30s
28+
29+
# When the first notification was sent, wait 'group_interval' to send a batch
30+
# of new alerts that started firing for that group.
31+
group_interval: 5m
32+
33+
# If an alert has successfully been sent, wait 'repeat_interval' to
34+
# resend them.
35+
repeat_interval: 3h
36+
37+
# A default receiver
38+
receiver: team-X
39+
40+
# All the above attributes are inherited by all child routes and can
41+
# overwritten on each.
42+
43+
# The child route trees.
44+
routes:
45+
# This route matches error alerts created from spans or logs.
46+
- matchers:
47+
- alert_kind="error"
48+
group_interval: 24h
49+
receiver: team-X
50+
51+
# The directory from which notification templates are read.
52+
templates:
53+
- "/etc/alertmanager/template/*.tmpl"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
extensions:
2+
health_check:
3+
pprof:
4+
endpoint: 0.0.0.0:1777
5+
zpages:
6+
endpoint: 0.0.0.0:55679
7+
8+
receivers:
9+
otlp:
10+
protocols:
11+
grpc:
12+
http:
13+
hostmetrics:
14+
collection_interval: 10s
15+
scrapers:
16+
cpu:
17+
disk:
18+
load:
19+
filesystem:
20+
memory:
21+
network:
22+
paging:
23+
redis:
24+
endpoint: "redis-server:6379"
25+
collection_interval: 10s
26+
jaeger:
27+
protocols:
28+
grpc:
29+
30+
processors:
31+
resourcedetection:
32+
detectors: ["system"]
33+
batch:
34+
send_batch_size: 10000
35+
timeout: 10s
36+
37+
exporters:
38+
logging:
39+
logLevel: debug
40+
otlp:
41+
endpoint: uptrace:14317
42+
tls:
43+
insecure: true
44+
headers: { "uptrace-dsn": "http://project2_secret_token@localhost:14317/2" }
45+
46+
service:
47+
# telemetry:
48+
# logs:
49+
# level: DEBUG
50+
pipelines:
51+
traces:
52+
receivers: [otlp, jaeger]
53+
processors: [batch]
54+
exporters: [otlp, logging]
55+
metrics:
56+
receivers: [otlp]
57+
processors: [batch]
58+
exporters: [otlp]
59+
metrics/hostmetrics:
60+
receivers: [hostmetrics, redis]
61+
processors: [batch, resourcedetection]
62+
exporters: [otlp]
63+
logs:
64+
receivers: [otlp]
65+
processors: [batch]
66+
exporters: [otlp]
67+
68+
extensions: [health_check, pprof, zpages]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[sources.syslog_logs]
2+
type = "demo_logs"
3+
format = "syslog"
4+
interval = 0.1
5+
6+
[sources.apache_common_logs]
7+
type = "demo_logs"
8+
format = "apache_common"
9+
interval = 0.1
10+
11+
[sources.apache_error_logs]
12+
type = "demo_logs"
13+
format = "apache_error"
14+
interval = 0.1
15+
16+
[sources.json_logs]
17+
type = "demo_logs"
18+
format = "json"
19+
interval = 0.1
20+
21+
# Parse Syslog logs
22+
# See the Vector Remap Language reference for more info: https://vrl.dev
23+
[transforms.parse_logs]
24+
type = "remap"
25+
inputs = ["syslog_logs"]
26+
source = '''
27+
. = parse_syslog!(string!(.message))
28+
'''
29+
30+
# Export data to Uptrace.
31+
[sinks.uptrace]
32+
type = "http"
33+
inputs = ["parse_logs", "apache_common_logs", "apache_error_logs", "json_logs"]
34+
encoding.codec = "json"
35+
framing.method = "newline_delimited"
36+
compression = "gzip"
37+
uri = "http://uptrace:14318/api/v1/vector/logs"
38+
#uri = "https://api.uptrace.dev/api/v1/vector/logs"
39+
headers.uptrace-dsn = "http://project2_secret_token@localhost:14317/2"

0 commit comments

Comments
 (0)