-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [OS-292] fix database transaction error (#467)
- Loading branch information
Showing
31 changed files
with
584 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
backend/src/main/java/net/es/oscars/app/otel/RestTemplateConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package net.es.oscars.app.otel; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetry; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.web.client.RestTemplateCustomizer; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@Configuration | ||
@Slf4j | ||
public class RestTemplateConfig { | ||
final | ||
OpenTelemetry openTelemetry; | ||
|
||
public RestTemplateConfig(OpenTelemetry openTelemetry) { | ||
this.openTelemetry = openTelemetry; | ||
} | ||
|
||
@Bean | ||
public CustomRestTemplateCustomizer customRestTemplateCustomizer() { | ||
return new CustomRestTemplateCustomizer(); | ||
} | ||
|
||
public class CustomRestTemplateCustomizer implements RestTemplateCustomizer { | ||
@Override | ||
public void customize(RestTemplate restTemplate) { | ||
log.info("adding otel to rest template"); | ||
SpringWebTelemetry telemetry = SpringWebTelemetry.create(openTelemetry); | ||
restTemplate.getInterceptors().add(telemetry.newInterceptor()); | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.