diff --git a/gateway/pom.xml b/gateway/pom.xml index 97cfbe4..74101d4 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -58,15 +58,15 @@ - - io.micrometer - micrometer-tracing-bridge-otel - + + + + - - io.opentelemetry - opentelemetry-exporter-otlp - + + + + org.springframework.cloud diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/repository/CustomerRepository.java b/gateway/src/main/java/io/konveyor/demo/gateway/repository/CustomerRepository.java index ebe03d9..7e5551c 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/repository/CustomerRepository.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/repository/CustomerRepository.java @@ -15,8 +15,6 @@ import io.github.resilience4j.retry.annotation.Retry; import io.konveyor.demo.gateway.model.Customer; import io.konveyor.demo.util.PaginatedResponse; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Repository @@ -32,8 +30,8 @@ public CustomerRepository(RestClient.Builder restClientBuilder, @Value("${servic @CircuitBreaker(name = "Customers", fallbackMethod = "getFallbackCustomer") @Retry(name = "Customers", fallbackMethod = "getFallbackCustomer") - @NewSpan - public Customer getCustomerById(@SpanTag Long id) { +// @NewSpan + public Customer getCustomerById(Long id) { log.debug("Entering OrdersService.getCustomerById()"); var c = this.restClient.get() @@ -52,8 +50,8 @@ public Customer getCustomerById(@SpanTag Long id) { @CircuitBreaker(name = "AllCustomers", fallbackMethod = "getFallbackCustomers") @Retry(name = "AllCustomers", fallbackMethod = "getFallbackCustomer") - @NewSpan - public List findAll(@SpanTag Pageable pageable) { +// @NewSpan + public List findAll(Pageable pageable) { log.debug("Entering CustomerRepository.findAll()"); return this.restClient.get() diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/repository/InventoryRepository.java b/gateway/src/main/java/io/konveyor/demo/gateway/repository/InventoryRepository.java index 9e3c8ee..fda2822 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/repository/InventoryRepository.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/repository/InventoryRepository.java @@ -16,8 +16,6 @@ import io.github.resilience4j.retry.annotation.Retry; import io.konveyor.demo.gateway.model.OrderItem; import io.konveyor.demo.gateway.model.Product; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Repository @@ -42,8 +40,8 @@ public Product getProduct(OrderItem item) { .body(Product.class); } - @NewSpan - public List getProductDetails(@SpanTag List items) { +// @NewSpan + public List getProductDetails(List items) { log.debug("Entering InventoryRepository.getProductDetails()"); return items.stream() @@ -65,8 +63,8 @@ public List getProductDetails(@SpanTag List items) { @CircuitBreaker(name = "AllProducts", fallbackMethod = "getFallbackProducts") @Retry(name = "AllProducts", fallbackMethod = "getFallbackProducts") - @NewSpan - public List findAll(@SpanTag Pageable pageable) { +// @NewSpan + public List findAll(Pageable pageable) { log.debug("Entering InventoryRepository.findAll()"); return this.restClient.get() @@ -82,8 +80,8 @@ public List findAll(@SpanTag Pageable pageable) { @CircuitBreaker(name = "Products", fallbackMethod = "getFallbackProduct") @Retry(name = "Products", fallbackMethod = "getFallbackProduct") - @NewSpan - public Product getProductById(@SpanTag Long id) { +// @NewSpan + public Product getProductById(Long id) { log.debug("Entering InventoryRepository.getProductById()"); var p = this.restClient.get() diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/repository/OrderRepository.java b/gateway/src/main/java/io/konveyor/demo/gateway/repository/OrderRepository.java index f22e802..26e9f8d 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/repository/OrderRepository.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/repository/OrderRepository.java @@ -14,8 +14,6 @@ import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker; import io.github.resilience4j.retry.annotation.Retry; import io.konveyor.demo.gateway.model.Order; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Repository @@ -31,8 +29,8 @@ public OrderRepository(RestClient.Builder restClientBuilder, @Value("${services. @CircuitBreaker(name = "Orders", fallbackMethod = "getFallbackOrder") @Retry(name = "Orders", fallbackMethod = "getFallbackOrder") - @NewSpan - public Order getOrderById(@SpanTag Long id) { +// @NewSpan + public Order getOrderById(Long id) { log.debug("Entering OrderRepository.getOrderById()"); var o = this.restClient.get() @@ -54,8 +52,8 @@ public Order getOrderById(@SpanTag Long id) { @CircuitBreaker(name = "AllOrders", fallbackMethod = "getFallbackOrders") @Retry(name = "AllOrders", fallbackMethod = "getFallbackOrders") - @NewSpan - public List findAll(@SpanTag Pageable pageable) { +// @NewSpan + public List findAll(Pageable pageable) { log.debug("Entering OrderRepository.findAll()"); return this.restClient.get() diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/service/CustomersService.java b/gateway/src/main/java/io/konveyor/demo/gateway/service/CustomersService.java index bb5b6ed..80d40d8 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/service/CustomersService.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/service/CustomersService.java @@ -8,8 +8,6 @@ import io.konveyor.demo.gateway.model.Customer; import io.konveyor.demo.gateway.repository.CustomerRepository; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Service @@ -18,16 +16,16 @@ public class CustomersService { @Autowired private CustomerRepository customerRepository; - @NewSpan - public Page findAll(@SpanTag Pageable pageable) { +// @NewSpan + public Page findAll(Pageable pageable) { log.debug("Entering OrdersService.findAll()"); var orders = customerRepository.findAll(pageable); return new PageImpl(orders, pageable, orders.size()); } - @NewSpan - public Customer getById(@SpanTag Long id) { +// @NewSpan + public Customer getById(Long id) { log.debug("Entering CustomersService.getById()"); return customerRepository.getCustomerById(id); } diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/service/InventoryService.java b/gateway/src/main/java/io/konveyor/demo/gateway/service/InventoryService.java index 2a57a89..de44bca 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/service/InventoryService.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/service/InventoryService.java @@ -8,8 +8,6 @@ import io.konveyor.demo.gateway.model.Product; import io.konveyor.demo.gateway.repository.InventoryRepository; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Service @@ -18,16 +16,16 @@ public class InventoryService { @Autowired private InventoryRepository inventoryRepository; - @NewSpan - public Page findAll(@SpanTag Pageable pageable) { +// @NewSpan + public Page findAll(Pageable pageable) { log.debug("Entering OrdersService.findAll()"); var orders = inventoryRepository.findAll(pageable); return new PageImpl(orders, pageable, orders.size()); } - @NewSpan - public Product getById(@SpanTag Long id) { +// @NewSpan + public Product getById(Long id) { log.debug("Entering CustomersService.getById()"); return inventoryRepository.getProductById(id); } diff --git a/gateway/src/main/java/io/konveyor/demo/gateway/service/OrdersService.java b/gateway/src/main/java/io/konveyor/demo/gateway/service/OrdersService.java index 742a171..e073ab1 100644 --- a/gateway/src/main/java/io/konveyor/demo/gateway/service/OrdersService.java +++ b/gateway/src/main/java/io/konveyor/demo/gateway/service/OrdersService.java @@ -10,8 +10,6 @@ import io.konveyor.demo.gateway.repository.CustomerRepository; import io.konveyor.demo.gateway.repository.InventoryRepository; import io.konveyor.demo.gateway.repository.OrderRepository; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; import lombok.extern.slf4j.Slf4j; @Service @@ -26,8 +24,8 @@ public class OrdersService { @Autowired private InventoryRepository inventoryRepository; - @NewSpan - public Order getById(@SpanTag Long id) { +// @NewSpan + public Order getById(Long id) { log.debug("Entering OrdersService.getById()"); Order o = orderRepository.getOrderById(id); @@ -39,8 +37,8 @@ public Order getById(@SpanTag Long id) { return o; } - @NewSpan - public Page findAll(@SpanTag Pageable pageable) { +// @NewSpan + public Page findAll(Pageable pageable) { log.debug("Entering OrdersService.findAll()"); var orders = orderRepository.findAll(pageable); diff --git a/gateway/src/main/resources/application.properties b/gateway/src/main/resources/application.properties index 1fd9de8..e5fca30 100644 --- a/gateway/src/main/resources/application.properties +++ b/gateway/src/main/resources/application.properties @@ -12,6 +12,8 @@ management.endponts.web.exposure.include=* management.endpoint.health.show-details=always management.health.circuitbreakers.enabled=true management.info.git.mode=full -management.observations.annotations.enabled=true -management.otlp.tracing.endpoint=http://otel-collector:4318/v1/traces -management.tracing.sampling.probability=1.0 \ No newline at end of file + +# Observability/tracing +#management.observations.annotations.enabled=true +#management.otlp.tracing.endpoint=http://otel-collector:4318/v1/traces +#management.tracing.sampling.probability=1.0 \ No newline at end of file diff --git a/inventory/pom.xml b/inventory/pom.xml index d887344..02deb21 100644 --- a/inventory/pom.xml +++ b/inventory/pom.xml @@ -61,14 +61,17 @@ io.quarkus quarkus-micrometer-registry-prometheus - - io.quarkus - quarkus-opentelemetry - - - io.opentelemetry.instrumentation - opentelemetry-jdbc - + + + + + + + + + + + io.quarkus quarkus-junit5-mockito diff --git a/inventory/src/main/java/com/redhat/coolstore/inventory/repository/ProductRepository.java b/inventory/src/main/java/com/redhat/coolstore/inventory/repository/ProductRepository.java index 8439fef..094c9ea 100644 --- a/inventory/src/main/java/com/redhat/coolstore/inventory/repository/ProductRepository.java +++ b/inventory/src/main/java/com/redhat/coolstore/inventory/repository/ProductRepository.java @@ -13,6 +13,7 @@ @ApplicationScoped public class ProductRepository implements PanacheRepository { +// @WithSpan public List findAll(Page page, Sort sort) { Log.debug("Entering ProductRepository.findAll()"); return findAll(sort) diff --git a/inventory/src/main/java/com/redhat/coolstore/inventory/service/ProductService.java b/inventory/src/main/java/com/redhat/coolstore/inventory/service/ProductService.java index 505a260..f45d1c2 100644 --- a/inventory/src/main/java/com/redhat/coolstore/inventory/service/ProductService.java +++ b/inventory/src/main/java/com/redhat/coolstore/inventory/service/ProductService.java @@ -26,16 +26,17 @@ public class ProductService implements IProductService { * @param id The {@link Product} {@code id} * @return The {@link Product} with the supplied {@code id}, {@literal null} if no {@link Product} is found. */ +// @WithSpan + @Override public Product findById(Long id) { Log.debug("Entering ProductService.findById()"); return repository.findById(id); } +// @WithSpan @Override public List findAll(Page page, Sort sort) { Log.debug("Entering ProductService.findAll()"); return repository.findAll(page, sort); } - - } diff --git a/inventory/src/main/resources/application.properties b/inventory/src/main/resources/application.properties index c3a92c2..a331c7b 100644 --- a/inventory/src/main/resources/application.properties +++ b/inventory/src/main/resources/application.properties @@ -14,9 +14,9 @@ quarkus.application.name=inventory %prod.quarkus.hibernate-orm.sql-load-script=import.sql %prod.quarkus.hibernate-orm.log.sql=true -# OpenTelemetry -%prod.quarkus.otel.exporter.otlp.traces.endpoint=http://otel-collector:4317 -%prod.quarkus.datasource.jdbc.telemetry=true +# Observability/tracing +#quarkus.otel.exporter.otlp.traces.endpoint=http://otel-collector:4317 +#quarkus.datasource.jdbc.telemetry=true # OpenShift configurations # %prod.quarkus.kubernetes-client.trust-certs=true diff --git a/orders/pom.xml b/orders/pom.xml index cdd7814..fd6fe9f 100644 --- a/orders/pom.xml +++ b/orders/pom.xml @@ -66,20 +66,20 @@ - - io.micrometer - micrometer-tracing-bridge-otel - + + + + - - io.opentelemetry - opentelemetry-exporter-otlp - + + + + - - io.opentelemetry.instrumentation - opentelemetry-jdbc - + + + + diff --git a/orders/src/main/java/io/konveyor/demo/orders/config/OtelDataSourceConfig.java b/orders/src/main/java/io/konveyor/demo/orders/config/OtelDataSourceConfig.java index 1d60c5a..355f368 100644 --- a/orders/src/main/java/io/konveyor/demo/orders/config/OtelDataSourceConfig.java +++ b/orders/src/main/java/io/konveyor/demo/orders/config/OtelDataSourceConfig.java @@ -7,24 +7,21 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.jdbc.datasource.JdbcTelemetry; - /** * This class is needed to allow tracing down to the JDBC level. * Taken from https://opentelemetry.io/docs/languages/java/automatic/spring-boot/#jdbc-instrumentation */ @Configuration public class OtelDataSourceConfig { - @Bean - public DataSource dataSource(DataSourceProperties dataSourceProperties, OpenTelemetry openTelemetry) { - var dataSource = DataSourceBuilder.create() - .driverClassName(dataSourceProperties.determineDriverClassName()) - .url(dataSourceProperties.determineUrl()) - .username(dataSourceProperties.getUsername()) - .password(dataSourceProperties.getPassword()) - .build(); - - return JdbcTelemetry.create(openTelemetry).wrap(dataSource); - } +// @Bean +// public DataSource dataSource(DataSourceProperties dataSourceProperties, OpenTelemetry openTelemetry) { +// var dataSource = DataSourceBuilder.create() +// .driverClassName(dataSourceProperties.determineDriverClassName()) +// .url(dataSourceProperties.determineUrl()) +// .username(dataSourceProperties.getUsername()) +// .password(dataSourceProperties.getPassword()) +// .build(); +// +// return JdbcTelemetry.create(openTelemetry).wrap(dataSource); +// } } \ No newline at end of file diff --git a/orders/src/main/java/io/konveyor/demo/orders/service/OrderService.java b/orders/src/main/java/io/konveyor/demo/orders/service/OrderService.java index 28356e7..38beeb9 100644 --- a/orders/src/main/java/io/konveyor/demo/orders/service/OrderService.java +++ b/orders/src/main/java/io/konveyor/demo/orders/service/OrderService.java @@ -8,8 +8,6 @@ import io.konveyor.demo.orders.model.Order; import io.konveyor.demo.orders.repository.OrderRepository; -import io.micrometer.tracing.annotation.NewSpan; -import io.micrometer.tracing.annotation.SpanTag; @Service @Transactional @@ -23,12 +21,12 @@ public class OrderService { * @param id The {@link Order} {@code id} * @return The {@link Order} with the supplied {@code id}, {@literal null} if no {@link Order} is found. */ - @NewSpan - public Order findById(@SpanTag("arg.id") Long id) { +// @NewSpan + public Order findById(Long id) { return repository.findById(id).orElse(null); } - @NewSpan +// @NewSpan public Page findAll(Pageable pageable) { return repository.findAll(pageable); } diff --git a/orders/src/main/resources/application-postgres.properties b/orders/src/main/resources/application-postgres.properties index 0469ea8..4eb2796 100644 --- a/orders/src/main/resources/application-postgres.properties +++ b/orders/src/main/resources/application-postgres.properties @@ -1,3 +1,5 @@ +spring.application.name=orders + spring.datasource.url=jdbc:postgresql://postgresql-orders.rhoar.svc:5432/orders spring.datasource.username=orders spring.datasource.password=orders @@ -9,6 +11,8 @@ spring.sql.init.mode=always management.endponts.web.exposure.include=* management.endpoint.health.show-details=always management.info.git.mode=full -management.observations.annotations.enabled=true -management.otlp.tracing.endpoint=http://localhost:4318/traces -management.tracing.sampling.probability=1.0 \ No newline at end of file + +# Observability/tracing +#management.observations.annotations.enabled=true +#management.otlp.tracing.endpoint=http://localhost:4318/traces +#management.tracing.sampling.probability=1.0 \ No newline at end of file diff --git a/orders/src/main/resources/application.properties b/orders/src/main/resources/application.properties index 55e2064..b85b161 100644 --- a/orders/src/main/resources/application.properties +++ b/orders/src/main/resources/application.properties @@ -11,6 +11,8 @@ spring.sql.init.mode=always management.endponts.web.exposure.include=* management.endpoint.health.show-details=always management.info.git.mode=full -management.observations.annotations.enabled=true -management.otlp.tracing.endpoint=http://otel-collector:4318/v1/traces -management.tracing.sampling.probability=1.0 \ No newline at end of file + +# Observability/tracing +#management.observations.annotations.enabled=true +#management.otlp.tracing.endpoint=http://otel-collector:4318/v1/traces +#management.tracing.sampling.probability=1.0 \ No newline at end of file