Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Content-Type: application/json
}

> {%
client.global.set("token", response.body.user.token)
client.global.set("token", response.body.user?.token)
%}

###
Expand All @@ -34,7 +34,7 @@ Content-Type: application/json
}

> {%
client.global.set("token", response.body.user.token)
client.global.set("token", response.body.user?.token)
%}

###
Expand All @@ -50,7 +50,7 @@ Content-Type: application/json
}

> {%
client.global.set("token", response.body.user.token)
client.global.set("token", response.body.user?.token)
%}

###
Expand Down Expand Up @@ -117,7 +117,7 @@ Content-Type: application/json
}

> {%
client.global.set("article_slug", response.body.article.slug)
client.global.set("article_slug", response.body.article?.slug)
%}

###
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mapstruct-springAnnotations = { group = "org.mapstruct.extensions.spring", name
mapstruct-springExtensions = { group = "org.mapstruct.extensions.spring", name = "mapstruct-spring-extensions", version.ref = "mapstruct-spring" }
springBootDependencies = { group = "org.springframework.boot", name = "spring-boot-dependencies", version.ref = "springBoot" }
springdoc-openapiStarterWebmvcUi = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version = "3.0.1" }
opentelemetryInstrumentationDependencies = { group = "io.opentelemetry.instrumentation", name = "opentelemetry-instrumentation-bom-alpha", version = "2.24.0-alpha" }

[plugins]
graalvm = { id = "org.graalvm.buildtools.native", version = "0.11.3" }
Expand Down
2 changes: 2 additions & 0 deletions service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ dependencies {
implementation(project(":service-bus"))
implementation(project(":service-api"))

implementation(libs.instrumentation.opentelemetryLogbackAppender10)
implementation(libs.mapstruct.core)
implementation(libs.mapstruct.springAnnotations)
implementation(libs.mapstruct.springExtensions)
implementation(libs.spring.springBootStarterActuator)
implementation(libs.spring.springBootStarterDataJdbc)
implementation(libs.spring.springBootStarterLiquibase)
implementation(libs.spring.springBootStarterOauth2ResourceServer)
implementation(libs.spring.springBootStarterOpentelemetry)
implementation(libs.spring.springBootStarterSecurity)
implementation(libs.spring.springBootStarterValidation)
implementation(libs.spring.springBootStarterWebmvc)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* MIT License
*
* Copyright (c) 2020 - present Alexey Lapin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.al.realworld.infrastructure.config;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class OtelConfig {

@Bean
InstallOpenTelemetryAppender installOpenTelemetryAppender(OpenTelemetry openTelemetry) {
return new InstallOpenTelemetryAppender(openTelemetry);
}

static class InstallOpenTelemetryAppender implements InitializingBean {

private final OpenTelemetry openTelemetry;

InstallOpenTelemetryAppender(OpenTelemetry openTelemetry) {
this.openTelemetry = openTelemetry;
}

@Override
public void afterPropertiesSet() {
OpenTelemetryAppender.install(this.openTelemetry);
}
}

}
11 changes: 11 additions & 0 deletions service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>

<appender name="OTEL" class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender"/>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="OTEL"/>
</root>
</configuration>
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencyResolutionManagement {
versionCatalogs {
generate("libs") {
fromToml("springBootDependencies")
fromToml("opentelemetryInstrumentationDependencies")
}
}
}
Expand Down