guicedee-metrics

Application metrics for GuicedEE using Vert.x 5 Dropwizard Metrics and MicroProfile Metrics 5.1: @Counted, @Timed, @MetricMethod annotations, Guice AOP interceptors, Prometheus scrape endpoint, Graphite reporting, JMX exposure, @MetricsOptions configuration, environment variable overrides, and Vert.x built-in metrics (event bus, HTTP, pools). Use when adding application metrics, configuring Prometheus endpoints, creating custom counters/timers, or monitoring Vert.x internals.

5 stars

Best use case

guicedee-metrics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Application metrics for GuicedEE using Vert.x 5 Dropwizard Metrics and MicroProfile Metrics 5.1: @Counted, @Timed, @MetricMethod annotations, Guice AOP interceptors, Prometheus scrape endpoint, Graphite reporting, JMX exposure, @MetricsOptions configuration, environment variable overrides, and Vert.x built-in metrics (event bus, HTTP, pools). Use when adding application metrics, configuring Prometheus endpoints, creating custom counters/timers, or monitoring Vert.x internals.

Teams using guicedee-metrics should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/guicedee-metrics/SKILL.md --create-dirs "https://raw.githubusercontent.com/GuicedEE/ai-rules/main/skills/.system/guicedee-metrics/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/guicedee-metrics/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How guicedee-metrics Compares

Feature / Agentguicedee-metricsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Application metrics for GuicedEE using Vert.x 5 Dropwizard Metrics and MicroProfile Metrics 5.1: @Counted, @Timed, @MetricMethod annotations, Guice AOP interceptors, Prometheus scrape endpoint, Graphite reporting, JMX exposure, @MetricsOptions configuration, environment variable overrides, and Vert.x built-in metrics (event bus, HTTP, pools). Use when adding application metrics, configuring Prometheus endpoints, creating custom counters/timers, or monitoring Vert.x internals.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# GuicedEE Metrics

Production-ready application metrics using Vert.x 5 Dropwizard Metrics and the MicroProfile Metrics 5.1 API.

## Core Concept

Annotate your methods with standard `@Counted`, `@Timed`, and custom `@MetricMethod` — interceptors are bound through Guice AOP, metrics are collected into a shared `MetricRegistry`, and a Prometheus-compatible scrape endpoint is exposed on the Vert.x Web `Router` automatically.

## Required Flow

1. Add `com.guicedee:metrics` dependency.
2. Configure metrics with `@MetricsOptions`:
   ```java
   @MetricsOptions(
       enabled = true,
       jmxEnabled = true,
       baseName = "my-app",
       prometheus = @MetricsOptions.PrometheusOptions(enabled = true, endpoint = "/metrics")
   )
   public class MyAppConfig {}
   ```
3. Annotate methods. `@Counted`/`@Timed` are the **MicroProfile Metrics** annotations from `org.eclipse.microprofile.metrics.annotation` (packaged in the `com.codahale.metrics` JPMS module, not `com.guicedee.metrics`):
   ```java
   import org.eclipse.microprofile.metrics.annotation.Counted;
   import org.eclipse.microprofile.metrics.annotation.Timed;

   // absolute = true → use the name verbatim (no declaring-class prefix)
   @Counted(name = "orders_placed_total", absolute = true, description = "Orders placed")
   @Timed(name = "order_processing_seconds", absolute = true, description = "Order processing time")
   public void placeOrder(Order order) { ... }
   ```
4. Configure `module-info.java`. The MicroProfile annotations require `com.codahale.metrics`:
   ```java
   module my.app {
       requires com.guicedee.metrics;   // configurators + Prometheus /metrics endpoint
       requires com.codahale.metrics;   // @Counted / @Timed annotations + MetricRegistry
       opens my.app.services to com.google.guice;
   }
   ```
5. Bootstrap GuicedEE — metrics start automatically:
   ```java
   IGuiceContext.registerModuleForScanning.add("my.app");
   IGuiceContext.instance().inject();
   // GET /metrics returns Prometheus exposition format
   ```

## Metric Annotations

### `@Counted`
Increments a monotonic counter each invocation. Place on method or class (applies to all methods).

### `@Timed`
Measures execution time with quantile snapshots (p50, p75, p95, p98, p99, p999).

### `@MetricMethod`
Custom GuicedEE annotation. Increments a named counter. If the method returns a numeric type, the counter value is returned instead.

## Configuration

