enhanced-diagnostics-spring-boot-starter

Starter for enhanced diagnostics based on java lib

License

License

MIT
Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.timo-reymann
ArtifactId

ArtifactId

enhanced-diagnostics-spring-boot-starter
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

enhanced-diagnostics-spring-boot-starter
Starter for enhanced diagnostics based on java lib
Project URL

Project URL

https://github.com/timo-reymann/enhanced-diagnostics-spring-boot-starter
Source Code Management

Source Code Management

https://github.com/timo-reymann/enhanced-diagnostics-spring-boot-starter/tree/master

Download enhanced-diagnostics-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.timo-reymann/enhanced-diagnostics-spring-boot-starter/ -->
<dependency>
    <groupId>com.github.timo-reymann</groupId>
    <artifactId>enhanced-diagnostics-spring-boot-starter</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.timo-reymann/enhanced-diagnostics-spring-boot-starter/
implementation 'com.github.timo-reymann:enhanced-diagnostics-spring-boot-starter:2.0.0'
// https://jarcasting.com/artifacts/com.github.timo-reymann/enhanced-diagnostics-spring-boot-starter/
implementation ("com.github.timo-reymann:enhanced-diagnostics-spring-boot-starter:2.0.0")
'com.github.timo-reymann:enhanced-diagnostics-spring-boot-starter:jar:2.0.0'
<dependency org="com.github.timo-reymann" name="enhanced-diagnostics-spring-boot-starter" rev="2.0.0">
  <artifact name="enhanced-diagnostics-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.timo-reymann', module='enhanced-diagnostics-spring-boot-starter', version='2.0.0')
)
libraryDependencies += "com.github.timo-reymann" % "enhanced-diagnostics-spring-boot-starter" % "2.0.0"
[com.github.timo-reymann/enhanced-diagnostics-spring-boot-starter "2.0.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.0.4.RELEASE
com.github.timo-reymann : enhanced-diagnostics-java jar 1.0.0
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.0.4.RELEASE
org.projectlombok : lombok jar 1.16.22
org.bouncycastle : bcpkix-jdk15on jar 1.57

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.0.4.RELEASE

Project Modules

There are no modules declared in this project.

enhanced-diagnostics-spring-boot-starter

Drop-in starter for enhanced-diagnostics starter

Add to your depencies

<dependency>
    <groupId>com.github.timo-reymann</groupId>
    <artifactId>enhanced-diagnostics-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

Usage

Drop in the dependency, and override the default bean, and there you go!

@Bean 
public ReportProcessorBean() {
    return new ReportProcessorBean() {
        @Override
        public void process(Report report) {
            // Process your report, as you like
        }
    };
}

On your frontend you can get the public key via /report/publicKey in pem format.

Frontend example

<script src="https://unpkg.com/[email protected]/dist/main.js"></script>
<script>
    const logger = new DatabaseLogger('db', 1);
    const reporter = new LogReporter(logger);
    
    console.log("This will be transmitted");

    fetch("/report/publicKey", {
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        }
    })
    .then(r => r.json()) // Parse json
    .then(data => { // Get public key
        const key = data.publicKey
        reporter.buildReportChunks(key).then(chunks => { // Submit report
            fetch("/report", {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Accept': 'application/json'
                },
                body: chunks
            })
        })
    });
</script>

Customize

enhanced-diagnostics:
    route-prefix: /customReportPath

Versions

Version
2.0.0
1.0.0
0.0.4
0.0.3
0.0.2