Skip to content

Commit 2912b95

Browse files
authored
Merge branch 'main' into 7ff6dependabot/github_actions/docker/build-push-action-6.1.0
2 parents d9c0654 + 11ef3c6 commit 2912b95

File tree

8 files changed

+35
-32
lines changed

8 files changed

+35
-32
lines changed

.env

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ JAEGERTRACING_IMAGE=jaegertracing/all-in-one:1.57
1414
OPENSEARCH_IMAGE=opensearchproject/opensearch:2.14.0
1515
POSTGRES_IMAGE=postgres:16.3
1616
PROMETHEUS_IMAGE=quay.io/prometheus/prometheus:v2.52.0
17-
REDIS_IMAGE=redis:7.2-alpine
17+
VALKEY_IMAGE=valkey/valkey:7.2-alpine
1818
# must also update the version arg in ./test/tracetesting/Dockerfile
1919
TRACETEST_IMAGE=kubeshop/tracetest:v1.3.0
2020

@@ -129,9 +129,9 @@ FLAGD_PORT=8013
129129
KAFKA_SERVICE_PORT=9092
130130
KAFKA_SERVICE_ADDR=kafka:${KAFKA_SERVICE_PORT}
131131

132-
# Redis
133-
REDIS_PORT=6379
134-
REDIS_ADDR=redis-cart:${REDIS_PORT}
132+
# Valkey
133+
VALKEY_PORT=6379
134+
VALKEY_ADDR=valkey-cart:${VALKEY_PORT}
135135

136136
# ********************
137137
# Telemetry Components

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ the release.
99