### `@MetricsOptions` annotation

| Attribute | Purpose |
|---|---|
| `enabled` | Enable/disable metrics |
| `registryName` | Dropwizard registry name |
| `jmxEnabled` | Expose as JMX MBeans |
| `baseName` | Metric name prefix |
| `monitoredHttpServerUris` | URI patterns to monitor |
| `monitoredEventBusHandlers` | EventBus handler patterns |
| `graphite` | `@GraphiteOptions` for Graphite reporting |
| `prometheus` | `@PrometheusOptions` for Prometheus endpoint |

### Environment variable overrides
Every `@MetricsOptions` attribute can be overridden via system properties or environment variables.

## Startup Flow

```
IGuiceContext.instance().inject()
 └─ MetricsPreStartup (scans for @MetricsOptions)
 └─ MetricsVertxConfigurator (configures DropwizardMetricsOptions on VertxBuilder)
 └─ MetricsModule (binds MetricRegistry, interceptors, reporters)
 └─ PrometheusMetricsConfigurator (registers GET /metrics handler)
```

## Non-Negotiable Constraints

- Module must `requires com.guicedee.metrics;`.
- To use `@Counted`/`@Timed`, also `requires com.codahale.metrics;` (that module supplies the MicroProfile annotations **and** the `MetricRegistry`).
- Intercepted classes must be in packages opened to `com.google.guice`.
- Interception only fires on **Guice-managed instances** (`IGuiceContext.get(...)` / injected) — calling `new MyResource()` bypasses the AOP interceptors.
- The metrics module is registered automatically — no `provides` needed.
- Guice AOP requires non-final, non-private methods for interception.

## Testing

The shared `MetricRegistry` is injectable, so metrics can be asserted directly without scraping `/metrics`. Boot the context, resolve the **Guice-managed** bean (so AOP fires), invoke it, then read the registry:

```java
@BeforeAll
static void boot() {
    IGuiceContext.registerModule("my.app");
    IGuiceContext.instance().inject();
}

@Test
void metricsAreRecorded() {
    MyResource resource = IGuiceContext.get(MyResource.class); // managed → interceptors fire
    for (int i = 0; i < 3; i++) resource.placeOrder(order);

    MetricRegistry registry = IGuiceContext.get(MetricRegistry.class);

    // Names carry suffixes/tags in the registry — match by substring
    Counter counter = registry.getCounters().entrySet().stream()
        .filter(e -> e.getKey().contains("orders_placed_total"))
        .map(Map.Entry::getValue).findFirst().orElseThrow();
    assertTrue(counter.getCount() >= 3);

    Timer timer = registry.getTimers().entrySet().stream()
        .filter(e -> e.getKey().contains("order_processing_seconds"))
        .map(Map.Entry::getValue).findFirst().orElseThrow();
    assertTrue(timer.getCount() >= 3);
}
```

Test `module-info.java` needs `requires com.codahale.metrics;` (for `MetricRegistry`/`Counter`/`Timer`) and access to the metered class.

Related Skills

guicedee-websockets

5
from GuicedEE/ai-rules

RFC 6455 WebSocket support for GuicedEE using Vert.x 5: call-scoped connections, action-based message routing via IWebSocketMessageReceiver SPI, group management and broadcasting, WebSocketServerOptions, and lifecycle hooks. Use when adding WebSocket messaging, implementing real-time communication, managing WebSocket groups, or creating message receivers.

guicedee-webservices

5
from GuicedEE/ai-rules

SOAP web services for GuicedEE using Apache CXF conventions: JAX-WS annotations (@WebService, @WebMethod, @WebParam, @WebResult), code-first and WSDL-first approaches, endpoint publishing, CXF interceptors and logging, MTOM, WS-Security (WSS4J), SOAP 1.1/1.2 bindings, and Guice DI integration. Use when creating SOAP services, publishing JAX-WS endpoints, configuring CXF bindings, or adding WS-Security.

guicedee-web

5
from GuicedEE/ai-rules

Bootstrap reactive HTTP/HTTPS servers with Vert.x 5 inside GuicedEE: Router setup, BodyHandler configuration, TLS/HTTPS, SPI extension points (VertxRouterConfigurator, VertxHttpServerOptionsConfigurator, VertxHttpServerConfigurator), per-verticle sub-routers, and environment-driven configuration. Use when setting up the Vert.x web server, configuring HTTP/HTTPS, adding custom routes or middleware, or managing server options.

