project-writing-go-modules-framework-v2

Implement and migrate Netdata Go collectors using the framework V2 architecture and patterns.

80.4k|6.6k|Updated Jun 17, 2013
One-click install
npx skills add https://github.com/netdata/netdata --skill project-writing-go-modules-framework-v2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: project-writing-go-modules-framework-v2
Source: https://github.com/netdata/netdata/tree/main/.agents/skills/project-writing-go-modules-framework-v2
Command: npx skills add https://github.com/netdata/netdata --skill project-writing-go-modules-framework-v2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexity of migrating or creating Go-based collectors for Netdata, ensuring they adhere to the modern V2 framework requirements, performance standards, and maintainability guidelines.

Core Features & Use Cases

  • V2 Collector Implementation: Provides patterns for CollectorV2 registration, metrix.CollectorStore usage, and lifecycle management.
  • Chart & Metric Standardization: Guides the creation of stable, versioned chart templates and efficient metric emission using charts.yaml and metrix instruments.
  • Use Case: When migrating a legacy V1 collector, use this Skill to ensure the new implementation correctly handles host scopes, vnodes, and lifecycle methods without introducing runtime regressions.

Quick Start

Use the project-writing-go-modules-framework-v2 skill to validate my current Go collector implementation against the V2 framework requirements.

Frequently Asked Questions about project-writing-go-modules-framework-v2

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

FAQPage Schema
How do I migrate a V1 collector to the V2 framework?

Start by reviewing the migration guide at src/go/plugin/go.d/docs/migrate-v1-to-v2.md. Ensure the new collector implements CollectorV2, uses metrix.CollectorStore for metric emission, and removes all legacy V1 map-to-metrix bridges.

What is the recommended way to define charts in V2?

Use embedded charts.yaml files for static templates or the charttpl package for dynamic runtime templates. Ensure chart IDs and contexts remain stable to preserve historical data continuity.

How should I handle host scopes and virtual nodes?

Use metrix.HostScope for remote or virtual-node targets. Ensure ScopeKey and GUID values are deterministic and stable, and follow the vnode registry guidelines to avoid metric collisions.

When should I use InstancePolicySingle?

Use InstancePolicySingle only for collectors that are strictly one canonical job per agent. Ensure the configuration name matches the module name after defaults are applied.

Why does my collector fail to register metrics?

Metric registration fails if a name is re-registered with a conflicting contract within the retention window. Ensure your collector uses stable metric names and handles descriptor retention correctly.