View Javadoc
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.core.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   *
30   * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>}
31   * @version 1.0.0
32   * @since 2023-12-10
33   */
34  @Configuration
35  public class MetricsAnnotationsConfiguration {
36      @Bean
37      public TimedAspect timedAspect(final MeterRegistry registry) {
38          return new TimedAspect(registry);
39      }
40  
41      @Bean
42      public CountedAspect countedAspect(final MeterRegistry registry) {
43          return new CountedAspect(registry);
44      }
45  }