001package io.prometheus.client.spring.boot;
002
003import org.springframework.context.annotation.Import;
004
005import java.lang.annotation.Documented;
006import java.lang.annotation.ElementType;
007import java.lang.annotation.Retention;
008import java.lang.annotation.RetentionPolicy;
009import java.lang.annotation.Target;
010
011/**
012 * Enable an endpoint that exposes Prometheus metrics from its default collector.
013 * <p>
014 * Usage:
015 * <br>Just add this annotation to the main class of your Spring Boot application, e.g.:
016 * <pre><code>
017 * {@literal @}SpringBootApplication
018 * {@literal @}EnablePrometheusEndpoint
019 *  public class Application {
020 *
021 *    public static void main(String[] args) {
022 *      SpringApplication.run(Application.class, args);
023 *    }
024 *  }
025 * </code></pre>
026 * <p>
027 * Configuration:
028 * <br>You can customize this endpoint at runtime using the following spring properties:
029 * <ul>
030 * <li>{@code endpoints.prometheus.id} (default: "prometheus")</li>
031 * <li>{@code endpoints.prometheus.enabled} (default: {@code true})</li>
032 * <li>{@code endpoints.prometheus.sensitive} (default: {@code true})</li>
033 * </ul>
034 *
035 * @author Marco Aust
036 * @author Eliezio Oliveira
037 */
038@Target(ElementType.TYPE)
039@Retention(RetentionPolicy.RUNTIME)
040@Documented
041@Import(PrometheusEndpointConfiguration.class)
042public @interface EnablePrometheusEndpoint {
043
044}