diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index d83e735..10f8e01 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,4 +1,4 @@
-FROM maven:3-eclipse-temurin-21 AS dind
+FROM maven:3-eclipse-temurin-21 AS dind
ARG DEBIAN_FRONTEND=noninteractive
ENV PIP_ROOT_USER_ACTION=ignore
diff --git a/.github/workflows/provide-docker-images.yml b/.github/workflows/provide-docker-images.yml
new file mode 100644
index 0000000..b46ad2e
--- /dev/null
+++ b/.github/workflows/provide-docker-images.yml
@@ -0,0 +1,50 @@
+name: Provide needed docker images in ghcr.io
+
+on:
+ workflow_dispatch:
+ push:
+
+env:
+ REGISTRY_IMAGE: ghcr.io/lftraining/lfs148-code
+
+jobs:
+ retag_and_push:
+ name: Provide docker image ${{ matrix.image.namespace }}/${{ matrix.image.name }}:${{ matrix.image.tag }} on ghcr.io
+ runs-on: [ubuntu-latest]
+ strategy:
+ matrix:
+ image:
+ - name: todobackend-springboot
+ tag: v2404
+ namespace: maeddes
+ - name: todoui-thymeleaf
+ tag: v2404
+ namespace: maeddes
+ - name: todoui-flask
+ tag: v2404
+ namespace: maeddes
+ - name: simple-generator
+ tag: v2404
+ namespace: maeddes
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Pull image from Docker Hub
+ run: |
+ docker pull docker.io/${{ matrix.image.namespace }}/${{ matrix.image.name }}:${{ matrix.image.tag }}
+
+ - name: Retag the image for GitHub Container Registry
+ run: |
+ docker tag ${{ matrix.image.namespace }}/${{ matrix.image.name }}:${{ matrix.image.tag }} ${{ env.REGISTRY_IMAGE }}-${{ matrix.image.name }}:${{ matrix.image.tag }}
+
+ - name: Push image to GitHub Container Registry
+ run: |
+ docker push ${{ env.REGISTRY_IMAGE }}-${{ matrix.image.name }}:${{ matrix.image.tag }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 993cf53..2057efe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@
*.jar
settings.json
+.envrc
+.direnv
+.devenv
\ No newline at end of file
diff --git a/exercises/automatic-instrumentation/initial/todobackend-springboot/Dockerfile b/exercises/automatic-instrumentation/initial/todobackend-springboot/Dockerfile
index bcc02e7..5893092 100644
--- a/exercises/automatic-instrumentation/initial/todobackend-springboot/Dockerfile
+++ b/exercises/automatic-instrumentation/initial/todobackend-springboot/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
+FROM docker.io/maven:3-eclipse-temurin-21 AS build
WORKDIR /workspace/app
COPY pom.xml .
diff --git a/exercises/automatic-instrumentation/initial/todobackend-springboot/pom.xml b/exercises/automatic-instrumentation/initial/todobackend-springboot/pom.xml
index efe02e6..c4869bc 100644
--- a/exercises/automatic-instrumentation/initial/todobackend-springboot/pom.xml
+++ b/exercises/automatic-instrumentation/initial/todobackend-springboot/pom.xml
@@ -15,7 +15,7 @@
todobackend-automatic
0.0.1-SNAPSHOT
todobackend-automatic
- Novatec Demo Application
+ Demo Application
21
@@ -53,6 +53,20 @@
org.springframework.boot
spring-boot-starter-test
test
+
+
+ org.mockito
+ mockito-core
+
+
+ net.bytebuddy
+ byte-buddy
+
+
+ net.bytebuddy
+ byte-buddy-agent
+
+
diff --git a/exercises/automatic-instrumentation/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java b/exercises/automatic-instrumentation/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
index 5c1cc18..bf16e17 100644
--- a/exercises/automatic-instrumentation/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
+++ b/exercises/automatic-instrumentation/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
@@ -87,13 +87,13 @@ String someInternalMethod(String todo){
} catch (InterruptedException e) {
e.printStackTrace();
}
- }
+ }
if(todo.equals("fail")){
System.out.println("Failing ...");
throw new RuntimeException();
-
- }
+
+ }
return todo;
}
diff --git a/exercises/automatic-instrumentation/solution/todobackend-springboot/Dockerfile b/exercises/automatic-instrumentation/solution/todobackend-springboot/Dockerfile
index bcc02e7..5893092 100644
--- a/exercises/automatic-instrumentation/solution/todobackend-springboot/Dockerfile
+++ b/exercises/automatic-instrumentation/solution/todobackend-springboot/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
+FROM docker.io/maven:3-eclipse-temurin-21 AS build
WORKDIR /workspace/app
COPY pom.xml .
diff --git a/exercises/automatic-instrumentation/solution/todobackend-springboot/pom.xml b/exercises/automatic-instrumentation/solution/todobackend-springboot/pom.xml
index 6d99fd4..7faad91 100644
--- a/exercises/automatic-instrumentation/solution/todobackend-springboot/pom.xml
+++ b/exercises/automatic-instrumentation/solution/todobackend-springboot/pom.xml
@@ -15,7 +15,7 @@
todobackend-automatic-solution
0.0.1-SNAPSHOT
todobackend-automatic-solution
- Novatec Demo Application
+ Demo Application
21
@@ -53,6 +53,20 @@
org.springframework.boot
spring-boot-starter-test
test
+
+
+ org.mockito
+ mockito-core
+
+
+ net.bytebuddy
+ byte-buddy
+
+
+ net.bytebuddy
+ byte-buddy-agent
+
+
io.opentelemetry.instrumentation
diff --git a/exercises/automatic-instrumentation/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java b/exercises/automatic-instrumentation/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
index cf69f70..c655cd2 100644
--- a/exercises/automatic-instrumentation/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
+++ b/exercises/automatic-instrumentation/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
@@ -91,13 +91,13 @@ String someInternalMethod(@SpanAttribute String todo){
} catch (InterruptedException e) {
e.printStackTrace();
}
- }
+ }
if(todo.equals("fail")){
System.out.println("Failing ...");
throw new RuntimeException();
-
- }
+
+ }
return todo;
}
diff --git a/exercises/manual-instrumentation-java/initial/.gitignore b/exercises/manual-instrumentation-java/initial/.gitignore
deleted file mode 100644
index 227a53b..0000000
--- a/exercises/manual-instrumentation-java/initial/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-HELP.md
-**target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-*.jar
-
-__pycache__
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
-opentelemetry-javaagent.jar
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/Dockerfile b/exercises/manual-instrumentation-java/initial/todobackend-springboot/Dockerfile
deleted file mode 100644
index bcc02e7..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
-WORKDIR /workspace/app
-
-COPY pom.xml .
-COPY src src
-
-RUN --mount=type=cache,target=/root/.m2 mvn install -DskipTests
-RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
-
-FROM docker.io/eclipse-temurin:21-jdk-alpine
-RUN mkdir -p /opt/todobackend
-WORKDIR /opt/todobackend
-#RUN addgroup -S demo && adduser -S demo -G demo
-#USER demo
-VOLUME /tmp
-ARG DEPENDENCY=/workspace/app/target/dependency
-COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /opt/todobackend/app/lib
-COPY --from=build ${DEPENDENCY}/META-INF /opt/todobackend/app/META-INF
-COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /opt/todobackend/app
-
-ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.8.0/opentelemetry-javaagent.jar /opt/todobackend
-
-ENTRYPOINT ["java", "-cp", "/opt/todobackend/app:/opt/todobackend/app/lib/*", "-javaagent:/opt/todobackend/opentelemetry-javaagent.jar","io.novatec.todobackend.TodobackendApplication"]
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/pom.xml b/exercises/manual-instrumentation-java/initial/todobackend-springboot/pom.xml
deleted file mode 100644
index 1e8f51c..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
- 4.0.0
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 3.2.2
-
-
-
- io.novatec
- todobackend-manual
- 0.0.1-SNAPSHOT
- todobackend-manual
- Novatec Demo Application
-
-
- 21
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- com.h2database
- h2
- runtime
-
-
- org.postgresql
- postgresql
- runtime
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- 2.2.0
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- todobackend-${version}
-
-
-
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java b/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
deleted file mode 100644
index 35694f8..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package io.novatec.todobackend;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-@SpringBootApplication
-@RestController
-@CrossOrigin(origins = "*")
-
-public class TodobackendApplication {
-
- private Logger logger = LoggerFactory.getLogger(TodobackendApplication.class);
-
- @Value("${HOSTNAME:not_set}")
- String hostname;
-
- @Value("${spring.profiles.active: none}")
- String profile;
-
- @Autowired
- TodoRepository todoRepository;
-
-
- private String getInstanceId() {
-
- if (!hostname.equals("not_set"))
- return hostname;
- return "probably localhost";
-
- }
-
- @GetMapping("/hello")
- String hello() {
-
- return getInstanceId() + " Hallo, Welt ! ";
-
- }
-
- @GetMapping("/fail")
- String fail() {
-
- System.exit(1);
- return "fixed!";
- }
-
- @GetMapping("/todos/")
- List getTodos() {
-
- List todos = new ArrayList();
-
- todoRepository.findAll().forEach(todo -> todos.add(todo.getTodo()));
- logger.info("GET /todos/ " + todos.toString());
-
- return todos;
- }
-
- @PostMapping("/todos/{todo}")
- String addTodo(HttpServletRequest request, HttpServletResponse response, @PathVariable String todo){
-
- logger.info("POST /todos/ "+todo.toString());
-
- this.someInternalMethod(todo);
-
- return todo;
-
- }
-
- String someInternalMethod(String todo){
-
- todoRepository.save(new Todo(todo));
-
- if(todo.equals("slow")){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- if(todo.equals("fail")){
-
- System.out.println("Failing ...");
- throw new RuntimeException();
-
- }
-
- return todo;
-
- }
-
- @DeleteMapping("/todos/{todo}")
- String removeTodo(@PathVariable String todo) {
-
- todoRepository.deleteById(todo);
- logger.info("DELETE /todos/ " + todo.toString());
- return "removed " + todo;
-
- }
-
- public static void main(String[] args) {
- SpringApplication.run(TodobackendApplication.class, args);
- }
-
-}
-
-@Entity
-class Todo {
-
- @Id
- String todo;
-
- public Todo() {
- }
-
- public Todo(String todo) {
- this.todo = todo;
- }
-
- public String getTodo() {
- return todo;
- }
-
- public void setTodo(String todo) {
- this.todo = todo;
- }
-
-}
-
-interface TodoRepository extends CrudRepository {
-
-}
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-dev.properties b/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-dev.properties
deleted file mode 100644
index 25d7606..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-dev.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-spring.h2.console.enabled=true
-spring.h2.console.path=/h2
-spring.datasource.url=jdbc:h2:mem:testdb
-spring.datasource.username=sa
-spring.datasource.password=
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-prod.properties b/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-prod.properties
deleted file mode 100644
index 6806431..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application-prod.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-spring.datasource.url= jdbc:postgresql://${POSTGRES_HOST:postgresdb}:5432/mydb
-spring.datasource.username=matthias
-spring.datasource.password=password
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application.properties b/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application.properties
deleted file mode 100644
index eaa2173..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/main/resources/application.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-server.port=8080
-
-server.forward-headers-strategy=native
-management.endpoints.web.exposure.include=*
-
-spring.profiles.active=dev
-
-spring.jpa.hibernate.ddl-auto=update
-spring.jpa.show-sql=true
-#spring.jpa.properties.hibernate.format_sql=true
-
-spring.application.name=springboot-backend
-otel.exporter.otlp.endpoint=http://${COLLECTOR_HOST:localhost}:4317
diff --git a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java b/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java
deleted file mode 100755
index b18589d..0000000
--- a/exercises/manual-instrumentation-java/initial/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.novatec.todobackend;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-public class TodobackendApplicationIntegrationTests {
-
- @Test
- void contextLoads() {
- }
-}
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/Dockerfile b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/Dockerfile
deleted file mode 100644
index ba32ead..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/Dockerfile
+++ /dev/null
@@ -1,26 +0,0 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
-WORKDIR /workspace/app
-
-COPY pom.xml .
-COPY src src
-
-RUN --mount=type=cache,target=/root/.m2 mvn install -DskipTests
-# RUN mvn install -DskipTests
-RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
-
-FROM docker.io/eclipse-temurin:21-jdk-alpine
-RUN mkdir -p /opt/todoui
-WORKDIR /opt/todoui
-# RUN addgroup -S demo && adduser -S demo -G demo
-# USER demo
-VOLUME /tmp
-ARG DEPENDENCY=/workspace/app/target/dependency
-COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /opt/todoui/app/lib
-COPY --from=build ${DEPENDENCY}/META-INF /opt/todoui/app/META-INF
-COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /opt/todoui/app
-
-ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.8.0/opentelemetry-javaagent.jar /opt/todoui
-
-ENTRYPOINT ["java","-cp","/opt/todoui/app:/opt/todoui/app/lib/*", "-javaagent:/opt/todoui/opentelemetry-javaagent.jar", "io.novatec.todoui.TodouiApplication"]
-#ENTRYPOINT ["java", "-cp", "/opt/todobackend/app:/opt/todobackend/app/lib/*", "-javaagent:/opt/todobackend/opentelemetry-javaagent.jar","io.novatec.todobackend.TodobackendApplication"]
-
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/pom.xml b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/pom.xml
deleted file mode 100644
index 781505c..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/pom.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
- 4.0.0
-
- io.novatec
- todoui-manual
- 0.0.1-SNAPSHOT
- jar
-
- todoui-manual
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.7.16
-
-
-
-
- UTF-8
- UTF-8
- 17
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- io.opentelemetry
- opentelemetry-api
-
-
- io.opentelemetry
- opentelemetry-sdk
-
-
- io.opentelemetry
- opentelemetry-exporter-logging
-
-
- io.opentelemetry
- opentelemetry-exporter-otlp
-
-
-
- io.opentelemetry.semconv
- opentelemetry-semconv
- 1.26.0-alpha
-
-
-
-
-
-
- io.opentelemetry
- opentelemetry-bom
- 1.40.0
- pom
- import
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/OpenTelemetryConfiguration.java b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/OpenTelemetryConfiguration.java
deleted file mode 100644
index 06582e7..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/OpenTelemetryConfiguration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.novatec.todoui;
-
-import java.util.concurrent.TimeUnit;
-
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
-
-//Basic Otel API & SDK
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.sdk.OpenTelemetrySdk;
-import io.opentelemetry.sdk.resources.Resource;
-import io.opentelemetry.semconv.ResourceAttributes;
-
-//Tracing and Spans
-import io.opentelemetry.sdk.trace.SdkTracerProvider;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-
-import io.opentelemetry.exporter.logging.LoggingSpanExporter;
-import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
-
-import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
-import io.opentelemetry.context.propagation.ContextPropagators;
-
-
-@SuppressWarnings("deprecation")
-@Configuration
-public class OpenTelemetryConfiguration {
-
- @Bean
- @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
- public OpenTelemetry openTelemetry(){
-
- Resource resource = Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, "tododui").put(ResourceAttributes.SERVICE_VERSION, "0.1.0").build();
-
- OtlpGrpcSpanExporter jaegerOtlpExporter =
- OtlpGrpcSpanExporter.builder()
- .setEndpoint("http://localhost:4317")
- .setTimeout(30, TimeUnit.SECONDS)
- .build();
-
- SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
- .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create()))
- .addSpanProcessor(SimpleSpanProcessor.create(jaegerOtlpExporter))
- // .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) // same results for now
- .setResource(resource)
- .build();
- // .buildAndRegisterGlobal();
-
-
- OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
- .setTracerProvider(sdkTracerProvider)
- .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
- .build();
-
- return openTelemetry;
- }
-
-}
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/TodouiApplication.java b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/TodouiApplication.java
deleted file mode 100644
index dd9f5e9..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/java/io/novatec/todoui/TodouiApplication.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package io.novatec.todoui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.client.RestTemplate;
-
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.api.trace.Span;
-import io.opentelemetry.api.trace.SpanKind;
-import io.opentelemetry.api.trace.Tracer;
-import io.opentelemetry.context.Context;
-
-@SpringBootApplication
-@Controller
-public class TodouiApplication {
-
- private Logger logger = LoggerFactory.getLogger(TodouiApplication.class);
-
- private OpenTelemetry openTelemetry;
- private Tracer tracer;
-
- @Value("${backend.url}")
- String endpoint;
- RestTemplate template = new RestTemplate();
-
- public TodouiApplication(OpenTelemetry openTelemetry) {
- this.openTelemetry = openTelemetry;
- tracer = this.openTelemetry.getTracer(TodouiApplication.class.getName(), "0.1.0");
- }
-
- @PostConstruct
- public void postConstruct(){
-
- logger.info(" UI initialized for backend at "+endpoint);
- }
-
- @GetMapping("/stress")
- public String stress(){
-
- logger.info(java.time.LocalDateTime.now() + " : Starting stress");
- double result = 0;
- for (int i = 0; i < 100000000; i++) {
- result += System.currentTimeMillis();
- }
- logger.info(java.time.LocalDateTime.now() + " : Ending stress, result: " + result);
- return "redirect:/";
-
- }
-
- public static List list = new ArrayList<>(); // can never be GC'ed
- @GetMapping("/leak")
- public String leak(){
-
- logger.info(java.time.LocalDateTime.now() + " : Start leaking");
- for (int i = 0; i < 10000000; i++) {
- list.add(Math.random());
- }
- logger.info(java.time.LocalDateTime.now() + " : End leaking");
- return "redirect:/";
-
- }
-
- @GetMapping("/createcookie")
- public String createCookie(HttpServletResponse response) {
-
- Cookie cookie = new Cookie("featureflag", "on");
- cookie.setPath("/");
- response.addCookie(cookie);
- return "redirect:/";
-
- }
-
- @GetMapping("/deletecookie")
- public String deleteCookie(HttpServletResponse response) {
-
- Cookie cookie = new Cookie("featureflag", null);
- cookie.setMaxAge(0);
- cookie.setPath("/");
- response.addCookie(cookie);
- return "redirect:/";
-
- }
-
-
- @GetMapping
- public String getItems(Model model){
-
- logger.info("GET "+ endpoint + "/todos/");
- ResponseEntity response = template.getForEntity(endpoint+"/todos/", String[].class);
- if(response != null) model.addAttribute("items", response.getBody());
- return "items";
-
- }
-
- @PostMapping
- public String addItem(String toDo){
-
- logger.info("POST "+ endpoint + "/todos/"+toDo);
-
- Span span = tracer.spanBuilder("addItem").setSpanKind(SpanKind.CLIENT).startSpan();
-
- Context context = Context.current();
-
- System.out.println("Context: "+context);
- System.out.println("### Hallo");
-
- template.postForEntity(endpoint+"/todos/"+toDo, null, String.class);
-
-
-
- span.end();
-
- return "redirect:/";
-
- }
-
- @PostMapping("{toDo}")
- public String setItemDone(@PathVariable String toDo){
-
- logger.info("POST "+ endpoint + "/todos/"+toDo);
- template.delete(endpoint+"/todos/"+toDo);
- return "redirect:/";
-
- }
-
- public static void main(String[] args) {
- SpringApplication.run(TodouiApplication.class, args);
- }
-}
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/application.properties b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/application.properties
deleted file mode 100644
index dad2d1b..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/application.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-#server port
-server.port=8090
-
-#todobackend config
-backend.host=${BACKEND_HOST:todobackend}
-backend.port=${BACKEND_PORT:8080}
-backend.url=http://${backend.host}:${backend.port}
-
-#actuator
-management.endpoints.web.exposure.include=*
-
-#error handling
-#server.error.include-exception=true
-server.error.include-message=always
-#server.error.include-stacktrace=always
-
-
diff --git a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/templates/items.html b/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/templates/items.html
deleted file mode 100644
index 38668aa..0000000
--- a/exercises/manual-instrumentation-java/initial/todoui-thymeleaf/src/main/resources/templates/items.html
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
- Most beautiful of all Java Todo Lists
-
-
-
-
-
-
-
-
- Most beautiful of all Java Todo Lists
-
-
-
Add a ToDo
-
-
-
-
- Item |
- Action |
-
-
-
-
-
-
-
-
-
-
ToDo List
-
-
-
-
- Item |
- Action |
-
-
-
- |
-
-
- |
-
-
-
-
-
-
-
- Item |
- Action |
-
-
- You have no ToDos :-) |
- None |
-
-
-
-
-
-
-
-
-
diff --git a/exercises/manual-instrumentation-java/solution/.gitignore b/exercises/manual-instrumentation-java/solution/.gitignore
deleted file mode 100644
index 227a53b..0000000
--- a/exercises/manual-instrumentation-java/solution/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-HELP.md
-**target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-*.jar
-
-__pycache__
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
-opentelemetry-javaagent.jar
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/Dockerfile b/exercises/manual-instrumentation-java/solution/todobackend-springboot/Dockerfile
deleted file mode 100644
index bcc02e7..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
-WORKDIR /workspace/app
-
-COPY pom.xml .
-COPY src src
-
-RUN --mount=type=cache,target=/root/.m2 mvn install -DskipTests
-RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
-
-FROM docker.io/eclipse-temurin:21-jdk-alpine
-RUN mkdir -p /opt/todobackend
-WORKDIR /opt/todobackend
-#RUN addgroup -S demo && adduser -S demo -G demo
-#USER demo
-VOLUME /tmp
-ARG DEPENDENCY=/workspace/app/target/dependency
-COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /opt/todobackend/app/lib
-COPY --from=build ${DEPENDENCY}/META-INF /opt/todobackend/app/META-INF
-COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /opt/todobackend/app
-
-ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.8.0/opentelemetry-javaagent.jar /opt/todobackend
-
-ENTRYPOINT ["java", "-cp", "/opt/todobackend/app:/opt/todobackend/app/lib/*", "-javaagent:/opt/todobackend/opentelemetry-javaagent.jar","io.novatec.todobackend.TodobackendApplication"]
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/pom.xml b/exercises/manual-instrumentation-java/solution/todobackend-springboot/pom.xml
deleted file mode 100644
index 12abece..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/pom.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
- 4.0.0
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 3.2.2
-
-
-
- io.novatec
- todobackend-manual-solution
- 0.0.1-SNAPSHOT
- todobackend-manual-solution
- Novatec Demo Application
-
-
- 21
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- com.h2database
- h2
- runtime
-
-
- org.postgresql
- postgresql
- runtime
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- 2.2.0
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
- io.opentelemetry
- opentelemetry-api
-
-
- io.opentelemetry
- opentelemetry-sdk
-
-
- io.opentelemetry
- opentelemetry-exporter-logging
-
-
- io.opentelemetry
- opentelemetry-exporter-otlp
-
-
- io.opentelemetry.semconv
- opentelemetry-semconv
- 1.26.0-alpha
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- todobackend-${version}
-
-
-
-
-
- io.opentelemetry
- opentelemetry-bom
- 1.40.0
- pom
- import
-
-
-
-
-
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/OpenTelemetryConfiguration.java b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/OpenTelemetryConfiguration.java
deleted file mode 100644
index e4026e9..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/OpenTelemetryConfiguration.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package io.novatec.todobackend;
-
-import java.time.Duration;
-
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
-
-//Basic Otel API & SDK
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
-import io.opentelemetry.context.propagation.ContextPropagators;
-import io.opentelemetry.exporter.logging.LoggingMetricExporter;
-import io.opentelemetry.exporter.logging.LoggingSpanExporter;
-import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
-import io.opentelemetry.sdk.OpenTelemetrySdk;
-import io.opentelemetry.sdk.metrics.SdkMeterProvider;
-import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
-import io.opentelemetry.sdk.resources.Resource;
-//Tracing and Spans
-import io.opentelemetry.sdk.trace.SdkTracerProvider;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import io.opentelemetry.semconv.ResourceAttributes;
-
-@SuppressWarnings("deprecation")
-@Configuration
-public class OpenTelemetryConfiguration {
-
- @Bean
- @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
- public OpenTelemetry openTelemetry() {
-
- Resource resource = Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, "todobackend")
- .put(ResourceAttributes.SERVICE_VERSION, "0.1.0").build();
-
- OtlpGrpcSpanExporter jaegerOtlpExporter = OtlpGrpcSpanExporter.builder()
- .setEndpoint("http://localhost:4317")
- .build();
-
- SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
- .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create()))
- .addSpanProcessor(SimpleSpanProcessor.create(jaegerOtlpExporter))
- .setResource(resource)
- .build();
-
- SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
- .registerMetricReader(
- PeriodicMetricReader
- .builder(LoggingMetricExporter.create())
- .setInterval(Duration.ofSeconds(10))
- .build())
- .setResource(resource)
- .build();
-
-
- OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
- .setTracerProvider(sdkTracerProvider)
- .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
- .setMeterProvider(sdkMeterProvider)
- .build();
-
- return openTelemetry;
- }
-
-}
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
deleted file mode 100644
index c51907d..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package io.novatec.todobackend;
-
-import static io.opentelemetry.api.common.AttributeKey.stringKey;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.api.metrics.LongCounter;
-import io.opentelemetry.api.metrics.Meter;
-import io.opentelemetry.api.trace.Span;
-import io.opentelemetry.api.trace.SpanKind;
-import io.opentelemetry.api.trace.StatusCode;
-import io.opentelemetry.api.trace.Tracer;
-import io.opentelemetry.context.Scope;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-@SpringBootApplication
-@RestController
-@CrossOrigin(origins = "*")
-
-public class TodobackendApplication {
-
- private Logger logger = LoggerFactory.getLogger(TodobackendApplication.class);
-
- private OpenTelemetry openTelemetry;
- private Tracer tracer;
- private Meter meter;
- private LongCounter counter;
-
- @Value("${HOSTNAME:not_set}")
- String hostname;
-
- @Value("${spring.profiles.active: none}")
- String profile;
-
- @Autowired
- TodoRepository todoRepository;
-
- public TodobackendApplication(OpenTelemetry openTelemetry) {
- this.openTelemetry = openTelemetry;
- tracer = this.openTelemetry.getTracer(TodobackendApplication.class.getName(), "0.1.0");
- meter = this.openTelemetry.getMeter(TodobackendApplication.class.getName());
-
- counter = meter.counterBuilder("todobackend.requests.counter")
- .setDescription("How many times the GET call has been invoked.")
- .setUnit("requests")
- .build();
-
- }
-
- private String getInstanceId() {
-
- if (!hostname.equals("not_set"))
- return hostname;
- return "probably localhost";
-
- }
-
- @GetMapping("/hello")
- String hello() {
-
- return getInstanceId() + " Hallo, Welt ! ";
-
- }
-
- @GetMapping("/fail")
- String fail() {
-
- System.exit(1);
- return "fixed!";
- }
-
- @GetMapping("/todos/")
- List getTodos() {
-
- List todos = new ArrayList();
-
- todoRepository.findAll().forEach(todo -> todos.add(todo.getTodo()));
- logger.info("GET /todos/ " + todos.toString());
- counter.add(1,Attributes.of(stringKey("http.method"), "GET"));
-
- return todos;
- }
-
- @PostMapping("/todos/{todo}")
- String addTodo(HttpServletRequest request, HttpServletResponse response, @PathVariable String todo) {
-
- logger.info("POST /todos/ " + todo.toString());
-
- Span span = tracer.spanBuilder("addTodo").setSpanKind(SpanKind.SERVER).startSpan();
-
- span.setAttribute("http.method", request.getMethod());
- span.setAttribute("http.url", request.getRequestURL().toString());
- span.setAttribute("client.address", request.getRemoteAddr());
- span.setAttribute("user.agent", request.getHeader("User-Agent"));
-
- try (Scope scope = span.makeCurrent()) {
- this.someInternalMethod(todo);
- response.setStatus(HttpServletResponse.SC_CREATED);
- span.setAttribute("response.status", HttpServletResponse.SC_CREATED);
- } catch (Throwable t) {
- span.setStatus(StatusCode.ERROR, "Error on server side!");
- span.recordException(t);
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- span.setAttribute("response.status", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- } finally {
- span.end();
- }
-
- logger.info("Span.toString():" + span.toString());
- return todo;
-
- }
-
- String someInternalMethod(String todo) {
-
- Span childSpan = tracer.spanBuilder("someInternalMethod").setSpanKind(SpanKind.INTERNAL).startSpan();
-
- todoRepository.save(new Todo(todo));
-
- if (todo.equals("slow")) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- if (todo.equals("fail")) {
-
- System.out.println("Failing ...");
- throw new RuntimeException();
-
- }
-
- logger.info("childSpan.toString():" + childSpan.toString());
- childSpan.end();
- return todo;
-
- }
-
- @DeleteMapping("/todos/{todo}")
- String removeTodo(@PathVariable String todo) {
-
- todoRepository.deleteById(todo);
- logger.info("DELETE /todos/ " + todo.toString());
- return "removed " + todo;
-
- }
-
- public static void main(String[] args) {
- SpringApplication.run(TodobackendApplication.class, args);
- }
-
-}
-
-@Entity
-class Todo {
-
- @Id
- String todo;
-
- public Todo() {
- }
-
- public Todo(String todo) {
- this.todo = todo;
- }
-
- public String getTodo() {
- return todo;
- }
-
- public void setTodo(String todo) {
- this.todo = todo;
- }
-
-}
-
-interface TodoRepository extends CrudRepository {
-
-}
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-dev.properties b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-dev.properties
deleted file mode 100644
index 25d7606..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-dev.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-spring.h2.console.enabled=true
-spring.h2.console.path=/h2
-spring.datasource.url=jdbc:h2:mem:testdb
-spring.datasource.username=sa
-spring.datasource.password=
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-prod.properties b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-prod.properties
deleted file mode 100644
index 6806431..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application-prod.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-spring.datasource.url= jdbc:postgresql://${POSTGRES_HOST:postgresdb}:5432/mydb
-spring.datasource.username=matthias
-spring.datasource.password=password
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application.properties b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application.properties
deleted file mode 100644
index eaa2173..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/main/resources/application.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-server.port=8080
-
-server.forward-headers-strategy=native
-management.endpoints.web.exposure.include=*
-
-spring.profiles.active=dev
-
-spring.jpa.hibernate.ddl-auto=update
-spring.jpa.show-sql=true
-#spring.jpa.properties.hibernate.format_sql=true
-
-spring.application.name=springboot-backend
-otel.exporter.otlp.endpoint=http://${COLLECTOR_HOST:localhost}:4317
diff --git a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java b/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java
deleted file mode 100755
index b18589d..0000000
--- a/exercises/manual-instrumentation-java/solution/todobackend-springboot/src/test/java/io/novatec/todobackend/TodobackendApplicationIntegrationTests.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.novatec.todobackend;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-public class TodobackendApplicationIntegrationTests {
-
- @Test
- void contextLoads() {
- }
-}
\ No newline at end of file
diff --git a/exercises/manual-instrumentation-java/steps b/exercises/manual-instrumentation-java/steps
deleted file mode 100644
index 05f164a..0000000
--- a/exercises/manual-instrumentation-java/steps
+++ /dev/null
@@ -1,156 +0,0 @@
-pom.xml
-
-under project
-
-
-
-
- io.opentelemetry
- opentelemetry-bom
- 1.40.0
- pom
- import
-
-
-
-
-under dependencies
-
-
- io.opentelemetry
- opentelemetry-api
-
-
-mvn clean package - works
-
-More packages
-
-
- io.opentelemetry
- opentelemetry-sdk
-
-
- io.opentelemetry
- opentelemetry-exporter-logging
-
-
-
- io.opentelemetry.semconv
- opentelemetry-semconv
- 1.26.0-alpha
-
-
-
-In Java app:
-
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.api.common.Attributes;
-
-import io.opentelemetry.sdk.OpenTelemetrySdk;
-import io.opentelemetry.sdk.resources.Resource;
-
-import io.opentelemetry.semconv.ResourceAttributes;
-
- @Bean
- public OpenTelemetry openTelemetry(){
-
- Resource resource = Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, "todobackend").put(ResourceAttributes.SERVICE_VERSION, "0.1.0").build();
-
- OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
- .buildAndRegisterGlobal();
-
- return openTelemetry;
- }
-
-
-For Tracing:
-
-import io.opentelemetry.sdk.trace.SdkTracerProvider;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-
-import io.opentelemetry.exporter.logging.LoggingSpanExporter;
-
-import io.opentelemetry.api.trace.Tracer;
-
- @Bean
- public OpenTelemetry openTelemetry(){
-
- Resource resource = Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, "todobackend").put(ResourceAttributes.SERVICE_VERSION, "0.1.0").build();
-
- SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
- .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create()))
- .setResource(resource)
- .build();
-
- OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
- .setTracerProvider(sdkTracerProvider)
- .buildAndRegisterGlobal();
-
- return openTelemetry;
- }
-
-Acquiring a tracer:
-
-Creating spans:
-
-import io.opentelemetry.api.trace.Span;
-import io.opentelemetry.context.Scope;
-
-
-Frontend:
-
-export BACKEND_URL=http://localhost:8080
-export BACKEND_URL=http://localhost:8080
-
-
-Put everything in own Config class:
-
-package io.novatec.todobackend;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-//Basic Otel
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.exporter.logging.LoggingSpanExporter;
-import io.opentelemetry.sdk.OpenTelemetrySdk;
-import io.opentelemetry.sdk.resources.Resource;
-//Tracing and Spans
-import io.opentelemetry.sdk.trace.SdkTracerProvider;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import io.opentelemetry.semconv.ResourceAttributes;
-
-
-@SuppressWarnings("deprecation")
-@Configuration
-public class OpenTelemetryConfiguration {
-
- @Bean
- public OpenTelemetry openTelemetry(){
-
- Resource resource = Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, "todobackend").put(ResourceAttributes.SERVICE_VERSION, "0.1.0").build();
-
- SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
- .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create()))
- .setResource(resource)
- .build();
-
- OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
- .setTracerProvider(sdkTracerProvider)
- .buildAndRegisterGlobal();
-
- return openTelemetry;
- }
-
-}
-
-
-Tracer:
-
- TodobackendApplication(OpenTelemetry openTelemetry) {
- tracer = openTelemetry.getTracer(TodobackendApplication.class.getName(), "0.1.0");
- }
-
-
-Spans:
-
diff --git a/exercises/otel-in-action/docker-compose.yaml b/exercises/otel-in-action/docker-compose.yaml
index ed3565b..39b5579 100644
--- a/exercises/otel-in-action/docker-compose.yaml
+++ b/exercises/otel-in-action/docker-compose.yaml
@@ -14,7 +14,7 @@ services:
- POSTGRES_DB=mydb
todobackend-springboot:
- image: maeddes/todobackend-springboot:v2404
+ image: ghcr.io/lftraining/lfs148-code-todobackend-springboot:v2404
networks:
- todonet
build:
@@ -37,7 +37,7 @@ services:
- postgresdb
todoui-thymeleaf:
- image: maeddes/todoui-thymeleaf:v2404
+ image: ghcr.io/lftraining/lfs148-code-todoui-thymeleaf:v2404
build:
context: ./todoui-thymeleaf
dockerfile: Dockerfile #-multistage
@@ -56,7 +56,7 @@ services:
- OTEL_LOGS_EXPORTER=none
todoui-flask:
- image: maeddes/todoui-flask:v2404
+ image: ghcr.io/lftraining/lfs148-code-todoui-flask:v2404
build:
context: ./todoui-flask
networks:
@@ -70,7 +70,7 @@ services:
- OTEL_METRICS_EXPORTER=otlp
loadgenerator:
- image: maeddes/simple-generator:v2404
+ image: ghcr.io/lftraining/lfs148-code-simple-generator:v2404
build:
context: ./loadgenerator
networks:
diff --git a/exercises/otel-in-action/todobackend-springboot/Dockerfile b/exercises/otel-in-action/todobackend-springboot/Dockerfile
index bcc02e7..5893092 100644
--- a/exercises/otel-in-action/todobackend-springboot/Dockerfile
+++ b/exercises/otel-in-action/todobackend-springboot/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
+FROM docker.io/maven:3-eclipse-temurin-21 AS build
WORKDIR /workspace/app
COPY pom.xml .
diff --git a/exercises/otel-in-action/todobackend-springboot/pom.xml b/exercises/otel-in-action/todobackend-springboot/pom.xml
index 79c0651..35daed3 100644
--- a/exercises/otel-in-action/todobackend-springboot/pom.xml
+++ b/exercises/otel-in-action/todobackend-springboot/pom.xml
@@ -15,7 +15,7 @@
todobackend
0.0.1-SNAPSHOT
todobackend
- Novatec Demo Application
+ Demo Application
21
@@ -53,6 +53,20 @@
org.springframework.boot
spring-boot-starter-test
test
+
+
+ org.mockito
+ mockito-core
+
+
+ net.bytebuddy
+ byte-buddy
+
+
+ net.bytebuddy
+ byte-buddy-agent
+
+
io.opentelemetry.instrumentation
diff --git a/exercises/otel-in-action/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java b/exercises/otel-in-action/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
index a595a0f..34629b5 100644
--- a/exercises/otel-in-action/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
+++ b/exercises/otel-in-action/todobackend-springboot/src/main/java/io/novatec/todobackend/TodobackendApplication.java
@@ -98,13 +98,13 @@ String someInternalMethod(@SpanAttribute String todo){
} catch (InterruptedException e) {
e.printStackTrace();
}
- }
+ }
if(todo.equals("fail")){
System.out.println("Failing ...");
throw new RuntimeException();
-
- }
+
+ }
return todo;
}
diff --git a/exercises/otel-in-action/todoui-thymeleaf/Dockerfile b/exercises/otel-in-action/todoui-thymeleaf/Dockerfile
index ba32ead..be98665 100644
--- a/exercises/otel-in-action/todoui-thymeleaf/Dockerfile
+++ b/exercises/otel-in-action/todoui-thymeleaf/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.io/maven:3-eclipse-temurin-21 as build
+FROM docker.io/maven:3-eclipse-temurin-21 AS build
WORKDIR /workspace/app
COPY pom.xml .
diff --git a/exercises/otel-in-action/todoui-thymeleaf/pom.xml b/exercises/otel-in-action/todoui-thymeleaf/pom.xml
index 3dc4994..34f6abb 100644
--- a/exercises/otel-in-action/todoui-thymeleaf/pom.xml
+++ b/exercises/otel-in-action/todoui-thymeleaf/pom.xml
@@ -42,6 +42,20 @@
org.springframework.boot
spring-boot-starter-test
test
+
+
+ org.mockito
+ mockito-core
+
+
+ net.bytebuddy
+ byte-buddy
+
+
+ net.bytebuddy
+ byte-buddy-agent
+
+
-
+-->
+
-
+