├── .dockerignore ├── .env ├── .env.arm64 ├── .env.override ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── component_owners.yml ├── correlation.png ├── dependabot.yml ├── logs.png ├── service-map.png ├── trace.png └── workflows │ ├── assign-reviewers.yml │ ├── build-images-elastic.yml │ ├── build-images.yml │ ├── checks.yml │ ├── component-build-images.yml │ ├── component_build-images-elastic.yml │ ├── dependabot-auto-update-protobuf-diff.yml │ ├── fossa.yml │ ├── gradle-wrapper-validation.yml │ ├── label-pr.yml │ ├── merge-upstream.yaml │ ├── nightly-release.yml │ ├── ossf-scorecard.yml │ ├── release-elastic.yml │ ├── release.yml │ ├── run-integration-tests.yml │ └── stale.yml ├── .gitignore ├── .licenserc.json ├── .linkspector.yml ├── .markdownlint.yaml ├── .yamlignore ├── .yamllint ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── buildkitd.toml ├── docker-compose-tests.yml ├── docker-compose-tests_include-override.yml ├── docker-compose.minimal.yml ├── docker-compose.yml ├── docker-gen-proto.sh ├── ide-gen-proto.sh ├── internal └── tools │ ├── go.mod │ ├── go.sum │ ├── sanitycheck.py │ └── tools.go ├── kubernetes ├── elastic-helm │ ├── demo.yml │ └── elastic-architecture.png └── opentelemetry-demo.yaml ├── package-lock.json ├── package.json ├── pb └── demo.proto ├── src ├── accounting │ ├── Accounting.csproj │ ├── Accounting.sln │ ├── Consumer.cs │ ├── Dockerfile │ ├── Helpers.cs │ ├── Log.cs │ ├── Program.cs │ └── README.md ├── ad │ ├── .java-version │ ├── Dockerfile │ ├── Dockerfile.elastic │ ├── README.md │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── java │ │ └── oteldemo │ │ │ ├── AdService.java │ │ │ └── problempattern │ │ │ ├── CPULoad.java │ │ │ ├── GarbageCollectionTrigger.java │ │ │ └── MemoryUtils.java │ │ └── resources │ │ └── log4j2.xml ├── cart │ ├── NuGet.config │ ├── README.md │ ├── cart.sln │ ├── src │ │ ├── .dockerignore │ │ ├── Directory.Build.props │ │ ├── Dockerfile │ │ ├── Program.cs │ │ ├── appsettings.json │ │ ├── cart.csproj │ │ ├── cartstore │ │ │ ├── ICartStore.cs │ │ │ └── ValkeyCartStore.cs │ │ └── services │ │ │ └── CartService.cs │ └── tests │ │ ├── CartServiceTests.cs │ │ └── cart.tests.csproj ├── checkout │ ├── Dockerfile │ ├── README.md │ ├── genproto │ │ ├── Dockerfile │ │ └── oteldemo │ │ │ ├── demo.pb.go │ │ │ └── demo_grpc.pb.go │ ├── go.mod │ ├── go.sum │ ├── kafka │ │ └── producer.go │ ├── main.go │ ├── money │ │ ├── money.go │ │ └── money_test.go │ └── tools.go ├── currency │ ├── .dockerignore │ ├── CMakeLists.txt │ ├── Dockerfile │ ├── README.md │ ├── build │ │ └── generated │ │ │ └── proto │ │ │ ├── demo.grpc.pb.cc │ │ │ ├── demo.grpc.pb.h │ │ │ ├── demo.pb.cc │ │ │ ├── demo.pb.h │ │ │ ├── demo_mock.grpc.pb.h │ │ │ └── grpc │ │ │ └── health │ │ │ └── v1 │ │ │ ├── health.grpc.pb.cc │ │ │ ├── health.grpc.pb.h │ │ │ ├── health.pb.cc │ │ │ ├── health.pb.h │ │ │ └── health_mock.grpc.pb.h │ ├── data │ │ └── currency_conversion.json │ ├── genproto │ │ ├── CMakeLists.txt │ │ └── Dockerfile │ ├── proto │ │ └── grpc │ │ │ └── health │ │ │ └── v1 │ │ │ └── health.proto │ └── src │ │ ├── logger_common.h │ │ ├── meter_common.h │ │ ├── server.cpp │ │ └── tracer_common.h ├── email │ ├── .dockerignore │ ├── .ruby-version │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── README.md │ ├── email_server.rb │ └── views │ │ └── confirmation.erb ├── flagd-ui │ ├── .dockerignore │ ├── .eslintrc.json │ ├── .gitignore │ ├── .prettierrc │ ├── Dockerfile │ ├── README.md │ ├── next.config.mjs │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── src │ │ ├── app │ │ │ ├── advanced │ │ │ │ └── page.tsx │ │ │ ├── api │ │ │ │ ├── read-file │ │ │ │ │ └── route.ts │ │ │ │ └── write-to-file │ │ │ │ │ └── route.ts │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ ├── components │ │ │ ├── Layout.tsx │ │ │ ├── advanced │ │ │ │ ├── AdvancedView.tsx │ │ │ │ └── FileEditor.tsx │ │ │ ├── basic │ │ │ │ ├── BasicView.tsx │ │ │ │ ├── DefaultVariantSelect.tsx │ │ │ │ └── FeatureFlag.tsx │ │ │ ├── nav │ │ │ │ └── NavBar.tsx │ │ │ └── utils │ │ │ │ └── Spinner.tsx │ │ ├── instrumentation.ts │ │ └── utils │ │ │ └── types.ts │ ├── tailwind.config.ts │ └── tsconfig.json ├── flagd │ └── demo.flagd.json ├── fraud-detection │ ├── .dockerignore │ ├── Dockerfile │ ├── Dockerfile.elastic │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ └── src │ │ └── main │ │ ├── kotlin │ │ └── frauddetection │ │ │ └── main.kt │ │ └── resources │ │ └── log4j2.xml ├── frontend-proxy │ ├── Dockerfile │ ├── README.md │ └── envoy.tmpl.yaml ├── frontend │ ├── .dockerignore │ ├── .eslintrc │ ├── .prettierignore │ ├── .prettierrc │ ├── Dockerfile │ ├── Dockerfile.cypress │ ├── README.md │ ├── components │ │ ├── Ad │ │ │ ├── Ad.styled.ts │ │ │ ├── Ad.tsx │ │ │ └── index.ts │ │ ├── Banner │ │ │ ├── Banner.styled.ts │ │ │ ├── Banner.tsx │ │ │ └── index.ts │ │ ├── Button │ │ │ ├── Button.tsx │ │ │ └── index.ts │ │ ├── Cart │ │ │ ├── CartDetail.tsx │ │ │ └── EmptyCart.tsx │ │ ├── CartDropdown │ │ │ ├── CartDropdown.styled.ts │ │ │ ├── CartDropdown.tsx │ │ │ └── index.ts │ │ ├── CartIcon │ │ │ ├── CartIcon.styled.ts │ │ │ ├── CartIcon.tsx │ │ │ └── index.ts │ │ ├── CartItems │ │ │ ├── CartItem.tsx │ │ │ ├── CartItems.styled.ts │ │ │ ├── CartItems.tsx │ │ │ └── index.ts │ │ ├── CheckoutForm │ │ │ ├── CheckoutForm.styled.ts │ │ │ ├── CheckoutForm.tsx │ │ │ └── index.ts │ │ ├── CheckoutItem │ │ │ ├── CheckoutItem.styled.ts │ │ │ ├── CheckoutItem.tsx │ │ │ └── index.ts │ │ ├── CurrencySwitcher │ │ │ ├── CurrencySwitcher.styled.ts │ │ │ ├── CurrencySwitcher.tsx │ │ │ └── index.ts │ │ ├── Footer │ │ │ ├── Footer.styled.ts │ │ │ ├── Footer.tsx │ │ │ └── index.ts │ │ ├── Header │ │ │ ├── Header.styled.ts │ │ │ ├── Header.tsx │ │ │ └── index.ts │ │ ├── Input │ │ │ ├── Input.styled.ts │ │ │ ├── Input.tsx │ │ │ └── index.ts │ │ ├── Layout │ │ │ ├── Layout.tsx │ │ │ └── index.ts │ │ ├── PlatformFlag │ │ │ ├── PlatformFlag.styled.ts │ │ │ ├── PlatformFlag.tsx │ │ │ └── index.ts │ │ ├── ProductCard │ │ │ ├── ProductCard.styled.ts │ │ │ ├── ProductCard.tsx │ │ │ └── index.ts │ │ ├── ProductList │ │ │ ├── ProductList.styled.ts │ │ │ ├── ProductList.tsx │ │ │ └── index.ts │ │ ├── ProductPrice │ │ │ ├── ProductPrice.tsx │ │ │ └── index.ts │ │ ├── Recommendations │ │ │ ├── Recommendations.styled.ts │ │ │ ├── Recommendations.tsx │ │ │ └── index.ts │ │ └── Select │ │ │ ├── Select.styled.ts │ │ │ ├── Select.tsx │ │ │ └── index.ts │ ├── cypress.config.ts │ ├── cypress │ │ └── e2e │ │ │ ├── Checkout.cy.ts │ │ │ ├── Home.cy.ts │ │ │ └── ProductDetail.cy.ts │ ├── gateways │ │ ├── Api.gateway.ts │ │ ├── Session.gateway.ts │ │ └── rpc │ │ │ ├── Ad.gateway.ts │ │ │ ├── Cart.gateway.ts │ │ │ ├── Checkout.gateway.ts │ │ │ ├── Currency.gateway.ts │ │ │ ├── ProductCatalog.gateway.ts │ │ │ ├── Recommendations.gateway.ts │ │ │ └── Shipping.gateway.ts │ ├── genproto │ │ └── Dockerfile │ ├── next.config.js │ ├── package-lock.json │ ├── package.json │ ├── pages │ │ ├── _app.tsx │ │ ├── _document.tsx │ │ ├── api │ │ │ ├── cart.ts │ │ │ ├── checkout.ts │ │ │ ├── currency.ts │ │ │ ├── data.ts │ │ │ ├── products │ │ │ │ ├── [productId] │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ │ ├── recommendations.ts │ │ │ └── shipping.ts │ │ ├── cart │ │ │ ├── checkout │ │ │ │ └── [orderId] │ │ │ │ │ └── index.tsx │ │ │ └── index.tsx │ │ ├── index.tsx │ │ └── product │ │ │ └── [productId] │ │ │ └── index.tsx │ ├── protos │ │ └── demo.ts │ ├── providers │ │ ├── Ad.provider.tsx │ │ ├── Cart.provider.tsx │ │ └── Currency.provider.tsx │ ├── public │ │ ├── favicon.ico │ │ └── icons │ │ │ ├── Cart.svg │ │ │ ├── CartIcon.svg │ │ │ ├── Check.svg │ │ │ └── Chevron.svg │ ├── services │ │ └── ProductCatalog.service.ts │ ├── styles │ │ ├── Cart.styled.ts │ │ ├── Checkout.styled.ts │ │ ├── Home.styled.ts │ │ ├── ProductDetail.styled.ts │ │ ├── Theme.ts │ │ ├── globals.css │ │ └── style.d.ts │ ├── tsconfig.json │ ├── types │ │ └── Cart.ts │ └── utils │ │ ├── Cypress.ts │ │ ├── Request.ts │ │ ├── enums │ │ └── AttributeNames.ts │ │ ├── imageLoader.js │ │ └── telemetry │ │ ├── FrontendTracer.ts │ │ ├── Instrumentation.js │ │ ├── InstrumentationMiddleware.ts │ │ └── SessionIdProcessor.ts ├── grafana │ ├── grafana.ini │ └── provisioning │ │ ├── dashboards │ │ ├── demo.yaml │ │ └── demo │ │ │ ├── demo-dashboard.json │ │ │ ├── exemplars-dashboard.json │ │ │ ├── opentelemetry-collector.json │ │ │ └── spanmetrics-dashboard.json │ │ └── datasources │ │ ├── default.yaml │ │ ├── jaeger.yaml │ │ └── opensearch.yaml ├── image-provider │ ├── Dockerfile │ ├── nginx.conf.template │ └── static │ │ ├── Banner.png │ │ ├── opentelemetry-demo-logo.png │ │ └── products │ │ ├── EclipsmartTravelRefractorTelescope.jpg │ │ ├── LensCleaningKit.jpg │ │ ├── NationalParkFoundationExplorascope.jpg │ │ ├── OpticalTubeAssembly.jpg │ │ ├── RedFlashlight.jpg │ │ ├── RoofBinoculars.jpg │ │ ├── SolarFilter.jpg │ │ ├── SolarSystemColorImager.jpg │ │ ├── StarsenseExplorer.jpg │ │ └── TheCometBook.jpg ├── kafka │ ├── Dockerfile │ ├── Dockerfile.elastic │ └── README.md ├── load-generator │ ├── Dockerfile │ ├── README.md │ ├── locustfile.py │ ├── people.json │ └── requirements.txt ├── otel-collector │ ├── otelcol-config-extras.yml │ ├── otelcol-config.yml │ ├── otelcol-elastic-config.yaml │ └── otelcol-elastic-otlp-config.yaml ├── payment │ ├── .dockerignore │ ├── Dockerfile │ ├── README.md │ ├── charge.js │ ├── index.js │ ├── logger.js │ ├── package-lock.json │ └── package.json ├── product-catalog │ ├── Dockerfile │ ├── README.md │ ├── genproto │ │ ├── Dockerfile │ │ └── oteldemo │ │ │ ├── demo.pb.go │ │ │ └── demo_grpc.pb.go │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── products │ │ └── products.json │ └── tools.go ├── prometheus │ └── prometheus-config.yaml ├── quote │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ │ ├── dependencies.php │ │ ├── routes.php │ │ └── settings.php │ ├── composer.json │ ├── public │ │ └── index.php │ └── src │ │ └── Application │ │ └── Settings │ │ ├── Settings.php │ │ └── SettingsInterface.php ├── react-native-app │ ├── .dockerignore │ ├── .env │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierignore │ ├── .ruby-version │ ├── Gemfile │ ├── Gemfile.lock │ ├── README.md │ ├── android.Dockerfile │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ ├── debug.keystore │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── ic_launcher-playstore.png │ │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── opentelemetry │ │ │ │ │ └── reactnativeapp │ │ │ │ │ ├── MainActivity.kt │ │ │ │ │ └── MainApplication.kt │ │ │ │ └── res │ │ │ │ ├── drawable-hdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-mdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── rn_edit_text_material.xml │ │ │ │ └── splashscreen.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values-night │ │ │ │ └── colors.xml │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── app.json │ ├── app │ │ ├── (tabs) │ │ │ ├── _layout.tsx │ │ │ ├── cart.tsx │ │ │ └── index.tsx │ │ └── _layout.tsx │ ├── assets │ │ ├── fonts │ │ │ └── SpaceMono-Regular.ttf │ │ └── images │ │ │ ├── adaptive-icon.png │ │ │ ├── favicon.png │ │ │ ├── icon.png │ │ │ └── splash.png │ ├── babel.config.js │ ├── components │ │ ├── CheckoutForm │ │ │ ├── CheckoutForm.tsx │ │ │ └── index.ts │ │ ├── EmptyCart │ │ │ ├── EmptyCart.tsx │ │ │ └── index.ts │ │ ├── Field.tsx │ │ ├── ProductCard │ │ │ ├── ProductCard.tsx │ │ │ └── index.ts │ │ ├── ProductList │ │ │ ├── ProductList.tsx │ │ │ └── index.ts │ │ ├── ThemedScrollView.tsx │ │ ├── ThemedText.tsx │ │ ├── ThemedView.tsx │ │ └── navigation │ │ │ └── TabBarIcon.tsx │ ├── constants │ │ └── Colors.ts │ ├── gateways │ │ ├── Api.gateway.ts │ │ └── Session.gateway.ts │ ├── hooks │ │ ├── useColorScheme.ts │ │ ├── useColorScheme.web.ts │ │ ├── useThemeColor.ts │ │ └── useTracer.ts │ ├── ios │ │ ├── .gitignore │ │ ├── .xcode.env │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Podfile.properties.json │ │ ├── reactnativeapp.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── reactnativeapp.xcscheme │ │ ├── reactnativeapp.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── reactnativeapp │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.mm │ │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── App-Icon-1024x1024@1x.png │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── SplashScreen.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── image.png │ │ │ └── SplashScreenBackground.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── image.png │ │ │ ├── Info.plist │ │ │ ├── PrivacyInfo.xcprivacy │ │ │ ├── SplashScreen.storyboard │ │ │ ├── Supporting │ │ │ └── Expo.plist │ │ │ ├── main.m │ │ │ ├── noop-file.swift │ │ │ ├── reactnativeapp-Bridging-Header.h │ │ │ └── reactnativeapp.entitlements │ ├── metro.config.js │ ├── package-lock.json │ ├── package.json │ ├── protos │ │ └── demo.ts │ ├── providers │ │ └── Cart.provider.tsx │ ├── tsconfig.json │ ├── types │ │ └── Cart.ts │ └── utils │ │ ├── Localhost.ts │ │ ├── Request.ts │ │ └── SessionIdProcessor.ts ├── recommendation │ ├── Dockerfile │ ├── README.md │ ├── demo_pb2.py │ ├── demo_pb2_grpc.py │ ├── genproto │ │ └── Dockerfile │ ├── logger.py │ ├── metrics.py │ ├── recommendation_server.py │ └── requirements.txt └── shipping │ ├── .dockerignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── Dockerfile │ ├── README.md │ ├── build.rs │ └── src │ ├── main.rs │ ├── shipping_service.rs │ ├── shipping_service │ ├── quote.rs │ └── tracking.rs │ ├── telemetry.rs │ └── telemetry │ ├── logs_conf.rs │ ├── resources_conf.rs │ └── traces_conf.rs └── test ├── README.md └── tracetesting ├── Dockerfile ├── ad ├── all.yaml └── get.yaml ├── cart ├── add-item-to-cart.yaml ├── all.yaml ├── check-if-cart-is-empty.yaml ├── check-if-cart-is-populated.yaml └── empty-cart.yaml ├── checkout ├── all.yaml └── place-order.yaml ├── cli-config.yml ├── currency ├── all.yaml ├── convert.yaml └── supported.yaml ├── email ├── all.yaml └── confirmation.yaml ├── frontend ├── 01-see-ads.yaml ├── 02-get-product-recommendation.yaml ├── 03-browse-product.yaml ├── 04-add-product-to-cart.yaml ├── 05-view-cart.yaml ├── 06-checking-out-cart.yaml └── all.yaml ├── otelcol-config-tracetest.yml ├── payment ├── all.yaml ├── amex-credit-card-not-allowed.yaml ├── expired-credit-card.yaml ├── invalid-credit-card.yaml └── valid-credit-card.yaml ├── product-catalog ├── all.yaml ├── get.yaml ├── list.yaml └── search.yaml ├── recommendation ├── all.yaml └── list.yaml ├── run.bash ├── shipping ├── all.yaml ├── empty-quote.yaml ├── order.yaml └── quote.yaml ├── tracetest-config.yaml └── tracetest-provision.yaml /.dockerignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | .github 4 | docs 5 | internal 6 | src/*/README.md 7 | src/*/Dockerfile 8 | src/*/*/Dockerfile 9 | 10 | ################################### 11 | # currency 12 | ./src/currency/client.js 13 | ./src/currency/node_modules/ 14 | ################################### 15 | 16 | ################################### 17 | # frontend 18 | ./src/frontend/node_modules/ 19 | 20 | ################################### 21 | # shipping 22 | ./src/shipping/target 23 | ################################### 24 | 25 | -------------------------------------------------------------------------------- /.env.arm64: -------------------------------------------------------------------------------- 1 | _JAVA_OPTIONS=-XX:UseSVE=0 2 | -------------------------------------------------------------------------------- /.env.override: -------------------------------------------------------------------------------- 1 | # DO NOT PUSH CHANGES OF THIS FILE TO opentelemetry/opentelemetry-demo 2 | # PLACE YOUR .env ENVIRONMENT VARIABLES OVERRIDES IN THIS FILE 3 | 4 | # Demo Elastic App version 5 | IMAGE_VERSION=2.0.4 6 | IMAGE_NAME=ghcr.io/elastic/opentelemetry-demo 7 | 8 | # ********************* 9 | # Elastic Demo Services 10 | # ********************* 11 | AD_SERVICE_DOCKERFILE=./src/ad/Dockerfile.elastic 12 | FRAUD_SERVICE_DOCKERFILE=./src/fraud-detection/Dockerfile.elastic 13 | KAFKA_SERVICE_DOCKERFILE=./src/kafka/Dockerfile.elastic 14 | 15 | # ********************* 16 | # Elastic Collector 17 | # ********************* 18 | COLLECTOR_CONTRIB_IMAGE=docker.elastic.co/elastic-agent/elastic-agent:8.17.4 19 | OTEL_COLLECTOR_CONFIG=./src/otel-collector/otelcol-elastic-config.yaml 20 | ELASTIC_AGENT_OTEL=true 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | 3 | * text=auto 4 | 5 | gradlew text eol=lf 6 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | 4 | # For anything not explicitly taken by someone else: 5 | * @open-telemetry/demo-approvers 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve 4 | labels: bug 5 | --- 6 | 7 | # Bug Report 8 | 9 | Which version of the demo you are using? (please provide either a specific 10 | [commit 11 | hash](https://github.com/open-telemetry/opentelemetry-demo/commits/main) 12 | or a specific 13 | [release](https://github.com/open-telemetry/opentelemetry-demo/releases)). 14 | 15 | ## Symptom 16 | 17 | A clear and concise description of what the bug is. 18 | 19 | **What is the expected behavior?** 20 | 21 | What do you expect to see? 22 | 23 | **What is the actual behavior?** 24 | 25 | Please describe the actual behavior experienced. 26 | 27 | ## Reproduce 28 | 29 | Could you provide the minimum required steps to resolve the issue you're seeing? 30 | 31 | We will close this issue if: 32 | 33 | * The steps you provided are complex. 34 | * If we can not reproduce the behavior you're reporting. 35 | 36 | ## Additional Context 37 | 38 | Please feel free to add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project 4 | labels: enhancement 5 | --- 6 | 7 | # Feature Request 8 | 9 | Before opening a feature request against this repo, consider whether the feature 10 | should/could be implemented in the [other OpenTelemetry client 11 | libraries](https://github.com/open-telemetry/). If so, please [open an issue on 12 | opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) 13 | first. 14 | 15 | **Is your feature request related to a problem?** 16 | 17 | If so, provide a concise description of the problem. 18 | 19 | **Describe the solution you'd like:** 20 | 21 | What would you like to happen instead? What is the expected behavior? 22 | 23 | **Describe alternatives you've considered.** 24 | 25 | Which alternative solutions or features have you considered? 26 | 27 | ## Additional Context 28 | 29 | Feel free to add any other context about the feature request here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Create a question to help us improve our knowledge base and documentation 4 | labels: question 5 | --- 6 | 7 | # Question 8 | 9 | Use [Github Discussions](https://github.com/open-telemetry/opentelemetry-demo/discussions/). 10 | -------------------------------------------------------------------------------- /.github/component_owners.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | # this file is used by .github/workflows/assign-reviewers.yml 4 | components: 5 | src/ad: 6 | - jack-berg 7 | - mateuszrzeszutek 8 | - trask 9 | -------------------------------------------------------------------------------- /.github/correlation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/.github/correlation.png -------------------------------------------------------------------------------- /.github/logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/.github/logs.png -------------------------------------------------------------------------------- /.github/service-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/.github/service-map.png -------------------------------------------------------------------------------- /.github/trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/.github/trace.png -------------------------------------------------------------------------------- /.github/workflows/assign-reviewers.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | # assigns reviewers to pull requests in a similar way as CODEOWNERS, but doesn't require reviewers 4 | # to have write access to the repository 5 | # see .github/component_owners.yaml for the list of components and their owners 6 | name: Assign reviewers 7 | 8 | on: 9 | # pull_request_target is needed instead of just pull_request 10 | # because repository write permission is needed to assign reviewers 11 | pull_request_target: 12 | 13 | jobs: 14 | assign-reviewers: 15 | if: github.repository == 'open-telemetry/opentelemetry-demo' 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: dyladan/component-owners@main 19 | with: 20 | # using this action to request review only (not assignment) 21 | assign-owners: false 22 | -------------------------------------------------------------------------------- /.github/workflows/build-images-elastic.yml: -------------------------------------------------------------------------------- 1 | name: Test image generation 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build_images: 11 | if: github.repository == 'elastic/opentelemetry-demo' 12 | uses: ./.github/workflows/component_build-images-elastic.yml 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/build-images.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | name: Test image generation 4 | 5 | on: 6 | push: 7 | paths: 8 | - 'src/**' 9 | - 'test/**' 10 | 11 | jobs: 12 | build_images: 13 | if: github.repository == 'open-telemetry/opentelemetry-demo' 14 | uses: ./.github/workflows/component-build-images.yml 15 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-auto-update-protobuf-diff.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | on: 5 | pull_request: 6 | branches: [ main ] 7 | 8 | permissions: 9 | actions: write 10 | pull-requests: write 11 | contents: write 12 | packages: write 13 | 14 | jobs: 15 | dependabot-auto-update-protobuf-diff: 16 | runs-on: ubuntu-latest 17 | # Only run this job if the PR is opened by dependabot and the last commit is from dependabot 18 | if: github.event.pull_request.user.login == 'dependabot[bot]' 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v4 22 | with: 23 | ref: ${{ github.head_ref }} 24 | token: ${{ secrets.DEPENDABOT_TOKEN }} 25 | - name: Generate 26 | run: make clean docker-generate-protobuf 27 | - name: Commit only if there are changes 28 | run: | 29 | if ! git diff --quiet; then 30 | git config user.name "dependabot[bot]" 31 | git config user.email "49699333+dependabot[bot]@users.noreply.github.com" 32 | git add . 33 | git commit -s -m "chore: update protobuf" 34 | git push 35 | fi 36 | -------------------------------------------------------------------------------- /.github/workflows/fossa.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | name: FOSSA scanning 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | fossa: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 19 | 20 | - uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 21 | with: 22 | api-key: ${{secrets.FOSSA_API_KEY}} 23 | team: OpenTelemetry 24 | -------------------------------------------------------------------------------- /.github/workflows/gradle-wrapper-validation.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | name: Gradle wrapper validation 4 | on: 5 | pull_request: 6 | paths: 7 | - '**/gradle/wrapper/**' 8 | push: 9 | paths: 10 | - '**/gradle/wrapper/**' 11 | 12 | jobs: 13 | validation: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - uses: gradle/actions/wrapper-validation@v4.3.0 19 | -------------------------------------------------------------------------------- /.github/workflows/nightly-release.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | name: Nightly Release 4 | 5 | on: 6 | schedule: 7 | # Runs at 00:00 UTC every day 8 | - cron: '0 0 * * *' 9 | 10 | jobs: 11 | build_and_push_images: 12 | uses: ./.github/workflows/component-build-images.yml 13 | if: github.repository == 'open-telemetry/opentelemetry-demo' 14 | with: 15 | push: true 16 | version: nightly-${{ github.run_id }} 17 | secrets: inherit 18 | -------------------------------------------------------------------------------- /.github/workflows/release-elastic.yml: -------------------------------------------------------------------------------- 1 | name: "Build and Publish" 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | build_and_push_images: 9 | uses: ./.github/workflows/component_build-images-elastic.yml 10 | if: github.repository == 'elastic/opentelemetry-demo' 11 | with: 12 | push: true 13 | version: ${{ github.event.release.tag_name }} 14 | secrets: inherit 15 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | name: "Build and Publish" 4 | 5 | on: 6 | release: 7 | types: [published] 8 | 9 | jobs: 10 | build_and_push_images: 11 | uses: ./.github/workflows/component-build-images.yml 12 | if: github.repository == 'open-telemetry/opentelemetry-demo' 13 | with: 14 | push: true 15 | version: ${{ github.event.release.tag_name }} 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/run-integration-tests.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | name: Integration Tests 4 | 5 | on: 6 | pull_request_review: 7 | types: 8 | - submitted 9 | 10 | jobs: 11 | run_tests: 12 | runs-on: ubuntu-latest 13 | name: "Run CI" 14 | if: github.event.review.state == 'APPROVED' 15 | steps: 16 | - name: check out code 17 | uses: actions/checkout@v4 18 | - name: run tracetesting 19 | run: | 20 | make build && docker system prune -f && make run-tracetesting 21 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | # Syntax: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions 4 | # Github Actions Stale: https://github.com/actions/stale 5 | 6 | name: "Close stale pull requests" 7 | on: 8 | schedule: 9 | - cron: "12 3 * * *" # arbitrary time not to DDOS GitHub 10 | 11 | jobs: 12 | stale: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/stale@v9 16 | with: 17 | stale-pr-message: 'This PR was marked stale due to lack of activity. It will be closed in 7 days.' 18 | close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.' 19 | operations-per-run: 400 20 | days-before-pr-stale: 7 21 | days-before-issue-stale: -1 22 | days-before-pr-close: 7 23 | days-before-issue-close: -1 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.iml 3 | *.ipr 4 | *.iws 5 | *.pyc 6 | .nb-gradle 7 | .nb-gradle-properties 8 | .swp 9 | .DS_Store 10 | \#*\# 11 | 12 | docker-compose.override.yml 13 | 14 | # Eclipse 15 | .classpath 16 | .project 17 | .settings 18 | 19 | bin/ 20 | obj/ 21 | .vs/ 22 | .vscode 23 | .gradle/ 24 | .idea/ 25 | build/ 26 | node_modules/ 27 | coverage 28 | .next/ 29 | out/ 30 | build 31 | next-env.d.ts 32 | vendor/ 33 | composer.lock 34 | .venv 35 | .dockerhub.env 36 | .ghcr.env 37 | 38 | src/frontend/cypress/videos 39 | src/frontend/cypress/screenshots 40 | src/shipping/target/ 41 | test/tracetesting/tracetesting-vars.yaml 42 | 43 | # Ignore copied/generated protobuf files 44 | /src/accounting/src/protos/ 45 | /src/cart/src/protos/ 46 | /src/fraud-detection/src/main/proto 47 | /src/payment/demo.proto 48 | /src/shipping/proto/ 49 | /src/currency/proto 50 | 51 | # Android 52 | *.apk 53 | 54 | !src/currency/build 55 | -------------------------------------------------------------------------------- /.linkspector.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | dirs: 5 | - . 6 | 7 | excludedFiles: 8 | - ./CHANGELOG.md 9 | 10 | ignorePatterns: 11 | - pattern: "^http://localhost:8080" 12 | - pattern: "^https://calendar.google.com/calendar" 13 | 14 | aliveStatusCodes: 15 | - 200 16 | - 429 17 | 18 | useGitIgnore: true 19 | 20 | modifiedFilesOnly: false 21 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # Default state for all rules 5 | default: true 6 | 7 | # allow long lines for tables and code blocks 8 | MD013: 9 | code_blocks: false 10 | tables: false 11 | -------------------------------------------------------------------------------- /.yamlignore: -------------------------------------------------------------------------------- 1 | kubernetes/opentelemetry-demo.yaml 2 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | extends: default 4 | 5 | ignore-from-file: [.gitignore, .yamlignore] 6 | 7 | rules: 8 | document-start: disable 9 | octal-values: enable 10 | truthy: 11 | allowed-values: ['true', 'false', 'on'] # 'on' for GH action trigger 12 | line-length: 13 | max: 200 14 | indentation: 15 | check-multi-line-strings: false 16 | indent-sequences: consistent 17 | brackets: 18 | max-spaces-inside: 1 19 | max-spaces-inside-empty: 0 20 | braces: 21 | max-spaces-inside: 1 22 | max-spaces-inside-empty: 0 23 | -------------------------------------------------------------------------------- /buildkitd.toml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | [worker.oci] 5 | max-parallelism = 4 6 | -------------------------------------------------------------------------------- /docker-compose-tests_include-override.yml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | services: 5 | 6 | otel-collector: 7 | command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-tracetest.yml" ] 8 | environment: 9 | - ENVOY_PORT 10 | - OTEL_COLLECTOR_HOST 11 | - OTEL_COLLECTOR_PORT_GRPC 12 | - OTEL_COLLECTOR_PORT_HTTP 13 | volumes: 14 | - ${DOCKER_SOCK}:/var/run/docker.sock:ro 15 | - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml 16 | - ./test/tracetesting/otelcol-config-tracetest.yml:/etc/otelcol-config-tracetest.yml 17 | depends_on: [] 18 | -------------------------------------------------------------------------------- /internal/tools/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-specification/internal/tools 2 | 3 | go 1.12 4 | 5 | require github.com/client9/misspell v0.3.4 6 | -------------------------------------------------------------------------------- /internal/tools/go.sum: -------------------------------------------------------------------------------- 1 | github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= 2 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 3 | -------------------------------------------------------------------------------- /internal/tools/tools.go: -------------------------------------------------------------------------------- 1 | // 2 | 3 | //go:build tools 4 | // +build tools 5 | 6 | package tools 7 | 8 | // This file follows the recommendation at 9 | // https://go.dev/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module 10 | // on how to pin tooling dependencies to a go.mod file. 11 | // This ensures that all systems use the same version of tools in addition to regular dependencies. 12 | 13 | import ( 14 | _ "github.com/client9/misspell/cmd/misspell" 15 | ) 16 | -------------------------------------------------------------------------------- /kubernetes/elastic-helm/demo.yml: -------------------------------------------------------------------------------- 1 | enabled: true 2 | default: 3 | image: 4 | repository: ghcr.io/elastic/opentelemetry-demo 5 | tag: 2.0.4 6 | envOverrides: 7 | - name: OTEL_COLLECTOR_NAME 8 | value: "opentelemetry-kube-stack-daemon-collector.opentelemetry-operator-system.svc.cluster.local" 9 | 10 | components: 11 | load-generator: 12 | envOverrides: 13 | - name: LOCUST_BROWSER_TRAFFIC_ENABLED 14 | value: "false" 15 | flagd: 16 | sidecarContainers: 17 | - name: flagd-ui 18 | useDefault: 19 | env: true 20 | service: 21 | port: 4000 22 | env: 23 | - name: FLAGD_METRICS_EXPORTER 24 | value: otel 25 | - name: OTEL_EXPORTER_OTLP_ENDPOINT 26 | value: http://$(OTEL_COLLECTOR_NAME):4318 27 | resources: 28 | limits: 29 | memory: 150Mi 30 | volumeMounts: 31 | - name: config-rw 32 | mountPath: /app/data 33 | 34 | opentelemetry-collector: 35 | enabled: false 36 | 37 | opensearch: 38 | enabled: false 39 | 40 | grafana: 41 | enabled: false 42 | 43 | jaeger: 44 | enabled: false 45 | 46 | prometheus: 47 | enabled: false 48 | -------------------------------------------------------------------------------- /kubernetes/elastic-helm/elastic-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/kubernetes/elastic-helm/elastic-architecture.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "markdown-toc": "^1.2.0", 4 | "markdownlint-cli": "0.37.0", 5 | "@kt3k/license-checker": "^3.2.2", 6 | "@umbrelladocs/linkspector": "^0.3.13" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/accounting/Accounting.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34701.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounting", "Accounting.csproj", "{C66C35E2-DF04-4DCF-8F6A-87B6D6433FF6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C66C35E2-DF04-4DCF-8F6A-87B6D6433FF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C66C35E2-DF04-4DCF-8F6A-87B6D6433FF6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C66C35E2-DF04-4DCF-8F6A-87B6D6433FF6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C66C35E2-DF04-4DCF-8F6A-87B6D6433FF6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {6340CDDC-E917-4532-A056-5526E0A7BDDA} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/accounting/Helpers.cs: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections; 5 | 6 | namespace Accounting 7 | { 8 | internal static class Helpers 9 | { 10 | private static List RelevantPrefixes = ["DOTNET_", "CORECLR_", "OTEL_", "KAFKA_"]; 11 | 12 | public static IEnumerable FilterRelevant(this IDictionary envs) 13 | { 14 | foreach (DictionaryEntry env in envs) 15 | { 16 | foreach (var prefix in RelevantPrefixes) 17 | { 18 | if (env.Key.ToString()?.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase) ?? false) 19 | { 20 | yield return env; 21 | } 22 | } 23 | } 24 | } 25 | 26 | public static void OutputInOrder(this IEnumerable envs) 27 | { 28 | foreach (var env in envs.OrderBy(x => x.Key)) 29 | { 30 | Console.WriteLine(env); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/accounting/Log.cs: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Microsoft.Extensions.Logging; 5 | using Oteldemo; 6 | 7 | namespace Accounting 8 | { 9 | internal static partial class Log 10 | { 11 | [LoggerMessage( 12 | Level = LogLevel.Information, 13 | Message = "Order details: {@OrderResult}.")] 14 | public static partial void OrderReceivedMessage(ILogger logger, OrderResult orderResult); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/accounting/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Accounting; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Microsoft.Extensions.Hosting; 7 | 8 | Console.WriteLine("Accounting service started"); 9 | 10 | Environment.GetEnvironmentVariables() 11 | .FilterRelevant() 12 | .OutputInOrder(); 13 | 14 | var host = Host.CreateDefaultBuilder(args) 15 | .ConfigureServices(services => 16 | { 17 | services.AddSingleton(); 18 | }) 19 | .Build(); 20 | 21 | var consumer = host.Services.GetRequiredService(); 22 | consumer.StartListening(); 23 | 24 | host.Run(); 25 | -------------------------------------------------------------------------------- /src/accounting/README.md: -------------------------------------------------------------------------------- 1 | # Accounting Service 2 | 3 | This service consumes new orders from a Kafka topic. 4 | 5 | ## Local Build 6 | 7 | To build the service binary, run: 8 | 9 | ```sh 10 | cp pb/demo.proto src/accouting/proto/demo.proto # root context 11 | dotnet build # accounting service context 12 | ``` 13 | 14 | ## Docker Build 15 | 16 | From the root directory, run: 17 | 18 | ```sh 19 | docker compose build accounting 20 | ``` 21 | 22 | ## Bump dependencies 23 | 24 | To bump all dependencies run in Package manager: 25 | 26 | ```sh 27 | Update-Package -ProjectName Accounting 28 | ``` 29 | -------------------------------------------------------------------------------- /src/ad/.java-version: -------------------------------------------------------------------------------- 1 | 21.0 2 | -------------------------------------------------------------------------------- /src/ad/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | FROM --platform=${BUILDPLATFORM} eclipse-temurin:21-jdk AS builder 6 | ARG _JAVA_OPTIONS 7 | WORKDIR /usr/src/app/ 8 | 9 | COPY ./src/ad/gradlew* ./src/ad/settings.gradle* ./src/ad/build.gradle ./ 10 | COPY ./src/ad/gradle ./gradle 11 | 12 | RUN chmod +x ./gradlew 13 | RUN ./gradlew 14 | RUN ./gradlew downloadRepos 15 | 16 | COPY ./src/ad/ ./ 17 | COPY ./pb/ ./proto 18 | RUN chmod +x ./gradlew 19 | RUN ./gradlew installDist -PprotoSourceDir=./proto 20 | 21 | # ----------------------------------------------------------------------------- 22 | 23 | FROM eclipse-temurin:21-jre 24 | 25 | ARG OTEL_JAVA_AGENT_VERSION 26 | ARG _JAVA_OPTIONS 27 | 28 | WORKDIR /usr/src/app/ 29 | 30 | COPY --from=builder /usr/src/app/ ./ 31 | ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar 32 | ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar 33 | 34 | EXPOSE ${AD_PORT} 35 | ENTRYPOINT [ "./build/install/opentelemetry-demo-ad/bin/Ad" ] 36 | -------------------------------------------------------------------------------- /src/ad/Dockerfile.elastic: -------------------------------------------------------------------------------- 1 | FROM --platform=${BUILDPLATFORM} eclipse-temurin:21-jdk AS builder 2 | ARG _JAVA_OPTIONS 3 | WORKDIR /usr/src/app/ 4 | 5 | COPY ./src/ad/gradlew* ./src/ad/settings.gradle* ./src/ad/build.gradle ./ 6 | COPY ./src/ad/gradle ./gradle 7 | 8 | RUN chmod +x ./gradlew 9 | RUN ./gradlew 10 | RUN ./gradlew downloadRepos 11 | 12 | COPY ./src/ad/ ./ 13 | COPY ./pb/ ./proto 14 | RUN chmod +x ./gradlew 15 | RUN ./gradlew installDist -PprotoSourceDir=./proto 16 | 17 | # ----------------------------------------------------------------------------- 18 | 19 | FROM eclipse-temurin:21-jre 20 | 21 | # ARG version=0.4.0 22 | ARG _JAVA_OPTIONS 23 | 24 | WORKDIR /usr/src/app/ 25 | 26 | COPY --from=builder /usr/src/app/ ./ 27 | ADD --chmod=644 https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=co.elastic.otel&a=elastic-otel-javaagent&v=LATEST /usr/src/app/opentelemetry-javaagent.jar 28 | ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar 29 | ENV OTEL_INFERRED_SPANS_ENABLED=true 30 | ENV ELASTIC_OTEL_SPAN_STACK_TRACE_MIN_DURATION=2 31 | 32 | EXPOSE ${AD_PORT} 33 | ENTRYPOINT [ "./build/install/opentelemetry-demo-ad/bin/Ad" ] 34 | -------------------------------------------------------------------------------- /src/ad/README.md: -------------------------------------------------------------------------------- 1 | # Ad Service 2 | 3 | The Ad service provides advertisement based on context keys. If no context keys 4 | are provided then it returns random ads. 5 | 6 | ## Building Locally 7 | 8 | The Ad service requires at least JDK 17 to build and uses gradlew to 9 | compile/install/distribute. Gradle wrapper is already part of the source code. 10 | To build Ad Service, run: 11 | 12 | ```sh 13 | ./gradlew installDist 14 | ``` 15 | 16 | It will create an executable script 17 | `src/ad/build/install/oteldemo/bin/Ad`. 18 | 19 | To run the Ad Service: 20 | 21 | ```sh 22 | export AD_PORT=8080 23 | export FEATURE_FLAG_GRPC_SERVICE_ADDR=featureflagservice:50053 24 | ./build/install/opentelemetry-demo-ad/bin/Ad 25 | ``` 26 | 27 | ### Upgrading Gradle 28 | 29 | If you need to upgrade the version of gradle then run 30 | 31 | ```sh 32 | ./gradlew wrapper --gradle-version 33 | ``` 34 | 35 | ## Building Docker 36 | 37 | From the root of `opentelemetry-demo`, run: 38 | 39 | ```sh 40 | docker build --file ./src/ad/Dockerfile ./ 41 | ``` 42 | -------------------------------------------------------------------------------- /src/ad/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/opentelemetry-demo/d46d75c8f4f1af2592233a654f1e973bc7d57252/src/ad/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/ad/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/ad/settings.gradle: -------------------------------------------------------------------------------- 1 | 2 | rootProject.name = 'opentelemetry-demo-ad' 3 | -------------------------------------------------------------------------------- /src/ad/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/cart/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/cart/README.md: -------------------------------------------------------------------------------- 1 | # Cart Service 2 | 3 | This service stores user shopping carts in Valkey. 4 | 5 | ## Local Build 6 | 7 | Run `dotnet restore` and `dotnet build`. 8 | 9 | ## Docker Build 10 | 11 | From the root directory of this repository, run: 12 | 13 | ```sh 14 | docker compose build cart 15 | ``` 16 | -------------------------------------------------------------------------------- /src/cart/src/.dockerignore: -------------------------------------------------------------------------------- 1 | **/*.sh 2 | **/*.bat 3 | **/bin/ 4 | **/obj/ 5 | **/out/ 6 | Dockerfile* -------------------------------------------------------------------------------- /src/cart/src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/cart/src/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "Kestrel": { 11 | "EndpointDefaults": { 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/cart/src/cartstore/ICartStore.cs: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | using System.Threading.Tasks; 4 | 5 | namespace cart.cartstore; 6 | 7 | public interface ICartStore 8 | { 9 | void Initialize(); 10 | 11 | Task AddItemAsync(string userId, string productId, int quantity); 12 | Task EmptyCartAsync(string userId); 13 | 14 | Task GetCartAsync(string userId); 15 | 16 | bool Ping(); 17 | } 18 | -------------------------------------------------------------------------------- /src/cart/tests/cart.tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/checkout/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | FROM golang:1.22-alpine AS builder 6 | 7 | WORKDIR /usr/src/app/ 8 | 9 | RUN --mount=type=cache,target=/go/pkg/mod/ \ 10 | --mount=type=bind,source=./src/checkout/go.sum,target=go.sum \ 11 | --mount=type=bind,source=./src/checkout/go.mod,target=go.mod \ 12 | go mod download 13 | 14 | RUN --mount=type=cache,target=/go/pkg/mod/ \ 15 | --mount=type=cache,target=/root/.cache/go-build \ 16 | --mount=type=bind,rw,source=./src/checkout,target=. \ 17 | go build -ldflags "-s -w" -o /go/bin/checkout/ ./ 18 | 19 | FROM alpine 20 | 21 | WORKDIR /usr/src/app/ 22 | 23 | COPY --from=builder /go/bin/checkout/ ./ 24 | 25 | EXPOSE ${CHECKOUT_PORT} 26 | ENTRYPOINT [ "./checkout" ] 27 | -------------------------------------------------------------------------------- /src/checkout/README.md: -------------------------------------------------------------------------------- 1 | # Checkout Service 2 | 3 | This service provides checkout services for the application. 4 | 5 | ## Local Build 6 | 7 | To build the service binary, run: 8 | 9 | ```sh 10 | go build -o /go/bin/checkout/ 11 | ``` 12 | 13 | ## Docker Build 14 | 15 | From the root directory, run: 16 | 17 | ```sh 18 | docker compose build checkout 19 | ``` 20 | 21 | ## Regenerate protos 22 | 23 | To build the protos, run from the root directory: 24 | 25 | ```sh 26 | make docker-generate-protobuf 27 | ``` 28 | 29 | ## Bump dependencies 30 | 31 | To bump all dependencies run: 32 | 33 | ```sh 34 | go get -u -t ./... 35 | go mod tidy 36 | ``` 37 | -------------------------------------------------------------------------------- /src/checkout/genproto/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | FROM golang:1.22-alpine 5 | 6 | WORKDIR /build 7 | 8 | RUN apk add --no-cache protobuf-dev 9 | 10 | COPY ./src/checkout/go.mod ./ 11 | COPY ./src/checkout/go.sum ./ 12 | COPY ./src/checkout/tools.go ./ 13 | 14 | RUN go env -w GOMODCACHE=/root/.cache/go-build 15 | RUN --mount=type=cache,target=/root/.cache/go-build \ 16 | go list -e -f '{{range .Imports}}{{.}} {{end}}' tools.go | CGO_ENABLED=0 xargs go install -mod=readonly 17 | -------------------------------------------------------------------------------- /src/checkout/tools.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //go:build tools 5 | // +build tools 6 | 7 | package tools 8 | 9 | // This file follows the recommendation at 10 | // https://go.dev/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module 11 | // on how to pin tooling dependencies to a go.mod file. 12 | // This ensures that all systems use the same version of tools in addition to regular dependencies. 13 | 14 | import ( 15 | _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" 16 | _ "google.golang.org/protobuf/cmd/protoc-gen-go" 17 | ) 18 | -------------------------------------------------------------------------------- /src/currency/.dockerignore: -------------------------------------------------------------------------------- 1 | client.js 2 | node_modules/ 3 | out/ 4 | -------------------------------------------------------------------------------- /src/currency/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | project(currency) 3 | 4 | find_package(Protobuf REQUIRED) 5 | find_package(gRPC CONFIG REQUIRED) 6 | find_package(opentelemetry-cpp CONFIG REQUIRED) 7 | 8 | set(GENERATED_PROTOBUF_PATH "${CMAKE_BINARY_DIR}/generated/proto") 9 | 10 | add_subdirectory(genproto) 11 | 12 | include_directories("${GENERATED_PROTOBUF_PATH}" "${OPENTELEMETRY_CPP_INCLUDE_DIRS}") 13 | 14 | add_executable(currency src/server.cpp) 15 | add_dependencies(currency demo-proto) 16 | target_link_libraries( 17 | currency demo-proto protobuf::libprotobuf 18 | ${OPENTELEMETRY_CPP_LIBRARIES} opentelemetry_trace opentelemetry_common 19 | opentelemetry_exporter_otlp_grpc opentelemetry_exporter_otlp_grpc_client 20 | opentelemetry_proto opentelemetry_otlp_recordable opentelemetry_resources 21 | opentelemetry_metrics opentelemetry_exporter_otlp_grpc_metrics gRPC::grpc++) 22 | 23 | install(TARGETS currency DESTINATION bin) 24 | -------------------------------------------------------------------------------- /src/currency/README.md: -------------------------------------------------------------------------------- 1 | # Currency Service 2 | 3 | The Currency Service does the conversion from one currency to another. 4 | It is a C++ based service. 5 | 6 | ## Building docker image 7 | 8 | To build the currency service, run the following from root directory 9 | of opentelemetry-demo 10 | 11 | ```sh 12 | docker-compose build currency 13 | ``` 14 | 15 | ## Run the service 16 | 17 | Execute the below command to run the service. 18 | 19 | ```sh 20 | docker-compose up currency 21 | ``` 22 | 23 | ## Run the client 24 | 25 | currencyclient is a sample client which sends some request to currency 26 | service. To run the client, execute the below command. 27 | 28 | ```sh 29 | docker exec -it currencyclient 7000 30 | ``` 31 | 32 | '7000' is port where currency listens to. 33 | -------------------------------------------------------------------------------- /src/currency/data/currency_conversion.json: -------------------------------------------------------------------------------- 1 | { 2 | "EUR": "1.0", 3 | "USD": "1.1305", 4 | "JPY": "126.40", 5 | "BGN": "1.9558", 6 | "CZK": "25.592", 7 | "DKK": "7.4609", 8 | "GBP": "0.85970", 9 | "HUF": "315.51", 10 | "PLN": "4.2996", 11 | "RON": "4.7463", 12 | "SEK": "10.5375", 13 | "CHF": "1.1360", 14 | "ISK": "136.80", 15 | "NOK": "9.8040", 16 | "HRK": "7.4210", 17 | "RUB": "74.4208", 18 | "TRY": "6.1247", 19 | "AUD": "1.6072", 20 | "BRL": "4.2682", 21 | "CAD": "1.5128", 22 | "CNY": "7.5857", 23 | "HKD": "8.8743", 24 | "IDR": "15999.40", 25 | "ILS": "4.0875", 26 | "INR": "79.4320", 27 | "KRW": "1275.05", 28 | "MXN": "21.7999", 29 | "MYR": "4.6289", 30 | "NZD": "1.6679", 31 | "PHP": "59.083", 32 | "SGD": "1.5349", 33 | "THB": "36.012", 34 | "ZAR": "16.0583" 35 | } -------------------------------------------------------------------------------- /src/currency/genproto/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | # Copyright 2023 The OpenTelemetry Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | FROM alpine:3.18 AS builder 18 | 19 | RUN apk update && apk add git cmake make g++ grpc-dev protobuf-dev linux-headers 20 | 21 | COPY ./src/currency /currency 22 | COPY ./pb/demo.proto /currency/proto/demo.proto 23 | 24 | RUN cd /currency \ 25 | && mkdir -p build && cd build \ 26 | && cmake ../genproto \ 27 | && make -j$(nproc || sysctl -n hw.ncpu || echo 1) demo-proto 28 | -------------------------------------------------------------------------------- /src/email/.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /src/email/.ruby-version: -------------------------------------------------------------------------------- 1 | 3.2.2 2 | -------------------------------------------------------------------------------- /src/email/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | FROM ruby:3.2.2-slim AS base 6 | 7 | FROM base AS builder 8 | 9 | WORKDIR /tmp 10 | 11 | COPY ./src/email/Gemfile ./src/email/Gemfile.lock ./ 12 | 13 | #RUN apk update && apk add make gcc musl-dev gcompat && bundle install 14 | RUN apt-get update && apt-get install build-essential -y && bundle install 15 | FROM base AS release 16 | 17 | WORKDIR /email_server 18 | 19 | COPY ./src/email/ . 20 | 21 | RUN chmod 666 ./Gemfile.lock 22 | 23 | COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ 24 | 25 | 26 | EXPOSE ${EMAIL_PORT} 27 | ENTRYPOINT ["bundle", "exec", "ruby", "email_server.rb"] 28 | -------------------------------------------------------------------------------- /src/email/Gemfile: -------------------------------------------------------------------------------- 1 | 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "net-smtp", "~> 0.3" 6 | gem "pony", "~> 1.13" 7 | gem "puma", "~> 6.3" 8 | gem "sinatra", "~> 3.0" 9 | 10 | gem "opentelemetry-sdk", "~> 1.4.1" 11 | gem "opentelemetry-exporter-otlp", "~> 0.26.3" 12 | gem "opentelemetry-instrumentation-all", "~> 0.60.0" 13 | -------------------------------------------------------------------------------- /src/email/README.md: -------------------------------------------------------------------------------- 1 | # Email Service 2 | 3 | The Email service "sends" an email to the customer with their order details by 4 | rendering it as a log message. It expects a JSON payload like: 5 | 6 | ```json 7 | { 8 | "email": "some.address@website.com", 9 | "order": "" 10 | } 11 | ``` 12 | 13 | ## Local Build 14 | 15 | We use `bundler` to manage dependencies. To get started, simply `bundle install`. 16 | 17 | ## Running locally 18 | 19 | You may run this service locally with `bundle exec ruby email_server.rb`. 20 | 21 | ## Docker Build 22 | 23 | From `src/email`, run `docker build .` 24 | -------------------------------------------------------------------------------- /src/flagd-ui/.dockerignore: -------------------------------------------------------------------------------- 1 | # Dependency directories 2 | node_modules 3 | /.pnp 4 | .pnp.js 5 | 6 | # Next.js build output 7 | .next 8 | out 9 | 10 | # Testing 11 | /coverage 12 | 13 | # Production 14 | /build 15 | 16 | # Misc 17 | .DS_Store 18 | *.pem 19 | 20 | # Debug 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | # Local env files 26 | .env*.local 27 | 28 | # Vercel 29 | .vercel 30 | 31 | # TypeScript 32 | *.tsbuildinfo 33 | next-env.d.ts 34 | 35 | # IDE/Editor folders 36 | .idea 37 | .vscode 38 | 39 | # OS generated files 40 | Thumbs.db 41 | 42 | # Temporary files 43 | *.swp 44 | *.swo 45 | 46 | # Git related 47 | .git 48 | .gitignore 49 | 50 | # Docker related 51 | Dockerfile 52 | .dockerignore 53 | 54 | # Other 55 | README.md 56 | *.log 57 | -------------------------------------------------------------------------------- /src/flagd-ui/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /src/flagd-ui/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /src/flagd-ui/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-tailwindcss"] 3 | } 4 | -------------------------------------------------------------------------------- /src/flagd-ui/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | FROM node:22 AS builder 5 | 6 | WORKDIR /app 7 | 8 | COPY ./src/flagd-ui/package*.json ./ 9 | 10 | RUN npm ci 11 | 12 | COPY ./src/flagd-ui/. ./ 13 | 14 | RUN npm run build 15 | 16 | # ----------------------------------------------------------------------------- 17 | 18 | FROM node:22-alpine 19 | 20 | WORKDIR /app 21 | 22 | COPY ./src/flagd-ui/package*.json ./ 23 | 24 | RUN npm ci --only=production 25 | 26 | COPY --from=builder /app/src/instrumentation.ts ./instrumentation.ts 27 | COPY --from=builder /app/next.config.mjs ./next.config.mjs 28 | 29 | COPY --from=builder /app/.next ./.next 30 | 31 | EXPOSE 4000 32 | 33 | CMD ["npm", "start"] 34 | -------------------------------------------------------------------------------- /src/flagd-ui/README.md: -------------------------------------------------------------------------------- 1 | # Flagd-ui 2 | 3 | This application provides a user interface for configuring the feature 4 | flags of the flagd service. 5 | 6 | This is a [Next.js](https://nextjs.org/) project. 7 | 8 | ## Running the application 9 | 10 | The application can be run with the rest of the demo using the documented 11 | docker compose or make commands. 12 | 13 | ## Local development 14 | 15 | To run the app locally for development you must copy 16 | `src/flagd/demo.flagd.json` into `src/flagd-ui/data/demo.flagd.json` 17 | (create the directory and file if they do not exist yet). Make sure you're 18 | in the `src/flagd-ui` directory and run 19 | the following command: 20 | 21 | ```bash 22 | npm run dev 23 | ``` 24 | 25 | Then you must navigate to `localhost:4000/feature`. 26 | -------------------------------------------------------------------------------- /src/flagd-ui/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | basePath: "/feature", 4 | }; 5 | 6 | export default nextConfig; 7 | -------------------------------------------------------------------------------- /src/flagd-ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flagd-ui", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev -p 4000 -H 0.0.0.0", 7 | "build": "next build", 8 | "start": "next start -p 4000 -H 0.0.0.0", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@tailwindcss/postcss": "^4.0.14", 13 | "@vercel/otel": "^1.10.4", 14 | "ajv": "^8.17.1", 15 | "next": "15.2.2", 16 | "react": "^19", 17 | "react-dom": "^19" 18 | }, 19 | "devDependencies": { 20 | "@types/json5": "^2.2.0", 21 | "@types/node": "^22", 22 | "@types/react": "^19.0.10", 23 | "@types/react-dom": "^19.0.4", 24 | "autoprefixer": "^10.4.21", 25 | "eslint": "^9", 26 | "eslint-config-next": "15.2.1", 27 | "postcss": "^8.5.3", 28 | "prettier": "^3.5.3", 29 | "prettier-plugin-tailwindcss": "^0.6.11", 30 | "tailwindcss": "^4.0.12", 31 | "typescript": "^5" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/flagd-ui/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | "@tailwindcss/postcss": {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/advanced/page.tsx: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | import AdvancedView from "@/components/advanced/AdvancedView"; 4 | 5 | const Advanced = () => { 6 | return ; 7 | }; 8 | 9 | export default Advanced; 10 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/api/read-file/route.ts: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { NextResponse } from "next/server"; 4 | import fs from "fs"; 5 | import path from "path"; 6 | 7 | export async function GET(request: Request) { 8 | const { searchParams } = new URL(request.url); 9 | const file_name = searchParams.get("file_name") || "demo.flagd.json"; 10 | 11 | try { 12 | const filePath = path.join(process.cwd(), "data", file_name); 13 | const fileContents = fs.readFileSync(filePath, "utf8"); 14 | const data = JSON.parse(fileContents); 15 | return NextResponse.json(data); 16 | } catch (error) { 17 | console.error("Error reading file:", error); 18 | return NextResponse.json({ error: "Failed to read file" }, { status: 500 }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/api/write-to-file/route.ts: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { NextResponse } from "next/server"; 4 | import fs from "fs/promises"; 5 | import path from "path"; 6 | 7 | export async function POST(request: Request) { 8 | try { 9 | const { data } = await request.json(); 10 | const filePath = path.join(process.cwd(), "data", "demo.flagd.json"); 11 | 12 | await fs.writeFile(filePath, JSON.stringify(data, null, 2), "utf8"); 13 | 14 | return NextResponse.json( 15 | { message: "File written successfully" }, 16 | { status: 200 }, 17 | ); 18 | } catch (error) { 19 | console.error("Error writing to file:", error); 20 | return NextResponse.json( 21 | { message: "Error writing to file" }, 22 | { status: 500 }, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @tailwind base; 4 | @tailwind components; 5 | @tailwind utilities; 6 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { Layout } from "@/components/Layout"; 4 | import "./globals.css"; 5 | 6 | export const metadata = { 7 | title: "Flagd Configurator", 8 | description: 9 | "Built to provide an easier way to configure the Flagd configurations", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: { 15 | children: React.ReactNode; 16 | }) { 17 | return ( 18 | 19 | 20 | {children} 21 | 22 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /src/flagd-ui/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | "use client"; 4 | import React from "react"; 5 | import BasicView from "../components/basic/BasicView"; 6 | 7 | export default function Home() { 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/flagd-ui/src/components/Layout.tsx: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | "use client"; 4 | import React, { useState, createContext, useContext } from "react"; 5 | import NavBar from "./nav/NavBar"; 6 | import Spinner from "./utils/Spinner"; 7 | 8 | type LoadingContextType = { 9 | isLoading: boolean; 10 | setIsLoading: React.Dispatch>; 11 | }; 12 | 13 | const LoadingContext = createContext(undefined); 14 | 15 | export const useLoading = () => { 16 | const context = useContext(LoadingContext); 17 | if (context === undefined) { 18 | throw new Error("useLoading must be used within a LoadingProvider"); 19 | } 20 | return context; 21 | }; 22 | 23 | export const Layout: React.FC<{ children: React.ReactNode }> = ({ 24 | children, 25 | }) => { 26 | const [isLoading, setIsLoading] = useState(false); 27 | 28 | return ( 29 | 30 |
31 | 32 |
{children}
33 | {isLoading && } 34 |
35 |
36 | ); 37 | }; 38 | -------------------------------------------------------------------------------- /src/flagd-ui/src/components/advanced/FileEditor.tsx: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | "use client"; 4 | import React, { RefObject } from "react"; 5 | import { FlagConfig } from "@/utils/types"; 6 | 7 | type FileEditorProps = { 8 | flagConfig: FlagConfig; 9 | textAreaRef: RefObject; 10 | handleTextAreaChange: () => void; 11 | }; 12 | 13 | function FileEditor({ 14 | flagConfig, 15 | textAreaRef, 16 | handleTextAreaChange, 17 | }: FileEditorProps) { 18 | return ( 19 |