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
27 changes: 27 additions & 0 deletions .chloggen/feat_42365.yaml
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: "receiver/redis"

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add support for redis.mode and redis.sentinel.* metrics"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [42365]

# (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:

# 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]
78 changes: 70 additions & 8 deletions receiver/redisreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,6 @@ The server's current replication offset
| ---- | ----------- | ---------- | --------- |
| By | Gauge | Int | development |

### redis.slaves.connected

Number of connected replicas

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
| {replica} | Sum | Int | Cumulative | false | development |

### redis.uptime

Number of seconds since Redis server start
Expand Down Expand Up @@ -431,6 +423,20 @@ The value of the maxmemory configuration directive
| ---- | ----------- | ---------- | --------- |
| By | Gauge | Int | development |

### redis.mode

Redis server mode

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {mode} | Gauge | Int |

#### Attributes

| Name | Description | Values | Optional |
| ---- | ----------- | ------ | -------- |
| mode | Redis server mode | Str: ``cluster``, ``sentinel``, ``standalone`` | false |

### redis.replication.replica_offset

Offset for redis replica
Expand All @@ -453,6 +459,62 @@ Redis node's role
| ---- | ----------- | ------ | -------- |
| role | Redis node's role | Str: ``replica``, ``primary`` | false |

### redis.sentinel.masters

Number of masters monitored by Sentinel.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {master} | Gauge | Int |

### redis.sentinel.running_scripts

Number of running Sentinel scripts.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {script} | Gauge | Int |

### redis.sentinel.scripts_queue_length

Length of Sentinel scripts queue.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {script} | Gauge | Int |

### redis.sentinel.simulate_failure_flags

Simulated failure flags bitmask.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {flag} | Gauge | Int |

### redis.sentinel.tilt_since_seconds

Duration in seconds of current TILT, or -1 if not in TILT mode.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Int |

### redis.sentinel.total_tilt

Total TILT occurrences since start.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {event} | Sum | Int | Cumulative | true |

### redis.slaves.connected

Number of connected replicas

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
| {replica} | Sum | Int | Cumulative | false | development |

## Resource Attributes

| Name | Description | Values | Enabled |
Expand Down
54 changes: 53 additions & 1 deletion receiver/redisreceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/pmetrictest"
)

const redisPort = "6379"
const (
redisPort = "6379"
sentinelPort = "26379"
)

func TestIntegrationV6(t *testing.T) {
scraperinttest.NewIntegrationTest(
Expand All @@ -38,6 +41,8 @@ func TestIntegrationV6(t *testing.T) {
scraperinttest.WithCompareOptions(
pmetrictest.IgnoreMetricValues(),
pmetrictest.IgnoreMetricDataPointsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreTimestamp(),
pmetrictest.ChangeResourceAttributeValue("server.address", func(_ string) string {
Expand Down Expand Up @@ -83,6 +88,8 @@ func TestIntegrationV7Cluster(t *testing.T) {
scraperinttest.WithCompareOptions(
pmetrictest.IgnoreMetricValues(),
pmetrictest.IgnoreMetricDataPointsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreTimestamp(),
),
Expand All @@ -91,3 +98,48 @@ func TestIntegrationV7Cluster(t *testing.T) {
scraperinttest.WithCompareTimeout(time.Minute),
).Run(t)
}

func TestIntegrationV8Sentinel(t *testing.T) {
scraperinttest.NewIntegrationTest(
NewFactory(),
scraperinttest.WithContainerRequest(
testcontainers.ContainerRequest{
Image: "redis:8.2.1",
ExposedPorts: []string{sentinelPort},
Cmd: []string{
"redis-sentinel",
"/etc/redis/sentinel.conf",
},
Files: []testcontainers.ContainerFile{
{
HostFilePath: filepath.Join("testdata", "integration", "redis-sentinel.conf"),
ContainerFilePath: "/etc/redis/sentinel.conf",
FileMode: 0o644,
},
},
WaitingFor: wait.ForListeningPort(sentinelPort),
}),
scraperinttest.WithCustomConfig(
func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) {
rCfg := cfg.(*Config)
rCfg.Endpoint = fmt.Sprintf("%s:%s", ci.Host(t), ci.MappedPort(t, sentinelPort))
rCfg.MetricsBuilderConfig.Metrics.RedisMode.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelMasters.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelRunningScripts.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelScriptsQueueLength.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelSimulateFailureFlags.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelTiltSinceSeconds.Enabled = true
rCfg.MetricsBuilderConfig.Metrics.RedisSentinelTotalTilt.Enabled = true
}),
scraperinttest.WithCompareOptions(
pmetrictest.IgnoreMetricValues(),
pmetrictest.IgnoreMetricDataPointsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreTimestamp(),
),
scraperinttest.WithExpectedFile(filepath.Join("testdata", "integration", "expected-sentinel.yaml")),
scraperinttest.WithCreateContainerTimeout(time.Minute),
).Run(t)
}
30 changes: 29 additions & 1 deletion receiver/redisreceiver/internal/metadata/generated_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading