Skip to content

Commit

Permalink
Add Splunk HEC error counter to all quarkus projects
Browse files Browse the repository at this point in the history
  • Loading branch information
awood committed Sep 30, 2024
1 parent b127ebd commit 5dc9040
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ config/export-service/tmp
.settings
/**/bin/*
!bin/import-events.py
!bin/import-features.sh
!bin/liquibase-new-changeset.sh
!bin/build-images.sh
!bin/insert-mock-hosts
.vscode
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ include ':swatch-common-health'
include ':swatch-common-resteasy-client'
include ':swatch-common-panache'
include ':swatch-common-smallrye-fault-tolerance'
include ':swatch-common-splunk'
include ':swatch-common-platform-spring-boot'
include ':swatch-common-platform-quarkus'
include ':swatch-common-clock'
Expand Down
1 change: 1 addition & 0 deletions swatch-billable-usage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
implementation project(':swatch-common-kafka')
implementation project(':swatch-common-smallrye-fault-tolerance')
implementation project(':swatch-common-trace-response')
implementation project(':swatch-common-splunk')
implementation libraries["clowder-quarkus-config-source"]
implementation libraries["quarkus-logging-splunk"]
implementation libraries["splunk-library-javalogging"]
Expand Down
12 changes: 12 additions & 0 deletions swatch-common-splunk/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id 'swatch.java-library-conventions'
}

dependencies {
implementation enforcedPlatform(libraries["quarkus-bom"])
implementation "io.micrometer:micrometer-core"
implementation libraries["quarkus-logging-splunk"]
implementation libraries["splunk-library-javalogging"]
}

description = 'Shared Splunk classes for swatch services'
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* granted to use or replicate Red Hat trademarks that are incorporated
* in this software or its documentation.
*/
package com.redhat.swatch.aws.splunk;
package com.redhat.swatch.splunk;

import com.splunk.logging.HttpEventCollectorErrorHandler;
import com.splunk.logging.HttpEventCollectorErrorHandler.ErrorCallback;
import com.splunk.logging.HttpEventCollectorEventInfo;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.quarkiverse.logging.splunk.SplunkErrorCallback;
import io.quarkus.runtime.StartupEvent;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
Expand All @@ -47,7 +48,7 @@ public CountingSplunkErrorCallback(MeterRegistry meterRegistry) {
// prints the formatted error to stderr, so we'll delegate invocations of our ErrorCallback
// to the default callback so that it can handle creating a human-readable record of the
// issue.
this.delegatedCallback = new QuarkusHecErrorCallback();
this.delegatedCallback = new SplunkErrorCallback();
this.failureCounter = meterRegistry.counter("splunk.hec.message.failure.total");
}

Expand Down
1 change: 1 addition & 0 deletions swatch-contracts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation project(':swatch-common-resteasy')
implementation project(':swatch-common-panache')
implementation project(':swatch-common-smallrye-fault-tolerance')
implementation project(':swatch-common-splunk')
implementation project(':clients:quarkus:rbac-client')
implementation project(':clients:quarkus:product-client')
implementation project(':swatch-product-configuration')
Expand Down
1 change: 1 addition & 0 deletions swatch-metrics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation project(':swatch-common-config-workaround')
implementation project(':swatch-common-resteasy')
implementation project(':swatch-common-clock')
implementation project(':swatch-common-splunk')
implementation project(':swatch-model-events')
implementation project(':clients:quarkus:prometheus-client')
implementation project(':swatch-common-trace-response')
Expand Down
3 changes: 1 addition & 2 deletions swatch-producer-aws/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ dependencies {
implementation 'software.amazon.awssdk:marketplacemetering'
implementation 'software.amazon.awssdk:sts'
implementation libraries["clowder-quarkus-config-source"]
implementation libraries["quarkus-logging-splunk"]
implementation libraries["splunk-library-javalogging"]
implementation project(":clients:quarkus:contracts-client")
implementation project(":swatch-model-billable-usage")
implementation project(":swatch-common-resteasy")
Expand All @@ -29,6 +27,7 @@ dependencies {
implementation project(":swatch-common-resteasy-client")
implementation project(':swatch-common-trace-response')
implementation project(':swatch-common-smallrye-fault-tolerance')
implementation project(':swatch-common-splunk')
testImplementation 'io.rest-assured:rest-assured'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.testcontainers:junit-jupiter'
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions swatch-producer-azure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation project(':swatch-product-configuration')
implementation project(':swatch-common-kafka')
implementation project(':swatch-common-resteasy-client')
implementation project(':swatch-common-splunk')
implementation project(":clients:azure-marketplace-client")
implementation project(':swatch-model-billable-usage')
implementation project(':swatch-common-trace-response')
Expand Down

0 comments on commit 5dc9040

Please sign in to comment.