Skip to content

Commit

Permalink
#9 Added OTLP configuration and updated configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
openwms committed Jan 30, 2025
1 parent 8b1f1ee commit c8e26bc
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 32 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/branch-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: 'branch_build'
on:
push:
branches-ignore: [ master, release ]
branches-ignore:
- master
- gh-pages
- 'release/**'

env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Build
run: >
./mvnw clean verify
./mvnw verify
-Dci.buildNumber=$GITHUB_RUN_NUMBER
-U -B $MAVEN_OPTS
- name: Build Image
Expand Down
22 changes: 18 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openwms</groupId>
<artifactId>org.openwms.parent</artifactId>
<version>27</version>
<relativePath />
<version>27.1</version>
<relativePath/>
</parent>
<artifactId>org.openwms.gateway</artifactId>
<version>2.1.0-SNAPSHOT</version>
<name>OpenWMS.org CORE: Gateway</name>
<description>An API Gateway that serves as a central entry point into the whole microservice network</description>
<url>https://github.com/spring-labs/${project.artifactId}</url>
<url>https://spring-labs.github.io/${project.artifactId}/index.html</url>

<issueManagement>
<system>GitHub</system>
Expand Down Expand Up @@ -170,11 +172,23 @@
</dependency>

<!-- Observability: Monitoring -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-micrometer</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>

<!-- 3rd party dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openwms.gateway.app;

import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* A ApiGatewayOtlpConfiguration.
*
* @author Heiko Scherrer
*/
@ConditionalOnClass(name = "io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter")
@AutoConfiguration
public class ApiGatewayOtlpConfiguration {

@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(name = "io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter")
public static class OtelConfiguration {
@ConditionalOnClass(name = "io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter")
public @Bean OtlpGrpcSpanExporter otlpHttpSpanExporter(@Value("${owms.tracing.url}") String url) {
return OtlpGrpcSpanExporter.builder().setEndpoint(url).build();
}
}
}
42 changes: 30 additions & 12 deletions src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ spring:
user:
name: user
password: sa
zipkin:
sender:
type: web
output:
ansi:
enabled: always

owms:
eureka:
Expand All @@ -42,13 +42,16 @@ owms:
hostname: localhost
protocol: http
tenant: master
tracing:
url: http://localhost:4317

server:
port: ${PORT:8086}

eureka:
client:
instance-info-replication-interval-seconds: 10 # default is 30
registryFetchIntervalSeconds: 5 # SBA
service-url:
defaultZone: ${owms.eureka.zone} # Must be camelCase
instance:
Expand All @@ -63,11 +66,16 @@ eureka:
# Default: 30s
lease-renewal-interval-in-seconds: 2
metadata-map:
group: CORE
config-protocol: http # The protocol used to access the config server
username: ${spring.security.user.name}
password: ${spring.security.user.password}
protocol: ${owms.srv.protocol}
startup: ${random.int} # SBA
zone: ${owms.eureka.zone}
prometheus.scrape: "true"
prometheus.path: "/actuator/prometheus"
prometheus.port: ${server.port}
non-secure-port-enabled: true
prefer-ip-address: true
secure-port-enabled: false
Expand All @@ -92,18 +100,28 @@ management:
health:
rabbit:
enabled: false
metrics:
web:
server:
request:
autotime:
enabled: true
export:
prometheus:
enabled: true
info:
git:
mode: simple
metrics:
distribution:
percentiles-histogram:
greeting: true
http:
server:
requests: true
tags:
application: ${spring.application.name}
otlp:
tracing:
endpoint: ${owms.tracing.url}
prometheus:
metrics:
export:
enabled: true
tracing:
sampling:
probability: 1.0

---
spring:
Expand Down
51 changes: 37 additions & 14 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@
<property name="MODULE_NAME" value="CORE-Gateway" />
<property name="SERVICE_NAME" value="GATEWAY" />

<include resource="logback-appenders.xml" />
<include resource="logback-loggers.xml" />
<include resource="logback-appenders.xml"/>
<include resource="logback-loggers.xml"/>

<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

<logger name="com.github.dozermapper" level="ERROR" />
<logger name="com.netflix.discovery" level="OFF"/>
<logger name="org.ameba" level="WARN"/>
<logger name="org.ameba.oauth2" level="DEBUG"/>
<logger name="org.hibernate.boot.internal.InFlightMetadataCollectorImpl" level="ERROR"/>
<logger name="org.hibernate.SQL" level="OFF" />
<logger name="org.hibernate.SQL" level="OFF"/>
<logger name="org.hibernate.SQL_SLOW" level="OFF"/>
<logger name="org.hibernate.type" level="OFF" />
<logger name="org.springframework" level="WARN" />
<logger name="org.openwms" level="DEBUG" />
<logger name="BOOT" level="DEBUG" />
<logger name="org.hibernate.type" level="OFF"/>
<logger name="org.springframework" level="WARN"/>
<logger name="org.openwms" level="DEBUG"/>
<logger name="BOOT" level="DEBUG"/>

<logger name="CORE_INTEGRATION_MESSAGING" level="INFO"/>

Expand All @@ -33,13 +32,37 @@
<destination>elk:5000</destination>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<logger name="PRESENTATION_LAYER_EXCEPTION" level="ERROR"/>
<logger name="SERVICE_LAYER_EXCEPTION" level="ERROR"/>
<logger name="INTEGRATION_LAYER_EXCEPTION" level="ERROR"/>
<logger name="CALLCONTEXT" level="OFF"/>
<logger name="MEASURED" level="INFO"/>
<logger name="PRESENTATION_LAYER_EXCEPTION" level="ERROR">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ELK"/>
<appender-ref ref="EXCFILE"/>
</logger>
<logger name="SERVICE_LAYER_EXCEPTION" level="ERROR">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ELK"/>
<appender-ref ref="EXCFILE"/>
</logger>
<logger name="INTEGRATION_LAYER_EXCEPTION" level="ERROR">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ELK"/>
<appender-ref ref="EXCFILE"/>
</logger>
<logger name="CALLCONTEXT" level="DEBUG" additivity="true">
</logger>
<logger name="PRESENTATION_LAYER_ACCESS" level="INFO" additivity="true">
</logger>
<logger name="SERVICE_LAYER_ACCESS" level="INFO" additivity="true">
</logger>
<logger name="INTEGRATION_LAYER_ACCESS" level="INFO" additivity="true">
</logger>
<logger name="MEASURED" level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ELK"/>
<appender-ref ref="TSL"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="LOGFILE"/> <!-- Required for export -->
<appender-ref ref="ELK"/>
</root>
</springProfile>
Expand All @@ -65,7 +88,7 @@
<appender-ref ref="TSL"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="STDOUT"/>
<appender-ref ref="LOGFILE"/>
</root>
</springProfile>
Expand Down

0 comments on commit c8e26bc

Please sign in to comment.