Resources

Connect with Otel-Collector Redis Receiver - Cloud Documentation

June 29, 2024 by OpenObserve Team
otel collector redis receiver

Introduction

Are you looking to streamline your Cloud Monitoring? Your guide to connecting with the otel collector redis receiver is here.

What is Redis?

Redis is an open-source, in-memory data store and messaging system designed for high-performance and high-availability applications. Through Redis, publishers send messages to channels, and subscribers receive messages from these channels.

What is Redis?

Image Credit

Check out on Youtube: Redis Tutorial for Beginners

What is a Otel Collector Redis Receiver?

The otel collector redis receiver is a component that subscribes to Redis channels and receives messages published to those channels. It is typically used in applications where multiple publishers send messages to a common channel, and multiple subscribers need to receive them.

What is a Otel Collector Redis Receiver?

Image Credit

General Features

  • The otel collector redis receiver captures Performance Metrics, Memory Metrics, and Activity Metrics from Redis instances.
  • The otel collector redis receiver collects these metrics by leveraging the INFO command in the Redis command-line interface.
  • Further, the otel collector redis receiver is compatible with Kubernetes and Linux environments by supporting various Kubernetes distributions and Linux versions.
  • This ensures that Redis Enterprise Software can be deployed and managed effectively in these environments.
  • Finally, the otel collector redis receiver supports Redis versions 2.8 and higher, providing enhanced performance, reliability, and security for Redis instances.

In summary, the otel collector redis receiver is a component that subscribes to Redis channels and receives messages published to those channels. It is typically used when you need to monitor and analyze Redis performance.

Check out Redis on Youtube

Metrics Captured

The otel collector redis receiver helps with the following metrics by collecting data from Redis instances. Then, it converts it into OpenTelemetry metrics and sends it to the following consumer at a configurable interval.

Memory Used

  • The otel collector redis receiver monitors memory usage metrics like memory_used to track the amount of memory Redis allocates for data storage.
  • This metric is crucial for understanding memory consumption patterns and preventing issues like out-of-memory errors.

Commands Processed Per Second

  • The otel collector redis receiver captures this metric to assess the system's responsiveness and optimize command processing.
  • Monitoring the rate of commands processed per second provides insights into the workload and performance of the Redis instance.

Number of Connected Clients and Followers

  • The otel collector redis receiver provides visibility into client connections, enabling administrators to manage client load and ensure smooth operation under varying client demands.
  • Tracking the number of connected clients and followers helps understand the system's usage and capacity.

Number of Blocked Clients

  • The otel collector redis receiver captures this metric to troubleshoot client connection problems and optimize system responsiveness.
  • Monitoring the number of blocked clients indicates potential performance issues or contention in the system.

Number of Keys Stored per Database

  • The otel collector redis receiver tracks this metric to manage data distribution effectively and ensure efficient key-value storage across databases.
  • Measuring the number of keys stored per database offers insights into data distribution and storage patterns within Redis.

Uptime

  • The otel collector redis receiver monitors uptime to assess system stability and track performance trends.
  • Uptime reflects the duration the Redis instance has been running without interruptions.

Changes Since Last Save

  • The otel collector redis receiver captures this metric to monitor data integrity by identifying changes that need to be persisted.
  • Tracking changes since the last save provides data modifications and persistence status visibility.

Replication Delay per Follower

  • The otel collector redis receiver measures this metric to identify replication lag and ensure data consistency and availability across follower instances.
  • Monitoring replication delay per follower helps assess data synchronization and consistency across replicas.

Get started for FREE with OpenObserve

Common Issues Faced When Capturing Metrics with Otel Collector Redis Receiver

The following issues should be considered while capturing metrics with otel collector redis receiver.

  • Data Inconsistencies
  • Missing Metrics
  • Incorrect Metric Units
  • Inadequate Configuration
  • Redis Instance Configuration

By capturing these metrics, you can optimize Redis configuration and ensure high availability and performance under varying workloads.

Next, you need to configure the otel collector redis receiver to send metrics to an observability tool like OpenObserve to gain deeper insights into Redis performance and identify areas for improvement.

OpenObserve allows you to export the collected Redis metrics to various backends, such as Google Cloud Ops.

Get started for FREE with OpenObserve

Are you a Developer?

Join OpenObserve on Github

Check This Video on YouTube: Integrating Redis and Python

Deployment

The combination of Kubernetes and Linux provides a robust infrastructure for deploying, managing, and scaling the otel collector redis receiver. This ensures efficient monitoring and capturing of metrics from Redis instances.

Here are the steps to deploy the integration of otel collector redis receiver on Kubernetes and Linux:

