Last active
February 17, 2023 11:16
-
-
Save Phury/86045f4de05f70fd7b4608e14ddf38c4 to your computer and use it in GitHub Desktop.
Configure observability at smals
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
// configure with spring | |
@Configuration | |
public class MetricsContractConfiguration { | |
@Bean | |
public MetricContractManager sepiaMetricContractManager(MetricContractManager metricContractManager) { | |
metricContractManager.addContract("dss_signature_sign", "docType", "signType", "responseCode", "errorType", "callOrigin", "enterpriseNumber", "signProfile"); | |
metricContractManager.addContract("dss_signature_timestamp"); | |
return metricContractManager; | |
} | |
@Bean | |
public MetricsService metricsService(@Autowired BusinessMetricManager businessMetricManager) { | |
return new MetricsServiceAdapter("dss_signature_sign", businessMetricManager); | |
} | |
} |
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
// configure the metrics | |
metricContractManager.addContract("dss_signature_sign", "docType", "signType", "responseCode", "errorType", "callOrigin", "enterpriseNumber", "signProfile"); | |
metricContractManager.addContract("dss_signature_timestamp"); | |
// add a new value to a metric | |
businessMetricManager.addTagToRecordingMetric(metricName, tag, value); | |
businessMetricManager.stopRecordingAndEmitMetricFor(metricName); | |
// capture the metrics | |
@Observe(name = "dss_signature_sign", isEmitProcessingTimeMetric = true, isStopObserveWhenException = false) |
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
<dependency> | |
<groupId>be.smals.axess</groupId> | |
<artifactId>axess-tools.business-observability</artifactId> | |
<version>0.0.6</version> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment