Adding a Metric

Add or modify microservice metrics in service.yaml with go generate.

172|5|Updated Sep 9, 2022
One-click install
npx skills add https://github.com/microbus-io/fabric --skill adding-a-metric
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Adding a Metric
Source: https://github.com/microbus-io/fabric/tree/main/.claude/skills/microbus/add-metric
Command: npx skills add https://github.com/microbus-io/fabric --skill adding-a-metric

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineering teams create or modify custom metrics for microservices to gain visibility into runtime behavior and performance, reducing guesswork and enabling data-driven decisions.

Core Features & Use Cases

  • Metric definition & boilerplate generation: Define a metric in the service.yaml and generate the related boilerplate code.
  • Runtime instrumentation: Record metric values from service logic to monitor throughput, latency, and error rates.
  • Use Case: When you need to track a customer operation, like processing batches or cache hits, across a microservice to understand bottlenecks and reliability.

Quick Start

Define a new metric in your microservice's service.yaml, run go generate to produce the boilerplate, implement the setter (e.g., AddMyMetric) and optional callback, then observe metrics in your monitoring stack.

Frequently Asked Questions about Adding a Metric

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a custom metric to a microservice and generate boilerplate code?

To add a custom microservice metric, you define it in service.yaml and run go generate to produce the boilerplate. You then wire metric setters into your service code to record runtime values.

What is the process for instrumenting microservice code to track runtime behavior?

Microservice instrumentation involves defining a metric in service.yaml, generating boilerplate with go generate, and implementing setter logic in the service code. You can also integrate optional callbacks to observe values just-in-time.

Does this metric generation workflow enforce histogram buckets and metric signatures?

Yes, the workflow enforces metric signature rules and configures histogram buckets when used. This ensures your custom observability metrics maintain consistent definitions across the generated boilerplate and service code.

Can I use callbacks to observe microservice metric values just-in-time?

Yes, you can integrate optional callbacks to observe metric values just-in-time. This allows you to dynamically track microservice runtime performance and behavior within your service logic without manual polling.

When should I modify a microservice metric in service.yaml?

You should modify a microservice metric in service.yaml when you need to gain visibility into new runtime behaviors, tune observability workflows, or track operations like cache hits to understand bottlenecks.