forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redis replica offset (open-telemetry#29565)
**Description:** Adds missing metrics for `slave_repl_offset` and adds an integration test to configure a cluster to test such **Link to tracking Issue:** [`6942`](open-telemetry#6942) **Testing:** `cd receiver/redisreceiver && make mod-integration-test` **Documentation:** (autogenerated from mdatagen)
- Loading branch information
Showing
17 changed files
with
554 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: redisreciever | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: adds metric for slave_repl_offset | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [6942] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: also adds a shell script to set up docker-compose integration test | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
receiver/redisreceiver/internal/metadata/generated_config_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
receiver/redisreceiver/internal/metadata/generated_metrics.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
receiver/redisreceiver/internal/metadata/generated_metrics_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
receiver/redisreceiver/testdata/integration/Dockerfile.cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Use the official Redis image as the base | ||
FROM redis:7.2.3 | ||
|
||
RUN apt update && apt install --assume-yes socat | ||
|
||
# Seems to be an upstream issue with testcontainers or scraperint when using named nodes or clusters, so manually do it | ||
COPY cluster.sh /usr/local/bin/cluster.sh | ||
COPY configure-nodes.sh /usr/local/bin/configure-nodes.sh | ||
COPY redis-cluster.conf /etc/redis-cluster.conf | ||
|
||
RUN chown redis:redis /usr/local/bin/cluster.sh | ||
RUN chmod +x /usr/local/bin/cluster.sh | ||
|
||
RUN chown redis:redis /usr/local/bin/configure-nodes.sh | ||
RUN chmod +x /usr/local/bin/configure-nodes.sh | ||
|
||
RUN configure-nodes.sh | ||
RUN chown redis:redis /etc/redis-cluster*.conf | ||
|
||
RUN mkdir -p /var/log/redis | ||
RUN chgrp redis /var/log/redis | ||
|
||
EXPOSE 6379 | ||
EXPOSE 6380 | ||
EXPOSE 6381 | ||
EXPOSE 6382 | ||
EXPOSE 6383 | ||
EXPOSE 6384 | ||
EXPOSE 6385 | ||
ENTRYPOINT ["cluster.sh"] | ||
CMD ["cluster.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh -eux | ||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
redis-server /etc/redis-cluster-6379.conf && \ | ||
redis-server /etc/redis-cluster-6380.conf && \ | ||
redis-server /etc/redis-cluster-6381.conf && \ | ||
redis-server /etc/redis-cluster-6382.conf && \ | ||
redis-server /etc/redis-cluster-6383.conf && \ | ||
redis-server /etc/redis-cluster-6384.conf | ||
redis-cli -p 6379 ping | ||
redis-cli -p 6380 ping | ||
redis-cli -p 6381 ping | ||
redis-cli -p 6382 ping | ||
redis-cli -p 6383 ping | ||
redis-cli -p 6384 ping | ||
|
||
redis-cli --cluster create localhost:6379 localhost:6380 localhost:6381 localhost:6382 localhost:6383 localhost:6384 --cluster-replicas 1 --cluster-yes | ||
sleep 10s | ||
while true; do | ||
if redis-cli -p 6379 cluster info | grep -q "cluster_state:ok" ; then | ||
break | ||
fi | ||
echo "awaiting for cluster to be ready" | ||
sleep 2 | ||
done | ||
|
||
|
||
# ensure a consistent mapping to a replica on port 6385 | ||
REPLICA_PORT=$(redis-cli -p 6379 cluster nodes | grep 'slave' | awk '{print $2}' | cut -d':' -f2 | head -n 1) | ||
REPLICA_PORT=${REPLICA_PORT%@*} | ||
if [ -n "$REPLICA_PORT" ]; then | ||
echo "forwarding from port $REPLICA_PORT to 6385" | ||
#ssh -fNL "6385:127.0.0.1:$REPLICA_PORT" 127.0.0.1 | ||
nohup socat tcp-listen:6385,fork,reuseaddr,forever,reuseaddr,keepalive,keepidle=10,keepintvl=10,keepcnt=2 tcp-connect:127.0.0.1:"$REPLICA_PORT" & | ||
else | ||
echo "could not find replica port" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
tail -f /dev/null | ||
#ssh -fNL 6385:localhost:$REPLICA_PORT |
Oops, something went wrong.