1010
* [cartservice] bump .NET package to 1.9.0 release
1111
([#1610](https://github.com/open-telemetry/opentelemetry-demo/pull/1610))
12+
* [Valkey] Replace Redis with Valkey
13+
([#1619](https://github.com/open-telemetry/opentelemetry-demo/pull/1619))
1214

1315
## 1.10.0
1416

docker-compose.minimal.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ services:
6666
environment:
6767
- CART_SERVICE_PORT
6868
- FLAGD_HOST
69-
- REDIS_ADDR
69+
- VALKEY_ADDR
7070
- OTEL_EXPORTER_OTLP_ENDPOINT
7171
- OTEL_RESOURCE_ATTRIBUTES
7272
- OTEL_SERVICE_NAME=cartservice
7373
- ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT}
7474
depends_on:
75-
redis-cart:
75+
valkey-cart:
7676
condition: service_started
7777
otelcol:
7878
condition: service_started
@@ -515,18 +515,18 @@ services:
515515
logging:
516516
*logging
517517

518-
# Redis used by Cart service
519-
redis-cart:
520-
image: ${REDIS_IMAGE}
521-
container_name: redis-cart
522-
user: redis
518+
# Valkey used by Cart service
519+
valkey-cart:
520+
image: ${VALKEY_IMAGE}
521+
container_name: valkey-cart
522+
user: valkey
523523
deploy:
524524
resources:
525525
limits:
526526
memory: 20M
527527
restart: unless-stopped
528528
ports:
529-
- "${REDIS_PORT}"
529+
- "${VALKEY_PORT}"
530530
logging: *logging
531531

532532

docker-compose.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ services:
9696
- CART_SERVICE_PORT
9797
- FLAGD_HOST
9898
- FLAGD_PORT
99-
- REDIS_ADDR
99+
- VALKEY_ADDR
100100
- OTEL_EXPORTER_OTLP_ENDPOINT
101101
- OTEL_RESOURCE_ATTRIBUTES
102102
- OTEL_SERVICE_NAME=cartservice
103103
- ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT}
104104
depends_on:
105-
redis-cart:
105+
valkey-cart:
106106
condition: service_started
107107
otelcol:
108108
condition: service_started
@@ -625,18 +625,18 @@ services:
625625
retries: 10
626626
logging: *logging
627627

628-
# Redis used by Cart service
629-
redis-cart:
630-
image: ${REDIS_IMAGE}
631-
container_name: redis-cart
632-
user: redis
628+
# Valkey used by Cart service
629+
valkey-cart:
630+
image: ${VALKEY_IMAGE}
631+
container_name: valkey-cart
632+
user: valkey
633633
deploy:
634634
resources:
635635
limits:
636636
memory: 20M
637637
restart: unless-stopped
638638
ports:
639-
- "${REDIS_PORT}"
639+
- "${VALKEY_PORT}"
640640
logging: *logging
641641

642642

src/cartservice/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cart Service
22

3-
This service stores user shopping carts in Redis.
3+
This service stores user shopping carts in Valkey.
44

55
## Local Build
66

src/cartservice/src/Program.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
using OpenFeature.Contrib.Hooks.Otel;
2121

2222
var builder = WebApplication.CreateBuilder(args);
23-
string redisAddress = builder.Configuration["REDIS_ADDR"];
24-
if (string.IsNullOrEmpty(redisAddress))
23+
string valkeyAddress = builder.Configuration["VALKEY_ADDR"];
24+
if (string.IsNullOrEmpty(valkeyAddress))
2525
{
26-
Console.WriteLine("REDIS_ADDR environment variable is required.");
26+
Console.WriteLine("VALKEY_ADDR environment variable is required.");
2727
Environment.Exit(1);
2828
}
2929

@@ -33,7 +33,7 @@
3333

3434
builder.Services.AddSingleton<ICartStore>(x=>
3535
{
36-
var store = new RedisCartStore(x.GetRequiredService<ILogger<RedisCartStore>>(), redisAddress);
36+
var store = new ValkeyCartStore(x.GetRequiredService<ILogger<ValkeyCartStore>>(), valkeyAddress);
3737
store.Initialize();
3838
return store;
3939
});
@@ -48,7 +48,7 @@
4848
builder.Services.AddSingleton(x =>
4949
new CartService(
5050
x.GetRequiredService<ICartStore>(),
51-
new RedisCartStore(x.GetRequiredService<ILogger<RedisCartStore>>(), "badhost:1234"),
51+
new ValkeyCartStore(x.GetRequiredService<ILogger<ValkeyCartStore>>(), "badhost:1234"),
5252
x.GetRequiredService<IFeatureClient>()
5353
));
5454

@@ -79,8 +79,8 @@
7979

8080
var app = builder.Build();
8181

82-
var redisCartStore = (RedisCartStore) app.Services.GetRequiredService<ICartStore>();
83-
app.Services.GetRequiredService<StackExchangeRedisInstrumentation>().AddConnection(redisCartStore.GetConnection());
82+
var ValkeyCartStore = (ValkeyCartStore) app.Services.GetRequiredService<ICartStore>();
83+
app.Services.GetRequiredService<StackExchangeRedisInstrumentation>().AddConnection(ValkeyCartStore.GetConnection());
8484

8585
app.MapGrpcService<CartService>();
8686
app.MapGrpcHealthChecksService();

src/cartservice/src/cartstore/RedisCartStore.cs src/cartservice/src/cartstore/ValkeyCartStore.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace cartservice.cartstore;
1212

13-
public class RedisCartStore : ICartStore
13+
public class ValkeyCartStore : ICartStore
1414
{
1515
private readonly ILogger _logger;
1616
private const string CartFieldName = "cart";
@@ -25,13 +25,13 @@ public class RedisCartStore : ICartStore
2525

2626
private readonly ConfigurationOptions _redisConnectionOptions;
2727

28-
public RedisCartStore(ILogger<RedisCartStore> logger, string redisAddress)
28+
public ValkeyCartStore(ILogger<ValkeyCartStore> logger, string valkeyAddress)
2929
{
3030
_logger = logger;
3131
// Serialize empty cart into byte array.
3232
var cart = new Oteldemo.Cart();
3333
_emptyCartBytes = cart.ToByteArray();
34-
_connectionString = $"{redisAddress},ssl=false,allowAdmin=true,abortConnect=false";
34+
_connectionString = $"{valkeyAddress},ssl=false,allowAdmin=true,abortConnect=false";
3535

3636
_redisConnectionOptions = ConfigurationOptions.Parse(_connectionString);
3737

src/otelcollector/otelcol-config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ receivers:
1414
targets:
1515
- endpoint: http://frontendproxy:${env:ENVOY_PORT}
1616
redis:
17-
endpoint: "redis-cart:6379"
17+
endpoint: "valkey-cart:6379"
18+
username: "valkey"
1819
collection_interval: 10s
1920

2021
exporters:

0 commit comments

Comments
 (0)