Skip to content
Open
Show file tree
Hide file tree
Changes from 14 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]
70 changes: 70 additions & 0 deletions receiver/redisreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,20 @@ Total number of bytes allocated by Redis using its allocator
| ---- | ----------- | ---------- | --------- |
| 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.net.input

The total number of bytes read from the network
Expand Down Expand Up @@ -252,6 +266,62 @@ The server's current replication offset
| ---- | ----------- | ---------- | --------- |
| By | Gauge | Int | development |

### redis.sentinel.masters

Number of masters monitored by Sentinel.

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

### redis.sentinel.running_scripts

Number of running Sentinel scripts.

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

### redis.sentinel.scripts_queue_length

Length of Sentinel scripts queue.

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

### redis.sentinel.simulate_failure_flags

Simulated failure flags bitmask.

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

### redis.sentinel.tilt

Whether Sentinel is in TILT mode (1 = tilt, 0 = normal).

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {state} | 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 |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {events} | Sum | Int | Cumulative | true |

### redis.slaves.connected

Number of connected replicas
Expand Down
47 changes: 46 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,41 @@ 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))
}),
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)
}
32 changes: 32 additions & 0 deletions 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