Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/redis/_dev/deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG SERVICE_VERSION=${SERVICE_VERSION:-8.2.3}
FROM redis:${SERVICE_VERSION}-alpine
HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 6379

RUN apk add --no-cache netcat-openbsd

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY seed-keyspace.sh /usr/local/bin/seed-keyspace.sh

# Override image entrypoint; keep default CMD (or set your own).
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["redis-server"]
8 changes: 8 additions & 0 deletions packages/redis/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
redis:
build:
context: .
args:
SERVICE_VERSION: ${SERVICE_VERSION}
ports:
- 6379
8 changes: 8 additions & 0 deletions packages/redis/_dev/deploy/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

# Run seeding in background (it will wait for Redis to be ready)
/usr/local/bin/seed-keyspace.sh &

# Hand off to the original entrypoint/command in the foreground (PID 1)
exec docker-entrypoint.sh "$@"
52 changes: 52 additions & 0 deletions packages/redis/_dev/deploy/docker/seed-keyspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
set -eu

# Minimal seeding script for local Redis inside the container.
# Uses only redis-cli defaults (local unix socket / localhost). No host/port flags.

MAX_WAIT_SECONDS="${MAX_WAIT_SECONDS:-30}"
SLEEP_SECONDS="${SLEEP_SECONDS:-0.2}"

KEY_PREFIX="${KEY_PREFIX:-test:keyspace}"
KEY_COUNT="${KEY_COUNT:-3}"

log() {
printf '%s\n' "$*" >&2
}

if ! command -v redis-cli >/dev/null 2>&1; then
log "seed-keyspace: redis-cli not found"
exit 1
fi

log "seed-keyspace: waiting for local redis (max ${MAX_WAIT_SECONDS}s)"
end=$(( $(date +%s) + MAX_WAIT_SECONDS ))

until redis-cli PING >/dev/null 2>&1; do
if [ "$(date +%s)" -ge "${end}" ]; then
log "seed-keyspace: timed out waiting for redis"
# Print one last attempt output to help debugging.
redis-cli PING >&2 || true
exit 1
fi
sleep "${SLEEP_SECONDS}"
done

log "seed-keyspace: redis is up; seeding ${KEY_COUNT} keys"

i=1
while [ "${i}" -le "${KEY_COUNT}" ]; do
redis-cli SET "${KEY_PREFIX}:${i}" "value-${i}" >/dev/null
i=$((i + 1))
done

# Optional: ensure it shows up in INFO keyspace.
if [ "${VERIFY_KEYSPACE:-1}" != "0" ]; then
redis-cli INFO keyspace | grep -E '^db0:' >/dev/null 2>&1 || {
log "seed-keyspace: seed done but INFO keyspace doesn't contain db0"
redis-cli INFO keyspace >&2 || true
exit 1
}
log "seed-keyspace: verified db0 present"
fi

8 changes: 8 additions & 0 deletions packages/redis/_dev/deploy/variants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
variants:
"v6":
SERVICE_VERSION: 6.2.6
"v7":
SERVICE_VERSION: 7.4.7
"v8":
SERVICE_VERSION: 8.2.3
default: v8
5 changes: 5 additions & 0 deletions packages/redis/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.21.0"
changes:
- description: Add new fields for Redis 7.x and 8.x
type: enhancement
link: https://github.com/elastic/integrations/pull/16732
- version: "1.20.0"
changes:
- description: Allow @custom pipeline access to event.original without setting preserve_original_event.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vars:
hosts:
- "{{Hostname}}:6379"
data_stream:
vars: ~
54 changes: 54 additions & 0 deletions packages/redis/data_stream/info/fields/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,21 @@
format: bytes
metric_type: gauge
description: "Used memory by the Lua engine. \n"
- name: used.scripts
type: long
format: bytes
description: >
Used memory by Lua scripts.
- name: used.dataset
type: long
format: bytes
metric_type: gauge
description: "The size in bytes of the dataset \n"
- name: total_system
type: long
format: bytes
description: >
Total amount in bytes of memory available to Redis.
- name: max.value
type: long
format: bytes
Expand Down Expand Up @@ -401,6 +411,8 @@
type: long
- name: config_file
type: keyword
- name: number_of_cached_scripts
type: long
- name: stats
type: group
fields:
Expand Down Expand Up @@ -519,11 +531,53 @@
metric_type: gauge
description: |
Number of keys that were skipped by the active defragmentation process
- name: tracking
type: group
description: >
Redis client side caching tracking stats.
fields:
- name: total_keys
type: long
description: >
Total number of keys being tracked.
- name: total_items
type: long
description: >
Total number of tracked items.
- name: total_prefixes
type: long
description: >
Total number of tracked prefixes.
- name: slowlog.count
type: long
metric_type: gauge
description: |
Count of slow operations
- name: commandstats
type: group
description: >
Redis command statistics
fields:
- name: "*.calls"
type: long
description: >
The number of calls that reached command execution (not rejected).
- name: "*.usec"
type: long
description: >
The total CPU time consumed by these commands.
- name: "*.usec_per_call"
type: float
description: >
The average CPU consumed per command execution.
- name: "*.rejected_calls"
type: long
description: >
The number of rejected calls (on redis 6.2-rc2).
- name: "*.failed_calls"
type: long
description: >
The number of failed calls (on redis 6.2-rc2).
- name: os
type: group
description: The OS fields contain information about the operating system.
Expand Down
Loading