From 3033d2d0fc2470a18aac603cee7ee5e17c93823d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 17:48:04 +0200 Subject: [PATCH 1/7] feat(observability): add NotificationMetrics for email/SMS/push delivery tracking - firefly.notifications.sent, firefly.notifications.delivery.duration, firefly.notifications.errors, firefly.notifications.templates.rendered - Tagged by channel (email/sms/push) and provider (sendgrid/twilio/firebase/resend/...) - Auto-configured in notifications-core; adapters inherit transitively --- .../observability/NotificationMetrics.java | 60 +++++++++++++++++++ ...icationObservabilityAutoConfiguration.java | 43 +++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + 3 files changed, 104 insertions(+) create mode 100644 fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationMetrics.java create mode 100644 fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationObservabilityAutoConfiguration.java create mode 100644 fireflyframework-notifications-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationMetrics.java b/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationMetrics.java new file mode 100644 index 0000000..b7a3fe2 --- /dev/null +++ b/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationMetrics.java @@ -0,0 +1,60 @@ +/* + * Copyright 2024-2026 Firefly Software Foundation + * + * 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.fireflyframework.notifications.observability; + +import io.micrometer.core.instrument.MeterRegistry; +import org.fireflyframework.observability.metrics.FireflyMetricsSupport; +import reactor.core.publisher.Mono; + +/** + * Shared observability instrumentation for the Notifications module. + *

+ * Records: + *

+ */ +public class NotificationMetrics extends FireflyMetricsSupport { + + private static final String TAG_CHANNEL = "channel"; + private static final String TAG_PROVIDER = "provider"; + private static final String TAG_TEMPLATE = "template"; + + public NotificationMetrics(MeterRegistry meterRegistry) { + super(meterRegistry, "notifications"); + } + + /** + * Wraps a notification dispatch operation with a timer and success/failure counters. + */ + public Mono timedDispatch(String channel, String provider, Mono dispatch) { + return timed("delivery.duration", dispatch, TAG_CHANNEL, channel, TAG_PROVIDER, provider) + .doOnSuccess(v -> recordSuccess("sent", TAG_CHANNEL, channel, TAG_PROVIDER, provider)) + .doOnError(e -> { + recordFailure("sent", e, TAG_CHANNEL, channel, TAG_PROVIDER, provider); + recordFailure("errors", e, TAG_CHANNEL, channel, TAG_PROVIDER, provider); + }); + } + + public void recordTemplateRendered(String template) { + counter("templates.rendered", TAG_TEMPLATE, template).increment(); + } +} diff --git a/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationObservabilityAutoConfiguration.java b/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationObservabilityAutoConfiguration.java new file mode 100644 index 0000000..3599eba --- /dev/null +++ b/fireflyframework-notifications-core/src/main/java/org/fireflyframework/notifications/observability/NotificationObservabilityAutoConfiguration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2024-2026 Firefly Software Foundation + * + * 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.fireflyframework.notifications.observability; + +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; + +/** + * Auto-configures {@link NotificationMetrics} as a Spring bean for use by every + * notifications adapter (email, SMS, push, etc.). + */ +@AutoConfiguration +@ConditionalOnClass(MeterRegistry.class) +@ConditionalOnProperty(prefix = "firefly.observability.metrics", name = "enabled", + havingValue = "true", matchIfMissing = true) +public class NotificationObservabilityAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + @ConditionalOnBean(MeterRegistry.class) + NotificationMetrics notificationMetrics(MeterRegistry meterRegistry) { + return new NotificationMetrics(meterRegistry); + } +} diff --git a/fireflyframework-notifications-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/fireflyframework-notifications-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..0785f8c --- /dev/null +++ b/fireflyframework-notifications-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.fireflyframework.notifications.observability.NotificationObservabilityAutoConfiguration From bca3094dd3fb168e241ddd6b424c4d16337e0432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 17:57:08 +0200 Subject: [PATCH 2/7] release: bump version to 26.05.01 --- fireflyframework-notifications-core/pom.xml | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fireflyframework-notifications-core/pom.xml b/fireflyframework-notifications-core/pom.xml index ff90fa6..70303e7 100644 --- a/fireflyframework-notifications-core/pom.xml +++ b/fireflyframework-notifications-core/pom.xml @@ -7,7 +7,7 @@ org.fireflyframework fireflyframework-notifications - 26.04.01 + 26.05.01 ../pom.xml diff --git a/pom.xml b/pom.xml index 59bff1e..9d080c9 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,13 @@ org.fireflyframework fireflyframework-parent - 26.04.01 + 26.05.01 org.fireflyframework fireflyframework-notifications - 26.04.01 + 26.05.01 pom Firefly Framework - Notifications Library From 72483ec9382f1f3133d9d1ca7f41f11f6be88e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 18:17:46 +0200 Subject: [PATCH 3/7] release: bump version to 26.05.06 --- fireflyframework-notifications-core/pom.xml | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fireflyframework-notifications-core/pom.xml b/fireflyframework-notifications-core/pom.xml index 70303e7..765ef5b 100644 --- a/fireflyframework-notifications-core/pom.xml +++ b/fireflyframework-notifications-core/pom.xml @@ -7,7 +7,7 @@ org.fireflyframework fireflyframework-notifications - 26.05.01 + 26.05.06 ../pom.xml diff --git a/pom.xml b/pom.xml index 9d080c9..2d4a829 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,13 @@ org.fireflyframework fireflyframework-parent - 26.05.01 + 26.05.06 org.fireflyframework fireflyframework-notifications - 26.05.01 + 26.05.06 pom Firefly Framework - Notifications Library From b1242dc03596b815637ef415c1c463c8af0e4e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 19:00:07 +0200 Subject: [PATCH 4/7] ci: re-trigger after layer 2 publish From 27816fde057a6cdc98634c538334fa95c5a5b006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 19:29:44 +0200 Subject: [PATCH 5/7] ci: re-trigger after layer 4 deps published From 2a80eb1f8bd4681cf06d4b35424c5a76cda89b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 19:35:58 +0200 Subject: [PATCH 6/7] ci: re-trigger after starter-core publish From 3de241efc2ad3b2570318884f391509353d89d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Contreras=20Guill=C3=A9n?= Date: Tue, 19 May 2026 19:36:05 +0200 Subject: [PATCH 7/7] ci: re-trigger after starter-core publish