Skip to content

Commit

Permalink
merged changes to 1.9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPSplunk committed Apr 17, 2024
2 parents 91366b3 + 4185d2d commit 90b85c0
Show file tree
Hide file tree
Showing 38 changed files with 1,017 additions and 764 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Demo App version
IMAGE_NAME=ghcr.io/alexpsplunk/astroshop
IMAGE_VERSION=1.8.0-edu-o11y
DEMO_VERSION=1.8.1-edu-o11y
IMAGE_VERSION=1.9.0
DEMO_VERSION=1.9.0-edu-o11y

# Dependent images
COLLECTOR_CONTRIB_IMAGE=otel/opentelemetry-collector-contrib:0.96.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/assign-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

jobs:
assign-reviewers:
if: github.repository == 'open-telemetry/opentelemetry-demo'
runs-on: ubuntu-latest
steps:
- uses: dyladan/component-owners@main
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:

jobs:
build_and_push_images:
if: github.repository == 'open-telemetry/opentelemetry-demo'
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: gradle/wrapper-validation-action@v2.1.1
- uses: gradle/wrapper-validation-action@v2.1.2
59 changes: 59 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
# adds a label to a pull request if certain files are changed
name: Label Pull Requests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check for changed files
id: file_changes
uses: dorny/paths-filter@v2
with:
list-files: shell
filters: |
docsUpdateRequired:
- 'src/flagd/**'
helmUpdateRequired:
- '.env'
- 'docker-compose*.yml'
- 'src/flagd/**'
- 'src/grafana/**'
- 'src/otelcollector/**'
- 'src/prometheus/**'
- name: "Add Label: docs-update-required"
if: steps.file_changes.outputs.docsUpdateRequired == 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.issue.number;
github.issues.addLabels({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['docs-update-required']
})
- name: "Add Label: helm-update-required"
if: steps.file_changes.outputs.helmUpdateRequired == 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.issue.number;
github.issues.addLabels({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['helm-update-required']
})
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
build_and_push_images:
uses: ./.github/workflows/build-images.yml
if: github.repository == 'open-telemetry/opentelemetry-demo'
with:
push: true
version: ${{ github.event.release.tag_name }}
Expand Down
20 changes: 16 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ the release.

## Unreleased

