diff --git a/.env b/.env index dd86d9dbe2..f85b34f366 100644 --- a/.env +++ b/.env @@ -14,7 +14,7 @@ JAEGERTRACING_IMAGE=jaegertracing/all-in-one:1.57 OPENSEARCH_IMAGE=opensearchproject/opensearch:2.14.0 POSTGRES_IMAGE=postgres:16.3 PROMETHEUS_IMAGE=quay.io/prometheus/prometheus:v2.52.0 -REDIS_IMAGE=redis:7.2-alpine +VALKEY_IMAGE=valkey/valkey:7.2-alpine # must also update the version arg in ./test/tracetesting/Dockerfile TRACETEST_IMAGE=kubeshop/tracetest:v1.3.0 @@ -25,6 +25,8 @@ ENV_PLATFORM=local OTEL_COLLECTOR_HOST=otelcol OTEL_COLLECTOR_PORT_GRPC=4317 OTEL_COLLECTOR_PORT_HTTP=4318 +OTEL_COLLECTOR_CONFIG=./src/otelcollector/otelcol-config.yml +OTEL_COLLECTOR_CONFIG_EXTRAS=./src/otelcollector/otelcol-config-extras.yml OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC} PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:8080/otlp-http/v1/traces @@ -129,9 +131,9 @@ FLAGD_PORT=8013 KAFKA_SERVICE_PORT=9092 KAFKA_SERVICE_ADDR=kafka:${KAFKA_SERVICE_PORT} -# Redis -REDIS_PORT=6379 -REDIS_ADDR=redis-cart:${REDIS_PORT} +# Valkey +VALKEY_PORT=6379 +VALKEY_ADDR=valkey-cart:${VALKEY_PORT} # ******************** # Telemetry Components diff --git a/.github/workflows/component_build-images.yml b/.github/workflows/component_build-images.yml index f10d648878..179e8d3d9c 100644 --- a/.github/workflows/component_build-images.yml +++ b/.github/workflows/component_build-images.yml @@ -162,7 +162,7 @@ jobs: max-parallelism = 2 - name: Matrix Build and push demo images if: steps.check_changes.outputs.skip == 'false' - uses: docker/build-push-action@v6.0.1 + uses: docker/build-push-action@v6.1.0 with: context: ${{ matrix.file_tag.context }} file: ${{ matrix.file_tag.file }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 257373c3cd..51bf0911e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,17 @@ the release. ## Unreleased -* [cartservice] bump .NET package to 1.9.0 release - ([#1610](https://github.com/open-telemetry/opentelemetry-demo/pull/1610)) * [accountingservice] convert from Go service to .NET service, uses OpenTelemetry .NET Automatic Instrumentation. ([#1538](https://github.com/open-telemetry/opentelemetry-demo/pull/1538)) +* [frontend] fixed default flagd port for HTTPS connections + ([#1609](https://github.com/open-telemetry/opentelemetry-demo/pull/1609)) +* [cartservice] bump .NET package to 1.9.0 release + ([#1610](https://github.com/open-telemetry/opentelemetry-demo/pull/1610)) +* [Valkey] Replace Redis with Valkey + ([#1619](https://github.com/open-telemetry/opentelemetry-demo/pull/1619)) +* ([recommendation] updated flag name to match flagd configuration + ([#1634](https://github.com/open-telemetry/opentelemetry-demo/pull/1634)) ## 1.10.0 diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 8d1fa8961b..5720b4e0c8 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -66,13 +66,13 @@ services: environment: - CART_SERVICE_PORT - FLAGD_HOST - - REDIS_ADDR + - VALKEY_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=cartservice - ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT} depends_on: - redis-cart: + valkey-cart: condition: service_started otelcol: condition: service_started @@ -515,18 +515,18 @@ services: logging: *logging - # Redis used by Cart service - redis-cart: - image: ${REDIS_IMAGE} - container_name: redis-cart - user: redis + # Valkey used by Cart service + valkey-cart: + image: ${VALKEY_IMAGE} + container_name: valkey-cart + user: valkey deploy: resources: limits: memory: 20M restart: unless-stopped ports: - - "${REDIS_PORT}" + - "${VALKEY_PORT}" logging: *logging @@ -584,8 +584,8 @@ services: restart: unless-stopped command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ] volumes: - - ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml - - ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml + - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml + - ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml ports: - "${OTEL_COLLECTOR_PORT_GRPC}" - "${OTEL_COLLECTOR_PORT_HTTP}" diff --git a/docker-compose.yml b/docker-compose.yml index 66210af3de..511883c21f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -96,13 +96,13 @@ services: - CART_SERVICE_PORT - FLAGD_HOST - FLAGD_PORT - - REDIS_ADDR + - VALKEY_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=cartservice - ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT} depends_on: - redis-cart: + valkey-cart: condition: service_started otelcol: condition: service_started @@ -190,7 +190,7 @@ services: # Email service emailservice: - image: demo/emailservice-contrib:latest + image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice container_name: email-service build: context: ./ @@ -625,18 +625,18 @@ services: retries: 10 logging: *logging - # Redis used by Cart service - redis-cart: - image: ${REDIS_IMAGE} - container_name: redis-cart - user: redis + # Valkey used by Cart service + valkey-cart: + image: ${VALKEY_IMAGE} + container_name: valkey-cart + user: valkey deploy: resources: limits: memory: 20M restart: unless-stopped ports: - - "${REDIS_PORT}" + - "${VALKEY_PORT}" logging: *logging @@ -694,8 +694,8 @@ services: restart: unless-stopped command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ] volumes: - - ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml - - ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml + - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml + - ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml ports: - "${OTEL_COLLECTOR_PORT_GRPC}" - "${OTEL_COLLECTOR_PORT_HTTP}" diff --git a/src/cartservice/README.md b/src/cartservice/README.md index 1de0ee0c33..fbc6fbc1ee 100644 --- a/src/cartservice/README.md +++ b/src/cartservice/README.md @@ -1,6 +1,6 @@ # Cart Service -This service stores user shopping carts in Redis. +This service stores user shopping carts in Valkey. ## Local Build diff --git a/src/cartservice/src/Program.cs b/src/cartservice/src/Program.cs index 15baaa64df..e4e6a28e11 100644 --- a/src/cartservice/src/Program.cs +++ b/src/cartservice/src/Program.cs @@ -20,10 +20,10 @@ using OpenFeature.Contrib.Hooks.Otel; var builder = WebApplication.CreateBuilder(args); -string redisAddress = builder.Configuration["REDIS_ADDR"]; -if (string.IsNullOrEmpty(redisAddress)) +string valkeyAddress = builder.Configuration["VALKEY_ADDR"]; +if (string.IsNullOrEmpty(valkeyAddress)) { - Console.WriteLine("REDIS_ADDR environment variable is required."); + Console.WriteLine("VALKEY_ADDR environment variable is required."); Environment.Exit(1); } @@ -33,7 +33,7 @@ builder.Services.AddSingleton(x=> { - var store = new RedisCartStore(x.GetRequiredService>(), redisAddress); + var store = new ValkeyCartStore(x.GetRequiredService>(), valkeyAddress); store.Initialize(); return store; }); @@ -48,7 +48,7 @@ builder.Services.AddSingleton(x => new CartService( x.GetRequiredService(), - new RedisCartStore(x.GetRequiredService>(), "badhost:1234"), + new ValkeyCartStore(x.GetRequiredService>(), "badhost:1234"), x.GetRequiredService() )); @@ -79,8 +79,8 @@ var app = builder.Build(); -var redisCartStore = (RedisCartStore) app.Services.GetRequiredService(); -app.Services.GetRequiredService().AddConnection(redisCartStore.GetConnection()); +var ValkeyCartStore = (ValkeyCartStore) app.Services.GetRequiredService(); +app.Services.GetRequiredService().AddConnection(ValkeyCartStore.GetConnection()); app.MapGrpcService(); app.MapGrpcHealthChecksService(); diff --git a/src/cartservice/src/cartstore/RedisCartStore.cs b/src/cartservice/src/cartstore/ValkeyCartStore.cs similarity index 96% rename from src/cartservice/src/cartstore/RedisCartStore.cs rename to src/cartservice/src/cartstore/ValkeyCartStore.cs index b9f54bcca0..aa79afedea 100644 --- a/src/cartservice/src/cartstore/RedisCartStore.cs +++ b/src/cartservice/src/cartstore/ValkeyCartStore.cs @@ -10,7 +10,7 @@ namespace cartservice.cartstore; -public class RedisCartStore : ICartStore +public class ValkeyCartStore : ICartStore { private readonly ILogger _logger; private const string CartFieldName = "cart"; @@ -25,13 +25,13 @@ public class RedisCartStore : ICartStore private readonly ConfigurationOptions _redisConnectionOptions; - public RedisCartStore(ILogger logger, string redisAddress) + public ValkeyCartStore(ILogger logger, string valkeyAddress) { _logger = logger; // Serialize empty cart into byte array. var cart = new Oteldemo.Cart(); _emptyCartBytes = cart.ToByteArray(); - _connectionString = $"{redisAddress},ssl=false,allowAdmin=true,abortConnect=false"; + _connectionString = $"{valkeyAddress},ssl=false,allowAdmin=true,abortConnect=false"; _redisConnectionOptions = ConfigurationOptions.Parse(_connectionString); diff --git a/src/frontend/pages/_app.tsx b/src/frontend/pages/_app.tsx index 00a7e696b5..e49b51f7c6 100755 --- a/src/frontend/pages/_app.tsx +++ b/src/frontend/pages/_app.tsx @@ -37,12 +37,19 @@ if (typeof window !== 'undefined') { * We connect to flagd through the envoy proxy, straight from the browser, * for this we need to know the current hostname and port. */ + + const useTLS = window.location.protocol === 'https:'; + let port = useTLS ? 443 : 80; + if (window.location.port) { + port = parseInt(window.location.port, 10); + } + OpenFeature.setProvider( new FlagdWebProvider({ host: window.location.hostname, pathPrefix: 'flagservice', - port: window.location.port ? parseInt(window.location.port, 10) : 80, - tls: window.location.protocol === 'https:', + port: port, + tls: useTLS, maxRetries: 3, maxDelay: 10000, }) diff --git a/src/otelcollector/otelcol-config.yml b/src/otelcollector/otelcol-config.yml index a6aebeb293..f8a34399cd 100644 --- a/src/otelcollector/otelcol-config.yml +++ b/src/otelcollector/otelcol-config.yml @@ -14,7 +14,8 @@ receivers: targets: - endpoint: http://frontendproxy:${env:ENVOY_PORT} redis: - endpoint: "redis-cart:6379" + endpoint: "valkey-cart:6379" + username: "valkey" collection_interval: 10s exporters: diff --git a/src/recommendationservice/recommendation_server.py b/src/recommendationservice/recommendation_server.py index c7302bcac5..1a6826d80d 100644 --- a/src/recommendationservice/recommendation_server.py +++ b/src/recommendationservice/recommendation_server.py @@ -75,7 +75,7 @@ def get_product_list(request_product_ids): request_product_ids = request_product_ids_str.split(',') # Feature flag scenario - Cache Leak - if check_feature_flag("recommendationCache"): + if check_feature_flag("recommendationServiceCacheFailure"): span.set_attribute("app.recommendation.cache_enabled", True) if random.random() < 0.5 or first_run: first_run = False