1 /*
2 * Copyright (c) 2023 Kaiserpfalz EDV-Service, Roland T. Lichti
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 package de.kaiserpfalzedv.commons.spring.observability;
19
20
21 import org.springframework.context.annotation.Bean;
22 import org.springframework.context.annotation.Configuration;
23
24 import io.micrometer.core.aop.CountedAspect;
25 import io.micrometer.core.aop.TimedAspect;
26 import io.micrometer.core.instrument.MeterRegistry;
27
28 /**
29 * Provides the timed and the counted aspect for observabilities.
30 *
31 * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>}
32 * @version 4.0.0 2024-09-22
33 * @since 1.0.0 2023-12-10
34 */
35 @Configuration
36 public class MetricsAnnotationsConfiguration {
37 @Bean
38 public TimedAspect timedAspect(final MeterRegistry registry) {
39 return new TimedAspect(registry);
40 }
41
42 @Bean
43 public CountedAspect countedAspect(final MeterRegistry registry) {
44 return new CountedAspect(registry);
45 }
46 }