Kubernetes Deployment

  • Create a new namespace in your Kubernetes cluster for the Redis Enterprise cluster (REC).
  • Download the operator bundle containing the required images.
  • Apply the operator bundle in the REC namespace to deploy the Redis Enterprise operator.
  • Verify the operator is running by checking the deployment status.
  • Create a Redis Enterprise cluster (REC) using the deployed operator.

Linux Deployment

  • Install the OpenTelemetry Collector using the following command:

bash

npm install --save @opentelemetry/opentelemetry-collector

  • Configure the OpenTelemetry Collector to collect Redis metrics by setting up the otel collector redis receiver and specifying the Redis server details.
  • Configure the otel collector redis receiver in the OpenTelemetry Collector configuration file, specifying the Redis instance endpoint, username, password, and other optional settings like collection interval and TLS.
  • Include the otel collector redis receiver in the metrics pipeline of the service section in the OpenTelemetry Collector configuration file.
  • Start the OpenTelemetry Collector to begin collecting Redis metrics and sending them to the following consumer.

By following these steps, you can deploy the integration of otel collector redis receiver on both Kubernetes and Linux environments to monitor Redis performance and collect valuable metrics for analysis and optimization.

The deployment of the otel collector redis receiver ensures that it is running and ready to collect metrics from Redis instances.

The otel collector redis receiver requires specific configuration settings to function correctly.

OpenObserve provides a simple installation process for the OpenTelemetry Collector, which includes the otel collector redis receiver.

Get started for FREE with OpenObserve

Configuration of the Otel Collector Redis Receiver

The otel collector redis receiver's configuration involves specifying settings to retrieve Redis INFO data, build metrics, and send them to the next consumer.

The otel collector redis receiver configuration can be customized based on specific requirements and environment setups.

OpenObserve provides a sample configuration for the otel collector redis receiver in the config.yaml file. You can customize this configuration to match your Redis instance settings.

Get started for FREE with OpenObserve

Configuration Guidelines

Include the Smart Agent receiver in the configuration file

To include the otel collector redis receiver in the configuration file, specify the receiver in the receivers section of the configuration file. Here is an example:

yaml
receivers:
  redis:
    endpoint: "localhost:16379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}

Add the monitor type to the Collector configuration

To add the otel collector redis receiver to the Collector configuration, you need to specify the monitor type in the monitors section of the configuration file. Here is an example:

yaml
monitors:
  - type: redis
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}

Common Configuration Settings for Monitors

Here are some common configuration settings for monitors:

  • Endpoint: The hostname and port of the Redis instance are separated by a colon. For example, localhost:6379.
  • Collection Interval: The duration between runs of the receiver. For example, 10s.
  • Password: The password used to access the Redis instance must match the password specified in the requirepass server configuration option. No default value.
  • Transport: Defines the network to use for connecting to the server: tcp or unix. tcp by default.
  • TLS Settings: If TLS is required, you can specify the CA file, cert file, and key file. For example:
    yaml
    tls:
      insecure: true
      ca_file: /path/to/ca.crt
      cert_file: /path/to/cert.crt
      key_file: /path/to/key.key

In summary

  • The otel collector redis receiver can be included in the configuration file by specifying the receiver in the receivers section.
  • The monitor type can be added to the Collector configuration by specifying the monitor type in the monitors section.
  • Common configuration settings include the endpoint, collection interval, password, transport, and TLS settings.
  • Additional configuration options include resource detection, exporters, and pipelines.

The configuration guidelines provided are essential for ensuring the efficient and secure operation of the otel collector redis receiver.

Get started for FREE with OpenObserve

Example Configuration

Configuration Snippet for the Redis Monitor

Here's an example configuration snippet for the Redis monitor:

yaml
receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}
    tls:
      insecure: true

In this example:

  • The receivers section specifies the otel collector redis receiver.
  • The endpoint is set to "localhost:6379", the default Redis port on the local machine.
  • The collection_interval is set to 10s, meaning the receiver will collect metrics every 10 seconds.
  • The password is set using an environment variable ${env:REDIS_PASSWORD}.
  • This allows the password to be stored securely outside the configuration file.
  • The tls section is set to insecure: true, which disables TLS verification for the Redis connection.
  • In a production environment, you should use proper TLS certificates.

This configuration snippet assumes that Redis is running on the local machine and is not password-protected. In a real-world scenario, you would need to adjust the endpoint and password settings to match your Redis instance configuration.

Configuration Snippet for the Redis Monitor in the Collector Configuration

yaml
monitors:
  - type: redis
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}
    tls:
      insecure: true

This configuration snippet is similar to the previous one but is placed in the monitors section of the Collector configuration file. The type is set to redis to specify the Redis monitor.

The rest of the configuration settings are the same as in the previous example.

This configuration snippet assumes that the Redis monitor is being used in the context of the OpenTelemetry Collector, which is a common way to deploy and configure the otel collector redis receiver.

Adjust the configuration settings to match your specific Redis instance and environment requirements.

Configuration Settings for Redis Integration

Configuration options refer to specific settings that can be adjusted to customize a system's or application's behavior or functionality.

Explanation of Configuration Options

Here is a brief description of Configuration options:

  • Host: The hostname or IP address of the Redis instance.
  • Port: The port number that Redis listens on (default: 6379).
  • PythonBinary: The path to the Python binary used for executing the otel collector redis receiver.
  • Name: The name of the otel collector redis receiver.
  • Auth: The password used to authenticate with the Redis instance.
  • SendListLengths: A configuration object that controls the sending of list lengths.
  • Verbose: A flag to enable verbose logging.

Details on 'sendListLengths' Configuration Object

Here is a brief description of 'sendListLengths' Configuration Object

  • SendListLengths: A configuration object that controls the sending of list lengths.
  • Enabled: A flag to enable or disable sending list lengths.
  • Interval: The interval at which list lengths are sent (in seconds).

These configuration settings are used to integrate Redis with the otel collector redis receiver, allowing for the collection and processing of Redis metrics.

Monitoring List Lengths

Monitoring list lengths is essential for ensuring the reliability and scalability of Redis-based applications.

How do you Specify the Key and Database Index for List Length Monitoring?

To monitor the length of Redis list keys, you need to specify the key pattern and database index in the configuration using the following syntax:

yaml
sendListLengths:
  - databaseIndex: $db_index
    keypattern: "$key_name"

Here's how to configure it:

  • Specify the database index where the list keys reside using the databaseIndex parameter. Replace $db_index with the actual database index number.
  • Specify the key pattern to match the list keys you want to monitor using the keyPattern parameter. You can use a glob-style pattern with a single wildcard \\*. Surround the pattern with double quotes (") to ensure the \\* is interpreted correctly.

For example, to monitor list keys in database index 0 that match the pattern queue_*, the configuration would be:

yaml
sendListLengths:
  - databaseIndex: 0
    keyPattern: "queue_*"

This configuration will monitor the length of all Redis list keys in database 0 that start with queue_.

By configuring the database index and key pattern, you can effectively monitor the length of specific Redis list keys and gain insights into your Redis-based applications.

Available Metrics

These metrics are collected by the otel collector redis receiver integration.

Gauge Metrics

  • CPU
    • workload.googleapis.com/redis.cpu.time (cumulative, double, gce_instance)
  • Memory
    • workload.googleapis.com/redis.memory.fragmentation_ratio (gauge, double, gce_instance)
  • Connections
    • workload.googleapis.com/redis.clients.blocked (gauge, int64, gce_instance)
    • workload.googleapis.com/redis.clients.connected (gauge, int64, gce_instance)
    • workload.googleapis.com/redis.clients.max_input_buffer (gauge, int64, gce_instance)
    • workload.googleapis.com/redis.clients.max_output_buffer (gauge, int64, gce_instance)

Cumulative Metrics

  • Commands
    • workload.googleapis.com/redis.commands.processed (cumulative, int64, gce_instance)
  • Connections
    • workload.googleapis.com/redis.connections.received (cumulative, int64, gce_instance)
    • workload.googleapis.com/redis.connections.rejected (cumulative, int64, gce_instance)
  • Keys
    • workload.googleapis.com/redis.keys.evicted (cumulative, int64, gce_instance)
    • workload.googleapis.com/redis.keys.expired (cumulative, int64, gce_instance)
    • workload.googleapis.com/redis.keyspace.hits (cumulative, int64, gce_instance)
    • workload.googleapis.com/redis.keyspace.misses (cumulative, int64, gce_instance)
  • Replication
    • workload.googleapis.com/redis.latest_fork (cumulative, int64, gce_instance)

Other Metrics

  • Redis INFO
    • workload.googleapis.com/redis.master_link_health_status (boolean, gce_instance)

Get started for FREE with OpenObserve

Enhancing Monitoring Capabilities

How to Add Additional Metrics?

To add additional metrics to the otel collector redis receiver configuration, you can modify the metrics section of the configuration file. Here's an example of how to add a new metric:

yaml
receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 60s
    metrics:
      - name: "redis.memory.fragmentation_ratio"
        description: "Ratio between used_memory_rss and used_memory"
        type: gauge
        unit: ratio
        value: memory.fragmentation_ratio

In the above example:

  • The metrics section is added under the otel collector redis receiver configuration.
  • Each metric is defined as an object with the following fields:
  • name: The name of the metric.
  • description: A brief description of the metric.
  • type: The type of the metric (e.g., gauge, counter).
  • unit: The unit of measurement for the metric.
  • value: The Redis command or property that provides the metric value.

You can add multiple metrics by adding more objects to the metrics list.

Notes on Metric Types and Categories

The otel collector redis receiver supports the following metric types:

  • Gauge: Represents a single numerical value that can arbitrarily go up and down. Examples: redis.memory.used, redis.clients.connected.
  • Counter: Represents a monotonically increasing numerical value. Examples: redis.commands.processed, redis.connections.received.

The metrics can be categorized into the following groups:

  • CPU: Metrics related to CPU usage, such as redis.cpu.time.
  • Memory: Metrics related to memory usage, such as redis.memory.used, redis.memory.fragmentation_ratio.
  • Clients: Metrics related to client connections, such as redis.clients.connected, redis.clients.blocked.
  • Keys: Metrics related to key management, such as redis.keys.expired, redis.keys.evicted.
  • Connections: Metrics related to incoming connections, such as redis.connections.received, redis.connections.rejected.
  • Commands: Metrics related to command processing, such as redis.commands.processed.

By adding more metrics to the configuration and categorizing them appropriately, you can enhance the monitoring capabilities of the otel collector redis receiver and gain deeper insights into your Redis instances.

OpenObserve allows you to monitor Redis metrics in real-time, providing instant visibility into performance and usage.

Get started for FREE with OpenObserve

Troubleshooting

Here are some guidelines for troubleshooting Redis command performance issues:

Identify Slow Commands

  • Use the SLOWLOG command to identify slow commands that are taking a long time to execute.
  • Lower the slowlog-log-slower-than threshold using CONFIG SET to capture more slow commands.
  • Avoid using KEYS commands, which scan the entire keyspace and can be slow.
  • Be aware of MGET commands, which can impact the true operations per second (ops/s) rate.

Optimize Slow Commands

  • If EVALSHA commands are slow, consider using EVAL instead.
  • For HGETALL and HMGET commands, use HGET and HMSET for individual fields instead.
  • Avoid SCAN commands, as they can be slow for large datasets.

Monitor Performance Metrics

  • Track latency, the time between a client request and server response, as it's the most direct way to detect performance issues.
  • Monitor instantaneous_ops_per_sec, the total number of commands processed per second, to identify throughput issues.
  • Calculate the cache hit rate using keyspace_hits / (keyspace_hits + keyspace_misses) to ensure the cache is being used effectively.

Optimize Memory Usage

  • Use the MEMORY STATS command to get memory usage statistics and identify potential issues.
  • Run MEMORY DOCTOR to get suggestions for resolving memory consumption problems.
  • Scale up to a larger cache size with more CPU cores if memory usage is high.
  • Avoid memory fragmentation by storing data with consistent sizes.

Scale Redis

  • Scale out by adding more shards to distribute load across multiple Redis processes.
  • Scale up to a larger cache size with more CPU cores to handle higher loads.
  • Avoid rapid changes in the number of client connections to prevent spikes.

By following these guidelines and using the provided Redis commands, you can effectively troubleshoot and optimize Redis command performance issues in your application.

Get started for FREE with OpenObserve

Support and Resources

Here are the links and tutorials for connecting with otel collector redis receiver in cloud documentation:

Redis Cloud Quick Start

otel collector redis receiver | OpenObserve documentation

About Us | Open Source Observability Platform

otel collector redis receiver — Splunk Observability Cloud documentation

Redis | Google Cloud Observability

Redis Enterprise integration | Grafana Cloud documentation

otel collector redis receiver configuration | Splunk Observability Cloud documentation

Redis metrics | Splunk Observability Cloud documentation

Redis troubleshooting | Splunk Observability Cloud documentation

These resources provide detailed information on setting up and configuring the otel collector redis receiver for various cloud platforms like Open Observe, Google Cloud Observability, and Grafana Cloud.

Get started for FREE with OpenObserve

Contact OpenObserve Team for a free Demo

About Us | Open Source Observability Platform for Logs, Metrics, Traces ...

Author:

authorImage

The OpenObserve Team comprises dedicated professionals committed to revolutionizing system observability through their innovative platform, OpenObserve. Dedicated to streamlining data observation and system monitoring, offering high performance and cost-effective solutions for diverse use cases.

OpenObserve Inc. © 2024