guicedee-vertx

5
from GuicedEE/ai-rules

Build reactive services using Vert.x 5 inside the GuicedEE DI lifecycle: event-bus consumers, publishers, verticle deployment, codecs, throttling, clustering, SPI hooks, and JPMS module setup. Use when adding Vert.x event-bus messaging, deploying verticles, wiring reactive endpoints with Guice injection, configuring Vert.x runtime options, or implementing custom codecs and cluster managers.

guicedee-service-registry

5
from GuicedEE/ai-rules

Named service registry with health-aware resolution for GuicedEE. Register services by simple name, auto-construct URLs from cloud DNS suffix, monitor health status, resolve services via registry:name prefix or bare name in rest-client @Endpoint. Supports aliases, multiple external URLs, Kubernetes internal URLs, and per-service health paths. Use when registering named services, checking service health, resolving service URLs by name, or integrating with rest-client for service-to-service calls.

guicedee-rest

5
from GuicedEE/ai-rules

Build Jakarta REST (JAX-RS) services on Vert.x 5 inside GuicedEE: @Path/@GET/@POST route registration, parameter binding (@PathParam, @QueryParam, @HeaderParam, etc.), Guice-managed resource classes, response handling, content negotiation, and JPMS module setup. Use when creating REST endpoints, configuring Jakarta REST resources, or wiring JAX-RS services with Guice injection.

guicedee-rest-client

5
from GuicedEE/ai-rules

Annotation-driven REST client for GuicedEE using Vert.x 5 WebClient: @Endpoint declarations, RestClient<Send, Receive> injection, authentication strategies (Bearer, Basic, API Key, OAuth2, mTLS), path parameters, environment variable overrides, package-level endpoints, service registry integration (bare name or registry: prefix), and RestClientConfigurator SPI. Use when making outbound REST calls, configuring REST client endpoints, or wiring reactive HTTP clients with Guice injection.

guicedee-rabbitmq

5
from GuicedEE/ai-rules

Annotation-driven RabbitMQ integration for GuicedEE with Vert.x 5: @RabbitConnectionOptions, @QueueExchange, @QueueDefinition, QueueConsumer/QueuePublisher injection, exchange management, queue options (priority, TTL, prefetch), publisher confirms, environment variable overrides, and verticle-scoped connections. Use when adding RabbitMQ messaging, declaring exchanges and queues, creating consumers and publishers, or configuring AMQP topology.

guicedee-persistence

5
from GuicedEE/ai-rules

Reactive JPA persistence with Hibernate Reactive 7, Vert.x 5 SQL clients, and Mutiny sessions inside GuicedEE: DatabaseModule setup, persistence.xml configuration, multi-database support, @EntityManager scoping, and environment variable resolution. Use when adding database persistence, configuring Hibernate Reactive, creating DatabaseModule subclasses, wiring Mutiny.SessionFactory, or managing multiple persistence units.

guicedee-openapi

5
from GuicedEE/ai-rules

Automatic OpenAPI 3.1 spec generation and serving for GuicedEE with Vert.x 5: scans Jakarta REST resources at startup, serves /openapi.json and /openapi.yaml endpoints, Swagger annotations support, @OpenAPIDefinition configuration, and companion Swagger UI module. Use when generating API documentation, serving OpenAPI specs, or configuring Swagger annotations on REST resources.

guicedee-mail-client

5
from GuicedEE/ai-rules

Annotation-driven SMTP mail client for GuicedEE with Vert.x 5: @MailConnectionOptions for SMTP server configuration, MailService injection for sending text/HTML/multipart emails with attachments, connection pooling, StartTLS/SSL support, DKIM signing, environment variable overrides, and graceful shutdown. Use when sending emails via SMTP, configuring mail connections, or injecting mail services.

guicedee-kafka

5
from GuicedEE/ai-rules

Annotation-driven Kafka integration for GuicedEE with Vert.x 5: @KafkaConnectionOptions, @KafkaTopicDefinition, @KafkaTopicCreate, KafkaTopicConsumer/KafkaTopicPublisher injection, KafkaAdminClient binding, per-topic consumers, manual offset commit, worker thread support, partition assignment and revocation handlers, environment variable overrides, call-scoped message handling, and graceful shutdown. Use when adding Kafka messaging, declaring topic consumers and publishers, creating topics via admin client, or configuring Kafka connections.