diff --git a/.gitignore b/.gitignore index 17858fd924..6bf28278f3 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ src/shippingservice/target/ /src/featureflagservice/src/ffs_demo_pb.erl /src/featureflagservice/src/ffs_service_*.erl /src/featureflagservice/src/oteldemo_*.erl +/src/frauddetectionservice/src/main/proto /src/frontend/pb/ /src/frontend/protos/ /src/paymentservice/demo.proto diff --git a/CHANGELOG.md b/CHANGELOG.md index 976f31ebcd..4305c7d21c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,12 @@ release. ([#983](https://github.com/open-telemetry/opentelemetry-demo/pull/983)) * [FeatureFlagService] Update dependencies ([#992](https://github.com/open-telemetry/opentelemetry-demo/pull/992)) +* [currencyService] Update OTel dependency + ([#991](https://github.com/open-telemetry/opentelemetry-demo/pull/991)) +* [LoadGenerator & RecommendatationService] update dependencies + ([#988](https://github.com/open-telemetry/opentelemetry-demo/pull/988)) +* [FraudDetectionService] Updated Kotlin version and OTel dependencies + ([#987](https://github.com/open-telemetry/opentelemetry-demo/pull/987)) ## 1.4.0 diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index cc9a04e4c9..4b143e9508 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -289,7 +289,8 @@ services: - LOCUST_HOST - LOCUST_HEADLESS - LOCUST_AUTOSTART - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT + - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=loadgenerator - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python diff --git a/docker-compose.yml b/docker-compose.yml index a5cfee0c9e..4c7468c3eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -379,7 +379,8 @@ services: - LOCUST_HOST - LOCUST_HEADLESS - LOCUST_AUTOSTART - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT + - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=loadgenerator - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python diff --git a/src/adservice/Dockerfile b/src/adservice/Dockerfile index 0916232f7a..108f130469 100644 --- a/src/adservice/Dockerfile +++ b/src/adservice/Dockerfile @@ -20,7 +20,7 @@ RUN ./gradlew installDist -PprotoSourceDir=./proto FROM eclipse-temurin:17-jre -ARG version=1.24.0 +ARG version=1.28.0 WORKDIR /usr/src/app/ COPY --from=builder /usr/src/app/ ./ diff --git a/src/adservice/build.gradle b/src/adservice/build.gradle index 8997ccdc8d..811efe79b3 100644 --- a/src/adservice/build.gradle +++ b/src/adservice/build.gradle @@ -1,9 +1,10 @@ plugins { - id 'com.google.protobuf' version '0.8.18' + id 'com.google.protobuf' version '0.9.4' id 'com.github.sherter.google-java-format' version '0.9' id 'idea' id 'application' + id 'com.github.ben-manes.versions' version '0.47.0' } repositories { @@ -15,10 +16,10 @@ description = 'Ad Service' group = "adservice" version = "0.1.0-SNAPSHOT" -def opentelemetryVersion = "1.19.0" -def opentelemetryInstrumentationAlphaVersion = "1.19.1-alpha" -def grpcVersion = "1.45.1" -def jacksonVersion = "2.13.2" +def opentelemetryVersion = "1.28.0" +def opentelemetryInstrumentationAlphaVersion = "1.28.0-alpha" +def grpcVersion = "1.56.1" +def jacksonVersion = "2.15.2" def protocVersion = "3.20.0" tasks.withType(JavaCompile) { @@ -38,7 +39,7 @@ dependencies { implementation platform("io.opentelemetry:opentelemetry-bom:${opentelemetryVersion}") implementation platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${opentelemetryInstrumentationAlphaVersion}") - implementation "com.google.api.grpc:proto-google-common-protos:2.8.0", + implementation "com.google.api.grpc:proto-google-common-protos:2.22.0", "javax.annotation:javax.annotation-api:1.3.2", "io.grpc:grpc-protobuf:${grpcVersion}", "io.grpc:grpc-stub:${grpcVersion}", @@ -47,11 +48,11 @@ dependencies { "io.opentelemetry:opentelemetry-api", "io.opentelemetry:opentelemetry-sdk", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations", - "org.apache.logging.log4j:log4j-core:2.17.2" + "org.apache.logging.log4j:log4j-core:2.20.0" runtimeOnly "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}", "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}", - "io.netty:netty-tcnative-boringssl-static:2.0.51.Final" + "io.netty:netty-tcnative-boringssl-static:2.0.61.Final" } } diff --git a/src/adservice/gradle/wrapper/gradle-wrapper.properties b/src/adservice/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..165b5020b0 100644 --- a/src/adservice/gradle/wrapper/gradle-wrapper.properties +++ b/src/adservice/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Jul 19 11:27:42 EDT 2023 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/src/adservice/src/main/java/oteldemo/AdService.java b/src/adservice/src/main/java/oteldemo/AdService.java index 549c84ffa6..b12cd58346 100644 --- a/src/adservice/src/main/java/oteldemo/AdService.java +++ b/src/adservice/src/main/java/oteldemo/AdService.java @@ -1,17 +1,12 @@ /* -* Copyright The OpenTelemetry Authors -* SPDX-License-Identifier: Apache-2.0 -*/ + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ package oteldemo; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.Iterables; -import oteldemo.Demo.Ad; -import oteldemo.Demo.AdRequest; -import oteldemo.Demo.AdResponse; -import oteldemo.Demo.GetFlagResponse; -import oteldemo.FeatureFlagServiceGrpc.FeatureFlagServiceBlockingStub; import io.grpc.*; import io.grpc.health.v1.HealthCheckResponse.ServingStatus; import io.grpc.protobuf.services.*; @@ -36,6 +31,11 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import oteldemo.Demo.Ad; +import oteldemo.Demo.AdRequest; +import oteldemo.Demo.AdResponse; +import oteldemo.Demo.GetFlagResponse; +import oteldemo.FeatureFlagServiceGrpc.FeatureFlagServiceBlockingStub; public final class AdService { @@ -73,12 +73,12 @@ private void start() throws IOException { healthMgr = new HealthStatusManager(); String featureFlagServiceAddr = - Optional.ofNullable(System.getenv("FEATURE_FLAG_GRPC_SERVICE_ADDR")) - .orElse(""); + Optional.ofNullable(System.getenv("FEATURE_FLAG_GRPC_SERVICE_ADDR")).orElse(""); FeatureFlagServiceBlockingStub featureFlagServiceStub = null; if (!featureFlagServiceAddr.isEmpty()) { - featureFlagServiceStub = oteldemo.FeatureFlagServiceGrpc.newBlockingStub( - ManagedChannelBuilder.forTarget(featureFlagServiceAddr).usePlaintext().build()); + featureFlagServiceStub = + oteldemo.FeatureFlagServiceGrpc.newBlockingStub( + ManagedChannelBuilder.forTarget(featureFlagServiceAddr).usePlaintext().build()); } server = diff --git a/src/cartservice/src/Dockerfile b/src/cartservice/src/Dockerfile index ef6343095d..74a49eb151 100644 --- a/src/cartservice/src/Dockerfile +++ b/src/cartservice/src/Dockerfile @@ -15,7 +15,7 @@ # limitations under the License. # https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM mcr.microsoft.com/dotnet/sdk:7.0.306 AS builder +FROM mcr.microsoft.com/dotnet/sdk:6.0.402 AS builder WORKDIR /usr/src/app/ @@ -35,7 +35,7 @@ RUN \ # ----------------------------------------------------------------------------- # https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list -FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.7-alpine3.17 +FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.9-alpine3.16 WORKDIR /usr/src/app/ COPY --from=builder /cartservice/ ./ diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index df873499dd..a9c0b5aeb1 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -1,7 +1,7 @@ - net7.0 + net6.0 false false diff --git a/src/cartservice/tests/cartservice.tests.csproj b/src/cartservice/tests/cartservice.tests.csproj index 7cc3a6f3e3..d3eba2607a 100644 --- a/src/cartservice/tests/cartservice.tests.csproj +++ b/src/cartservice/tests/cartservice.tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net6.0 diff --git a/src/currencyservice/Dockerfile b/src/currencyservice/Dockerfile index 68efe19c24..bb5b998221 100644 --- a/src/currencyservice/Dockerfile +++ b/src/currencyservice/Dockerfile @@ -14,12 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine as builder +FROM alpine RUN apk update RUN apk add git cmake make g++ grpc-dev re2-dev protobuf-dev c-ares-dev -ARG OPENTELEMETRY_CPP_VERSION=1.9.0 +ARG OPENTELEMETRY_CPP_VERSION=1.10.0 RUN git clone https://github.com/open-telemetry/opentelemetry-cpp \ && cd opentelemetry-cpp/ \ @@ -28,7 +28,7 @@ RUN git clone https://github.com/open-telemetry/opentelemetry-cpp \ && cd build \ && cmake .. -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \ - -DWITH_EXAMPLES=OFF -DWITH_OTLP=ON -DWITH_OTLP_GRPC=ON \ + -DWITH_EXAMPLES=OFF -DWITH_OTLP_GRPC=ON \ && make -j$(nproc || sysctl -n hw.ncpu || echo 1) install && cd ../.. && rm -rf opentelemetry-cpp COPY . /currencyservice @@ -38,14 +38,5 @@ RUN cd /currencyservice \ && cmake .. \ && make -j$(nproc || sysctl -n hw.ncpu || echo 1) install -FROM alpine - -WORKDIR /usr/src/app/ - -RUN apk update -RUN apk add grpc-dev re2-dev protobuf-dev c-ares-dev - -COPY --from=builder /usr/local/bin/currencyservice ./ - EXPOSE ${CURRENCY_SERVICE_PORT} -ENTRYPOINT ./currencyservice ${CURRENCY_SERVICE_PORT} +ENTRYPOINT ./usr/local/bin/currencyservice ${CURRENCY_SERVICE_PORT} diff --git a/src/currencyservice/src/tracer_common.h b/src/currencyservice/src/tracer_common.h index 3ebab43015..57cbf08ad8 100644 --- a/src/currencyservice/src/tracer_common.h +++ b/src/currencyservice/src/tracer_common.h @@ -8,6 +8,7 @@ #include "opentelemetry/exporters/ostream/span_exporter_factory.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/trace/simple_processor_factory.h" +#include "opentelemetry/sdk/trace/tracer_context.h" #include "opentelemetry/sdk/trace/tracer_context_factory.h" #include "opentelemetry/sdk/trace/tracer_provider_factory.h" #include "opentelemetry/trace/propagation/http_trace_context.h" @@ -76,14 +77,16 @@ void initTracer() opentelemetry::sdk::trace::SimpleSpanProcessorFactory::Create(std::move(exporter)); std::vector> processors; processors.push_back(std::move(processor)); - std::shared_ptr context = + + auto context = opentelemetry::sdk::trace::TracerContextFactory::Create(std::move(processors)); std::shared_ptr provider = - opentelemetry::sdk::trace::TracerProviderFactory::Create(context); - // Set the global trace provider + opentelemetry::sdk::trace::TracerProviderFactory::Create(std::move(context)); + + // Set the global trace provider opentelemetry::trace::Provider::SetTracerProvider(provider); - // set global propagator + // set global propagator opentelemetry::context::propagation::GlobalTextMapPropagator::SetGlobalPropagator( opentelemetry::nostd::shared_ptr( new opentelemetry::trace::propagation::HttpTraceContext())); diff --git a/src/emailservice/.ruby-version b/src/emailservice/.ruby-version index ef538c2810..0aec50e6ed 100644 --- a/src/emailservice/.ruby-version +++ b/src/emailservice/.ruby-version @@ -1 +1 @@ -3.1.2 +3.1.4 diff --git a/src/emailservice/Dockerfile b/src/emailservice/Dockerfile index e6cf316c30..547ffc65c4 100644 --- a/src/emailservice/Dockerfile +++ b/src/emailservice/Dockerfile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 -FROM ruby:3.1.2-alpine as base +FROM ruby:3.1.4-slim as base FROM base as builder @@ -10,8 +10,8 @@ WORKDIR /tmp COPY Gemfile Gemfile.lock . -RUN apk update && apk add make gcc musl-dev && bundle install - +#RUN apk update && apk add make gcc musl-dev gcompat && bundle install +RUN apt-get update && apt-get install build-essential -y && bundle install FROM base as release WORKDIR /email_server diff --git a/src/emailservice/Gemfile b/src/emailservice/Gemfile index 9c3c2ee821..f4548eab3d 100644 --- a/src/emailservice/Gemfile +++ b/src/emailservice/Gemfile @@ -4,9 +4,9 @@ source "https://rubygems.org" gem "net-smtp", "~> 0.3" gem "pony", "~> 1.13" -gem "puma", "~> 5.6" -gem "sinatra", "~> 2.2" +gem "puma", "~> 6.3" +gem "sinatra", "~> 3.0" -gem "opentelemetry-sdk", "~> 1.1" -gem "opentelemetry-exporter-otlp", "~> 0.21" -gem "opentelemetry-instrumentation-sinatra", "~> 0.19" +gem "opentelemetry-sdk", "~> 1.2" +gem "opentelemetry-exporter-otlp", "~> 0.24" +gem "opentelemetry-instrumentation-all", "~> 0.39" diff --git a/src/emailservice/Gemfile.lock b/src/emailservice/Gemfile.lock index 92a45bdc99..98c10c6f62 100644 --- a/src/emailservice/Gemfile.lock +++ b/src/emailservice/Gemfile.lock @@ -1,75 +1,248 @@ GEM remote: https://rubygems.org/ specs: - digest (3.1.0) - google-protobuf (3.21.1) - googleapis-common-protos-types (1.3.1) + date (3.3.3) + google-protobuf (3.23.4-aarch64-linux) + google-protobuf (3.23.4-arm64-darwin) + googleapis-common-protos-types (1.7.0) google-protobuf (~> 3.14) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp mini_mime (1.1.2) - mustermann (1.1.1) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest + net-imap (0.3.6) + date + net-protocol + net-pop (0.1.2) net-protocol + net-protocol (0.2.1) timeout - nio4r (2.5.8) - opentelemetry-api (1.0.2) - opentelemetry-common (0.19.6) + net-smtp (0.3.3) + net-protocol + nio4r (2.5.9) + opentelemetry-api (1.1.0) + opentelemetry-common (0.19.7) opentelemetry-api (~> 1.0) - opentelemetry-exporter-otlp (0.21.3) + opentelemetry-exporter-otlp (0.24.2) google-protobuf (~> 3.19) googleapis-common-protos-types (~> 1.3) + opentelemetry-api (~> 1.1) + opentelemetry-common (~> 0.19.6) + opentelemetry-sdk (~> 1.2) + opentelemetry-semantic_conventions + opentelemetry-instrumentation-action_pack (0.7.0) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rack (~> 0.21) + opentelemetry-instrumentation-action_view (0.6.0) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-active_support (~> 0.1) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-active_job (0.5.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-active_model_serializers (0.20.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-active_record (0.6.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + ruby2_keywords + opentelemetry-instrumentation-active_support (0.4.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-all (0.39.1) + opentelemetry-instrumentation-active_model_serializers (~> 0.20.1) + opentelemetry-instrumentation-aws_sdk (~> 0.4.1) + opentelemetry-instrumentation-bunny (~> 0.20.1) + opentelemetry-instrumentation-concurrent_ruby (~> 0.21.1) + opentelemetry-instrumentation-dalli (~> 0.24.1) + opentelemetry-instrumentation-delayed_job (~> 0.20.1) + opentelemetry-instrumentation-ethon (~> 0.21.1) + opentelemetry-instrumentation-excon (~> 0.21.1) + opentelemetry-instrumentation-faraday (~> 0.23.1) + opentelemetry-instrumentation-grape (~> 0.1.3) + opentelemetry-instrumentation-graphql (~> 0.26.2) + opentelemetry-instrumentation-http (~> 0.23.1) + opentelemetry-instrumentation-http_client (~> 0.22.1) + opentelemetry-instrumentation-koala (~> 0.20.1) + opentelemetry-instrumentation-lmdb (~> 0.22.1) + opentelemetry-instrumentation-mongo (~> 0.22.1) + opentelemetry-instrumentation-mysql2 (~> 0.24.2) + opentelemetry-instrumentation-net_http (~> 0.22.1) + opentelemetry-instrumentation-pg (~> 0.25.2) + opentelemetry-instrumentation-que (~> 0.6.1) + opentelemetry-instrumentation-racecar (~> 0.2.1) + opentelemetry-instrumentation-rack (~> 0.23.1) + opentelemetry-instrumentation-rails (~> 0.27.1) + opentelemetry-instrumentation-rake (~> 0.2.1) + opentelemetry-instrumentation-rdkafka (~> 0.3.1) + opentelemetry-instrumentation-redis (~> 0.25.1) + opentelemetry-instrumentation-resque (~> 0.4.1) + opentelemetry-instrumentation-restclient (~> 0.22.1) + opentelemetry-instrumentation-ruby_kafka (~> 0.20.1) + opentelemetry-instrumentation-sidekiq (~> 0.24.1) + opentelemetry-instrumentation-sinatra (~> 0.23.1) + opentelemetry-instrumentation-trilogy (~> 0.56.1) + opentelemetry-instrumentation-aws_sdk (0.4.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-base (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-registry (~> 0.1) + opentelemetry-instrumentation-bunny (0.20.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-concurrent_ruby (0.21.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-dalli (0.24.1) opentelemetry-api (~> 1.0) opentelemetry-common (~> 0.19.3) - opentelemetry-sdk (~> 1.0) - opentelemetry-semantic_conventions - opentelemetry-instrumentation-base (0.20.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-delayed_job (0.20.1) opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-sinatra (0.19.4) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-ethon (0.21.1) opentelemetry-api (~> 1.0) opentelemetry-common (~> 0.19.3) - opentelemetry-instrumentation-base (~> 0.20.0) - opentelemetry-registry (0.1.0) - opentelemetry-api (~> 1.0.1) - opentelemetry-sdk (1.1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-excon (0.21.1) opentelemetry-api (~> 1.0) opentelemetry-common (~> 0.19.3) - opentelemetry-registry (~> 0.1) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-faraday (0.23.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-grape (0.1.3) + opentelemetry-api (~> 1.1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rack (~> 0.21) + opentelemetry-instrumentation-graphql (0.26.2) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-http (0.23.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-http_client (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-koala (0.20.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-lmdb (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-mongo (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-mysql2 (0.24.2) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-net_http (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-pg (0.25.2) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-que (0.6.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-racecar (0.2.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rack (0.23.2) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rails (0.27.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-action_pack (~> 0.7.0) + opentelemetry-instrumentation-action_view (~> 0.6.0) + opentelemetry-instrumentation-active_job (~> 0.5.1) + opentelemetry-instrumentation-active_record (~> 0.6.1) + opentelemetry-instrumentation-active_support (~> 0.4.1) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rake (0.2.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rdkafka (0.3.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-redis (0.25.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-resque (0.4.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-restclient (0.22.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-ruby_kafka (0.20.1) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-sidekiq (0.24.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-sinatra (0.23.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rack (~> 0.21) + opentelemetry-instrumentation-trilogy (0.56.2) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-semantic_conventions (>= 1.8.0) + opentelemetry-registry (0.2.0) + opentelemetry-api (~> 1.1) + opentelemetry-sdk (1.2.1) + opentelemetry-api (~> 1.1) + opentelemetry-common (~> 0.19.3) + opentelemetry-registry (~> 0.2) opentelemetry-semantic_conventions - opentelemetry-semantic_conventions (1.8.0) + opentelemetry-semantic_conventions (1.10.0) opentelemetry-api (~> 1.0) pony (1.13.1) mail (>= 2.0) - puma (5.6.4) + puma (6.3.0) nio4r (~> 2.0) - rack (2.2.3.1) - rack-protection (2.2.0) + rack (2.2.7) + rack-protection (3.0.6) rack ruby2_keywords (0.0.5) - sinatra (2.2.0) - mustermann (~> 1.0) - rack (~> 2.2) - rack-protection (= 2.2.0) + sinatra (3.0.6) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.6) tilt (~> 2.0) - tilt (2.0.10) - timeout (0.3.0) + tilt (2.2.0) + timeout (0.4.0) PLATFORMS + aarch64-linux arm64-darwin-21 arm64-darwin-22 DEPENDENCIES net-smtp (~> 0.3) - opentelemetry-exporter-otlp (~> 0.21) - opentelemetry-instrumentation-sinatra (~> 0.19) - opentelemetry-sdk (~> 1.1) + opentelemetry-exporter-otlp (~> 0.24) + opentelemetry-instrumentation-all (~> 0.39) + opentelemetry-sdk (~> 1.2) pony (~> 1.13) - puma (~> 5.6) - sinatra (~> 2.2) + puma (~> 6.3) + sinatra (~> 3.0) BUNDLED WITH 2.3.7 diff --git a/src/frauddetectionservice/Dockerfile b/src/frauddetectionservice/Dockerfile index 0e7e05ed63..491bd190b6 100644 --- a/src/frauddetectionservice/Dockerfile +++ b/src/frauddetectionservice/Dockerfile @@ -14,12 +14,11 @@ RUN gradle shadowJar FROM gcr.io/distroless/java17-debian11 -ARG version=1.23.0 +ARG version=1.28.0 WORKDIR /usr/src/app/ COPY --from=builder /usr/src/app/build/libs/frauddetectionservice-1.0-all.jar ./ ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar -# RUN chmod 644 /app/opentelemetry-javaagent.jar ENV JAVA_TOOL_OPTIONS=-javaagent:/app/opentelemetry-javaagent.jar ENTRYPOINT [ "java", "-jar", "frauddetectionservice-1.0-all.jar" ] diff --git a/src/frauddetectionservice/README.md b/src/frauddetectionservice/README.md index 14b3f31771..d618203669 100644 --- a/src/frauddetectionservice/README.md +++ b/src/frauddetectionservice/README.md @@ -8,7 +8,7 @@ suspected of fraud. To build the protos and the service binary, run from the repo root: ```sh -protoc -I ../../pb/ ../../pb/demo.proto --kotlin_out=./src/main/kotlin +cp -r ../../pb/ src/main/proto/ ./gradlew shadowJar ``` diff --git a/src/frauddetectionservice/build.gradle.kts b/src/frauddetectionservice/build.gradle.kts index edd1c1f233..ddaff6b40f 100644 --- a/src/frauddetectionservice/build.gradle.kts +++ b/src/frauddetectionservice/build.gradle.kts @@ -3,11 +3,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import com.google.protobuf.gradle.* plugins { - kotlin("jvm") version "1.7.20" + kotlin("jvm") version "1.8.21" application id("java") id("idea") - id("com.google.protobuf") version "0.9.1" + id("com.google.protobuf") version "0.9.4" id("com.github.johnrengelman.shadow") version "7.1.2" } @@ -15,8 +15,8 @@ group = "io.opentelemetry" version = "1.0" -val grpcVersion = "1.50.0" -val protobufVersion = "3.16.1" +val grpcVersion = "1.56.1" +val protobufVersion = "3.23.4" repositories { @@ -27,26 +27,26 @@ repositories { dependencies { - implementation("com.google.protobuf:protobuf-java:3.21.7") + implementation("com.google.protobuf:protobuf-java:${protobufVersion}") testImplementation(kotlin("test")) implementation(kotlin("script-runtime")) - implementation("org.apache.kafka:kafka-clients:3.3.1") - implementation("com.google.api.grpc:proto-google-common-protos:2.9.6") + implementation("org.apache.kafka:kafka-clients:3.5.0") + implementation("com.google.api.grpc:proto-google-common-protos:2.22.0") implementation("io.grpc:grpc-protobuf:${grpcVersion}") implementation("io.grpc:grpc-stub:${grpcVersion}") implementation("io.grpc:grpc-netty:${grpcVersion}") implementation("io.grpc:grpc-services:${grpcVersion}") - implementation("io.opentelemetry:opentelemetry-api:1.19.0") - implementation("io.opentelemetry:opentelemetry-sdk:1.19.0") + implementation("io.opentelemetry:opentelemetry-api:1.28.0") + implementation("io.opentelemetry:opentelemetry-sdk:1.28.0") implementation("io.opentelemetry:opentelemetry-extension-annotations:1.18.0") - implementation("org.apache.logging.log4j:log4j-core:2.19.0") - implementation("org.slf4j:slf4j-api:2.0.3") - implementation("com.google.protobuf:protobuf-kotlin:3.21.8") + implementation("org.apache.logging.log4j:log4j-core:2.20.0") + implementation("org.slf4j:slf4j-api:2.0.7") + implementation("com.google.protobuf:protobuf-kotlin:${protobufVersion}") if (JavaVersion.current().isJava9Compatible) { // Workaround for @javax.annotation.Generated // see: https://github.com/grpc/grpc-java/issues/3633 - implementation("javax.annotation:javax.annotation-api:1.3.1") + implementation("javax.annotation:javax.annotation-api:1.3.2") } } @@ -55,17 +55,17 @@ tasks.test { } tasks.withType { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = "17" } protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.21.7" + artifact = "com.google.protobuf:protoc:${protobufVersion}" } plugins { id("grpc") { - artifact = "io.grpc:protoc-gen-grpc-java:1.50.2" + artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } } generateProtoTasks { diff --git a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar b/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..033e24c4cd 100644 Binary files a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar and b/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties b/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties index 60c76b3408..9f4197d5f4 100644 --- a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties +++ b/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/src/frauddetectionservice/gradlew b/src/frauddetectionservice/gradlew index 1b6c787337..fcb6fca147 100755 --- a/src/frauddetectionservice/gradlew +++ b/src/frauddetectionservice/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in @@ -205,6 +213,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/src/frauddetectionservice/gradlew.bat b/src/frauddetectionservice/gradlew.bat index 107acd32c4..93e3f59f13 100644 --- a/src/frauddetectionservice/gradlew.bat +++ b/src/frauddetectionservice/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt b/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt index 6db2976f65..581134ad42 100644 --- a/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt +++ b/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt @@ -13,7 +13,7 @@ import kotlin.system.exitProcess const val topic = "orders" const val groupID = "frauddetectionservice" -fun main(args: Array) { +fun main() { val props = Properties() props[KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java.name props[VALUE_DESERIALIZER_CLASS_CONFIG] = ByteArrayDeserializer::class.java.name diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index 20264bd788..ea40f0614d 100644 --- a/src/loadgenerator/locustfile.py +++ b/src/loadgenerator/locustfile.py @@ -10,18 +10,29 @@ from locust import HttpUser, task, between from opentelemetry import context, baggage, trace +from opentelemetry.metrics import set_meter_provider +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import MetricExporter, PeriodicExportingMetricReader from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor -from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter +from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter +from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter +from opentelemetry.instrumentation.jinja2 import Jinja2Instrumentor from opentelemetry.instrumentation.requests import RequestsInstrumentor +from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor +exporter = OTLPMetricExporter(insecure=True) +set_meter_provider(MeterProvider([PeriodicExportingMetricReader(exporter)])) + tracer_provider = TracerProvider() trace.set_tracer_provider(tracer_provider) tracer_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter())) # Instrumenting manually to avoid error with locust gevent monkey +Jinja2Instrumentor().instrument() RequestsInstrumentor().instrument() +SystemMetricsInstrumentor().instrument() URLLib3Instrumentor().instrument() categories = [ diff --git a/src/loadgenerator/requirements.txt b/src/loadgenerator/requirements.txt index 5009db4ef5..4d2a3ced42 100644 --- a/src/loadgenerator/requirements.txt +++ b/src/loadgenerator/requirements.txt @@ -7,35 +7,37 @@ configargparse==1.5.3 deprecated==1.2.13 flask==2.3.2 flask-basicauth==0.2.0 -flask-cors==3.0.10 -gevent==22.10.2 +flask-cors==4.0.0 +gevent==23.7.0 geventhttpclient==2.0.9 -googleapis-common-protos==1.59.0 +googleapis-common-protos==1.59.1 greenlet==2.0.2 idna==3.4 itsdangerous==2.1.2 jinja2==3.1.2 locust==2.15.1 -markupsafe==2.1.2 +markupsafe==2.1.3 msgpack==1.0.5 -opentelemetry-api==1.17.0 -opentelemetry-exporter-otlp-proto-http==1.17.0 -opentelemetry-instrumentation==0.38b0 -opentelemetry-instrumentation-requests==0.38b0 -opentelemetry-instrumentation-urllib3==0.38b0 -opentelemetry-proto==1.17.0 -opentelemetry-sdk==1.17.0 -opentelemetry-semantic-conventions==0.38b0 -opentelemetry-util-http==0.38b0 -protobuf==4.22.3 +opentelemetry-api==1.19.0 +opentelemetry-exporter-otlp-proto-grpc==1.19.0 +opentelemetry-instrumentation==0.40b0 +opentelemetry-instrumentation-jinja2==0.40b0 +opentelemetry-instrumentation-requests==0.40b0 +opentelemetry-instrumentation-system-metrics==0.40b0 +opentelemetry-instrumentation-urllib3==0.40b0 +opentelemetry-proto==1.19.0 +opentelemetry-sdk==1.19.0 +opentelemetry-semantic-conventions==0.40b0 +opentelemetry-util-http==0.40b0 +protobuf==4.23.4 psutil==5.9.5 -pyzmq==25.0.2 +pyzmq==25.1.0 requests==2.31.0 roundrobin==0.0.4 six==1.16.0 -typing-extensions==4.5.0 -urllib3==1.26.15 -werkzeug==2.3.3 +typing-extensions==4.7.1 +urllib3==2.0.4 +werkzeug==2.3.6 wrapt==1.15.0 -zope-event==4.6 +zope-event==5.0 zope-interface==6.0 diff --git a/src/recommendationservice/Dockerfile b/src/recommendationservice/Dockerfile index 99d2d5e565..d4dc275269 100644 --- a/src/recommendationservice/Dockerfile +++ b/src/recommendationservice/Dockerfile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 -FROM python:3.10-slim-bullseye as base +FROM python:3.11-slim-bullseye as base # # Fetch requirements @@ -25,7 +25,7 @@ FROM base as grpc-builder WORKDIR /usr/src/app/ COPY ./pb/ ./proto/ -RUN python -m pip install grpcio-tools==1.48.2 +RUN python -m pip install grpcio-tools==1.56.2 RUN python -m grpc_tools.protoc -I=./proto/ --python_out=./ --grpc_python_out=./ ./proto/demo.proto # diff --git a/src/recommendationservice/logger.py b/src/recommendationservice/logger.py index f22ed32172..0569665539 100644 --- a/src/recommendationservice/logger.py +++ b/src/recommendationservice/logger.py @@ -1,8 +1,7 @@ #!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# import logging import sys diff --git a/src/recommendationservice/metrics.py b/src/recommendationservice/metrics.py index 656433929b..51b79968ec 100644 --- a/src/recommendationservice/metrics.py +++ b/src/recommendationservice/metrics.py @@ -1,9 +1,7 @@ #!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# - def init_metrics(meter): diff --git a/src/recommendationservice/recommendation_server.py b/src/recommendationservice/recommendation_server.py index 88f03f368c..d8b3a0f036 100644 --- a/src/recommendationservice/recommendation_server.py +++ b/src/recommendationservice/recommendation_server.py @@ -1,7 +1,8 @@ +#!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# + # Python import os diff --git a/src/recommendationservice/requirements.txt b/src/recommendationservice/requirements.txt index 85d0901cde..ecdc4621e8 100644 --- a/src/recommendationservice/requirements.txt +++ b/src/recommendationservice/requirements.txt @@ -1,7 +1,7 @@ -grpcio-health-checking==1.43.0 -grpcio==1.51.3 -opentelemetry-distro==0.36b0 -opentelemetry-exporter-otlp-proto-grpc==1.15.0 -python-dotenv==0.21.0 -python-json-logger==2.0.4 -psutil==5.9.2 # Importing this will also import opentelemetry-instrumentation-system-metrics when running opentelemetry-bootstrap +grpcio-health-checking==1.56.2 +grpcio==1.56.2 +opentelemetry-distro==0.40b0 +opentelemetry-exporter-otlp-proto-grpc==1.19.0 +python-dotenv==1.0.0 +python-json-logger==2.0.7 +psutil==5.9.5 # Importing this will also import opentelemetry-instrumentation-system-metrics when running opentelemetry-bootstrap