* [loadgenerator] emit logs via OTLP
([#1446](https://github.com/open-telemetry/opentelemetry-demo/pull/1446))
* [frontend] reset quantity when new product selected
([#1447](https://github.com/open-telemetry/opentelemetry-demo/pull/1447))
## 1.9.0

* [featureflag] deprecate in favor of flagd
([#1338](https://github.com/open-telemetry/opentelemetry-demo/pull/1388))
* [checkoutservice] add producer interceptor for tracing
Expand All @@ -31,8 +29,14 @@ the release.
([#1415](https://github.com/open-telemetry/opentelemetry-demo/pull/1415))
* [chore] - add tests and odd profiles to make stop
([#1427](https://github.com/open-telemetry/opentelemetry-demo/pull/1427))
* [shippingservice] fix context propagation
([#1433](https://github.com/open-telemetry/opentelemetry-demo/pull/1433))
* [chore] - Update Telemetry Components
([#1440](https://github.com/open-telemetry/opentelemetry-demo/pull/1440))
* [loadgenerator] emit logs via OTLP
([#1446](https://github.com/open-telemetry/opentelemetry-demo/pull/1446))
* [frontend] reset quantity when new product selected
([#1447](https://github.com/open-telemetry/opentelemetry-demo/pull/1447))
* [paymentservice] add paymentServiceFailure feature flag
([#1449](https://github.com/open-telemetry/opentelemetry-demo/pull/1449))
* [checkoutservice] add paymentServiceUnreachable feature flag
Expand All @@ -41,6 +45,14 @@ the release.
([#1448](https://github.com/open-telemetry/opentelemetry-demo/pull/1448))
* [cartservice] update .NET to .NET 8.0.3
([#1460](https://github.com/open-telemetry/opentelemetry-demo/pull/1460))
* [adservice] add adServiceManualGC feature flag
([#1463](https://github.com/open-telemetry/opentelemetry-demo/pull/1463))
* [frontendproxy] remove deprecated start_child_span option
([#1469](https://github.com/open-telemetry/opentelemetry-demo/pull/1469))
* [currency] fix metric name
([#1470](https://github.com/open-telemetry/opentelemetry-demo/pull/1470))
* [frontend] disable instrumentation-fs library
([#1473](https://github.com/open-telemetry/opentelemetry-demo/pull/1473))

## 1.8.0

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ Monday at 8:30 AM PST and anyone is welcome.
([@open-telemetry/demo-maintainers](https://github.com/orgs/open-telemetry/teams/demo-maintainers)):

- [Austin Parker](https://github.com/austinlparker), Honeycomb
- [Carter Socha](https://github.com/cartersocha), Lightstep
- [Juliano Costa](https://github.com/julianocosta89), Datadog
- [Mikko Viitanen](https://github.com/mviitane), Dynatrace
- [Pierre Tessier](https://github.com/puckpuck), Honeycomb

[Approvers](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
([@open-telemetry/demo-approvers](https://github.com/orgs/open-telemetry/teams/demo-approvers)):

- [Cedric Ziel](https://github.com/cedricziel) Grafana Labs
- [Mikko Viitanen](https://github.com/mviitane), Dynatrace
- [Penghan Wang](https://github.com/wph95), AppDynamics
- [Reiley Yang](https://github.com/reyang), Microsoft
- [Ziqi Zhao](https://github.com/fatsheep9146), Alibaba

Emeritus:

- [Carter Socha](https://github.com/cartersocha)
- [Michael Maxwell](https://github.com/mic-max)
- [Morgan McLean](https://github.com/mtwo)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ services:
environment:
- SHIPPING_SERVICE_PORT
- QUOTE_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}/v1/traces
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ services:
environment:
- SHIPPING_SERVICE_PORT
- QUOTE_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}/v1/traces
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
depends_on:
Expand Down
1 change: 0 additions & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ gen_proto_dotnet cartservice
gen_proto_go checkoutservice
# gen_proto_cpp currencyservice
# gen_proto_ruby emailservice
gen_proto_elixir featureflagservice
gen_proto_ts frontend
gen_proto_js paymentservice
gen_proto_go productcatalogservice
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/opentelemetry-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ data:
"type": "prometheus",
"uid": "webstore-metrics"
},
"description": "Sent by Exporter\notelcol_exporter_send_failed_spans",
"description": "Sent by Exporter\notelcol_exporter_send_failed_metric_points",
"fieldConfig": {
"defaults": {
"color": {
Expand Down
4 changes: 2 additions & 2 deletions src/accountingservice/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
google.golang.org/grpc v1.62.0
google.golang.org/grpc v1.62.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf v1.32.0
google.golang.org/protobuf v1.33.0
)

require (
Expand Down
8 changes: 4 additions & 4 deletions src/accountingservice/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe h1:
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk=
google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
24 changes: 20 additions & 4 deletions src/adservice/src/main/java/oteldemo/AdService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import oteldemo.Demo.Ad;
import oteldemo.Demo.AdRequest;
import oteldemo.Demo.AdResponse;
import oteldemo.problempattern.GarbageCollectionTrigger;
import dev.openfeature.contrib.providers.flagd.FlagdOptions;
import dev.openfeature.contrib.providers.flagd.FlagdProvider;
import dev.openfeature.sdk.Client;
Expand Down Expand Up @@ -127,6 +128,9 @@ private enum AdResponseType {

private static class AdServiceImpl extends oteldemo.AdServiceGrpc.AdServiceImplBase {

private static final String ADSERVICE_FAILURE = "adServiceFailure";
private static final String ADSERVICE_MANUAL_GC_FEATURE_FLAG = "adServiceManualGc";

private AdServiceImpl() {}

/**
Expand Down Expand Up @@ -177,8 +181,14 @@ public void getAds(AdRequest req, StreamObserver<AdResponse> responseObserver) {
Attributes.of(
adRequestTypeKey, adRequestType.name(), adResponseTypeKey, adResponseType.name()));

if (checkAdFailure()) {
throw new StatusRuntimeException(Status.RESOURCE_EXHAUSTED);
if (getFeatureFlagEnabled(ADSERVICE_FAILURE)) {
throw new StatusRuntimeException(Status.UNAVAILABLE);
}

if (getFeatureFlagEnabled(ADSERVICE_MANUAL_GC_FEATURE_FLAG)) {
logger.warn("Feature Flag " + ADSERVICE_MANUAL_GC_FEATURE_FLAG + " enabled, performing a manual gc now");
GarbageCollectionTrigger gct = new GarbageCollectionTrigger();
gct.doExecute();
}

AdResponse reply = AdResponse.newBuilder().addAllAds(allAds).build();
Expand All @@ -193,12 +203,18 @@ public void getAds(AdRequest req, StreamObserver<AdResponse> responseObserver) {
}
}

boolean checkAdFailure() {
/**
* Retrieves the status of a feature flag from the Feature Flag service.
*
* @param ff The name of the feature flag to retrieve.
* @return {@code true} if the feature flag is enabled, {@code false} otherwise or in case of errors.
*/
boolean getFeatureFlagEnabled(String ff) {
Client client = OpenFeatureAPI.getInstance().getClient();
// TODO: Plumb the actual session ID from the frontend via baggage?
UUID uuid = UUID.randomUUID();
client.setEvaluationContext(new MutableContext().add("session", uuid.toString()));
Boolean boolValue = client.getBooleanValue("adServiceFailure", false);
Boolean boolValue = client.getBooleanValue(ff, false);
return boolValue;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package oteldemo.problempattern;

import java.lang.management.ManagementFactory;
import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* The GarbageCollectionTrigger class is responsible for triggering manual garbage collection
* at specified intervals to simulate memory pressure and measure the impact on performance.
*/
public class GarbageCollectionTrigger {
private static final Logger logger = LogManager.getLogger(GarbageCollectionTrigger.class.getName());

private final long gc_delay;
private final int finalize_delay;
private final int maxObjects;

private long lastGC = 0;

private final MemoryUtils memUtils;

/**
* Constructs a new GarbageCollectionTrigger with default values.
*/
public GarbageCollectionTrigger() {
memUtils = new MemoryUtils(ManagementFactory.getMemoryMXBean());
gc_delay = TimeUnit.SECONDS.toMillis(10);
finalize_delay = 500;
maxObjects = 500000;
}

/**
* Triggers manual garbage collection at specified intervals and measures the impact on performance.
* It creates Entry objects to fill up memory and initiates garbage collection.
*/
public void doExecute() {
if (System.currentTimeMillis() - lastGC > gc_delay) {
logger.info("Triggering a manual garbage collection, next one in " + (gc_delay/1000) + " seconds.");
// clear old data, we want to clear old Entry objects, because their finalization is expensive
System.gc();

long total = 0;
for (int i = 0; i < 10; i++) {
while (memUtils.getHeapUsage() < 0.9 && memUtils.getObjectPendingFinalizationCount() < maxObjects) {
new Entry();
}
long start = System.currentTimeMillis();
System.gc();
total += System.currentTimeMillis() - start;
}
logger.info("The artificially triggered GCs took: " + total + " ms");
lastGC = System.currentTimeMillis();
}

}

/**
* The Entry class represents objects created for the purpose of triggering garbage collection.
*/
private class Entry {
/**
* Overrides the finalize method to introduce a delay, simulating finalization during garbage collection.
*
* @throws Throwable If an exception occurs during finalization.
*/
@SuppressWarnings("removal")
@Override
protected void finalize() throws Throwable {
TimeUnit.MILLISECONDS.sleep(finalize_delay);
super.finalize();
}
}
}
Loading

0 comments on commit 90b85c0

Please sign in to comment.