Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 22, 2024
2 parents 27b4923 + c79152c commit 00a1695
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ COLLECTOR_CONTRIB_IMAGE=otel/opentelemetry-collector-contrib:0.108.0
FLAGD_IMAGE=ghcr.io/open-feature/flagd:v0.11.2
GRAFANA_IMAGE=grafana/grafana:11.2.0
JAEGERTRACING_IMAGE=jaegertracing/all-in-one:1.60
# must also update version field in ./src/grafana/provisioning/datasources/opensearch.yaml
OPENSEARCH_IMAGE=opensearchproject/opensearch:2.16.0
OPENSEARCH_IMAGE_VERSION=2.17.1
OPENSEARCH_IMAGE=opensearchproject/opensearch:${OPENSEARCH_IMAGE_VERSION}
POSTGRES_IMAGE=postgres:16.4
PROMETHEUS_IMAGE=quay.io/prometheus/prometheus:v2.54.1
VALKEY_IMAGE=valkey/valkey:8.0-alpine
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
uses: actions/checkout@v4
- name: run tracetesting
run: |
make build && make run-tracetesting
make build && docker system prune -f && make run-tracetesting
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ the release.
([#1709](https://github.com/open-telemetry/opentelemetry-demo/pull/1709))
* [chore] Add depends on to otelcol to wait on healthy opensearch
([#1724](https://github.com/open-telemetry/opentelemetry-demo/pull/1724))
* [flagd-ui] Add UI for managing Flagd feature flags
([#1725](https://github.com/open-telemetry/opentelemetry-demo/pull/1725))
* [accountingservice] bump OpenTelemetry .NET Automatic Instrumentation
to 1.8.0 together with other dependencies
([#1727](https://github.com/open-telemetry/opentelemetry-demo/pull/1727))
Expand All @@ -23,8 +25,12 @@ the release.
* [frontend] fix imageSlowLoad headers not applied
to 1.8.0 together with other dependencies
([#1733](https://github.com/open-telemetry/opentelemetry-demo/pull/1733))
* [flagd-ui] Add UI for managing Flagd feature flags
([#1725](https://github.com/open-telemetry/opentelemetry-demo/pull/1725))
* [chore] Move opensearch image version to .env file
([#1743](https://github.com/open-telemetry/opentelemetry-demo/pull/1743))
* [cartservice] Propagate cartservice exceptions
([#1744](https://github.com/open-telemetry/opentelemetry-demo/pull/1744))
* [cartservice] Update cart service to fail when cartServiceFailure is enabled
([#1748](https://github.com/open-telemetry/opentelemetry-demo/pull/1748))

## 1.11.1

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ services:
memory: 100M
restart: unless-stopped
environment:
- "GF_INSTALL_PLUGINS=grafana-opensearch-datasource"
- "GF_INSTALL_PLUGINS=grafana-opensearch-datasource ${OPENSEARCH_IMAGE_VERSION}"
volumes:
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
Expand Down Expand Up @@ -658,7 +658,7 @@ services:
ports:
- "9200"
healthcheck:
test: curl -s http://localhost:9200/_cluster/health | grep '"status":"green"'
test: curl -s http://localhost:9200/_cluster/health | grep -E '"status":"(green|yellow)"'
start_period: 10s
interval: 5s
timeout: 10s
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ services:
memory: 100M
restart: unless-stopped
environment:
- "GF_INSTALL_PLUGINS=grafana-opensearch-datasource"
- "GF_INSTALL_PLUGINS=grafana-opensearch-datasource ${OPENSEARCH_IMAGE_VERSION}"
volumes:
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
Expand Down Expand Up @@ -800,7 +800,7 @@ services:
ports:
- "9200"
healthcheck:
test: curl -s http://localhost:9200/_cluster/health | grep '"status":"green"'
test: curl -s http://localhost:9200/_cluster/health | grep -E '"status":"(green|yellow)"'
start_period: 10s
interval: 5s
timeout: 10s
Expand Down
4 changes: 2 additions & 2 deletions src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

# https://mcr.microsoft.com/v2/dotnet/sdk/tags/list
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.302 AS builder
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.403 AS builder
ARG TARGETARCH

WORKDIR /usr/src/app/
Expand All @@ -30,7 +30,7 @@ RUN dotnet publish ./src/cartservice.csproj -v d -r linux-musl-$TARGETARCH --no-
# -----------------------------------------------------------------------------

# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.6-alpine3.20
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.10-alpine3.20

WORKDIR /usr/src/app/
COPY --from=builder /cartservice/ ./
Expand Down
20 changes: 10 additions & 10 deletions src/cartservice/src/cartservice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.63.0" />
<PackageReference Include="Grpc.AspNetCore.HealthChecks" Version="2.63.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.66.0" />
<PackageReference Include="Grpc.AspNetCore.HealthChecks" Version="2.66.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.6" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc9.15" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.7" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.9.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Resources.Container" Version="1.0.0-beta.8" />
<PackageReference Include="OpenTelemetry.Resources.Host" Version="0.1.0-beta.2" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
<PackageReference Include="OpenFeature.Contrib.Providers.Flagd" Version="0.1.9" />
<PackageReference Include="OpenFeature.Contrib.Hooks.Otel" Version="0.1.4" />
<PackageReference Include="OpenFeature" Version="1.5.1" />
<PackageReference Include="OpenTelemetry.Resources.Container" Version="1.0.0-beta.9" />
<PackageReference Include="OpenTelemetry.Resources.Host" Version="0.1.0-beta.3" />
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
<PackageReference Include="OpenFeature.Contrib.Providers.Flagd" Version="0.3.0" />
<PackageReference Include="OpenFeature.Contrib.Hooks.Otel" Version="0.2.0" />
<PackageReference Include="OpenFeature" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
40 changes: 29 additions & 11 deletions src/cartservice/src/services/CartService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ public override async Task<Empty> AddItem(AddItemRequest request, ServerCallCont
activity?.SetTag("app.product.id", request.Item.ProductId);
activity?.SetTag("app.product.quantity", request.Item.Quantity);

await _cartStore.AddItemAsync(request.UserId, request.Item.ProductId, request.Item.Quantity);
return Empty;
try
{
await _cartStore.AddItemAsync(request.UserId, request.Item.ProductId, request.Item.Quantity);

return Empty;
}
catch (RpcException ex)
{
activity?.RecordException(ex);
activity?.SetStatus(ActivityStatusCode.Error, ex.Message);
throw;
}
}

public override async Task<Cart> GetCart(GetCartRequest request, ServerCallContext context)
Expand All @@ -43,15 +53,24 @@ public override async Task<Cart> GetCart(GetCartRequest request, ServerCallConte
activity?.SetTag("app.user.id", request.UserId);
activity?.AddEvent(new("Fetch cart"));

var cart = await _cartStore.GetCartAsync(request.UserId);
var totalCart = 0;
foreach (var item in cart.Items)
try
{
totalCart += item.Quantity;
}
activity?.SetTag("app.cart.items.count", totalCart);
var cart = await _cartStore.GetCartAsync(request.UserId);
var totalCart = 0;
foreach (var item in cart.Items)
{
totalCart += item.Quantity;
}
activity?.SetTag("app.cart.items.count", totalCart);

return cart;
return cart;
}
catch (RpcException ex)
{
activity?.RecordException(ex);
activity?.SetStatus(ActivityStatusCode.Error, ex.Message);
throw;
}
}

public override async Task<Empty> EmptyCart(EmptyCartRequest request, ServerCallContext context)
Expand All @@ -62,8 +81,7 @@ public override async Task<Empty> EmptyCart(EmptyCartRequest request, ServerCall

try
{
// Throw 1/10 of the time to simulate a failure when the feature flag is enabled
if (await _featureFlagHelper.GetBooleanValue("cartServiceFailure", false) && random.Next(10) == 0)
if (await _featureFlagHelper.GetBooleanValueAsync("cartServiceFailure", false))
{
await _badCartStore.EmptyCartAsync(request.UserId);
}
Expand Down
1 change: 0 additions & 1 deletion src/grafana/provisioning/datasources/opensearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ datasources:
logMessageField: body
pplEnabled: true
timeField: observedTimestamp
version: 2.16.0

0 comments on commit 00a1695

Please sign in to comment.