Instruction file imported from GrammaTonic/experia-v10-exporter (
.github/instructions/modulestucture.instructions.md). Copyright stays with the author.
Go Module Structure Instructions
Overview
This document provides guidelines for organizing Go code into modules to enhance maintainability, scalability, and clarity. Proper module structure helps in managing dependencies, versioning, and collaboration among developers.
internal layout
The internal/ tree contains packages that are implementation details of this repository. Keep packages small and focused. The layout below reflects how the collector code is split by responsibility. For each directory we add a one-line example of what's included to help contributors find the right place for new code.
-
internal/collector — core collector logic for talking to the Experia V10 and exposing Prometheus metrics.
- Example:
collector.goimplements the Prometheus Collector interface and coordinates API calls.
- Example:
-
internal/collector/services — service-specific API clients and callers.
nmc/— NMC service helpers- Example:
getwanstatus.goimplements thegetWANStatuscall and returns a parsed model.
- Example:
nemo/— NeMo service helpers- Example:
getmibs.go(callsgetMIBs) andgetnetdevstats.go(callsgetNetDevStats).
- Example:
-
internal/collector/metrics — Prometheus metric definitions and helpers.
nmc/— metrics related to NMC responses- Example:
metrics_getwanstatus.goregisters and updates WAN-related metrics.
- Example:
nemo/— metrics related to NeMo responses- Example:
metrics_getmibs.go,metrics_getnetdevstats.go.
- Example:
helpers.go— shared helpers for metric creation and label handling.
-
internal/collector/parser — response parsers that convert raw API payloads into typed models.
nemo/- Example:
parse_mibs.goandparse_netdevstats.gotransform HTTP responses into Go structs.
- Example:
nmc/- Example:
parse_wanstatus.goparses thegetWANStatusresponse.
- Example:
-
internal/collector/models — shared data models used across services, parsers, and metrics.
- Example:
models.gocontains structs that represent API responses and normalized internal types.
- Example:
-
internal/collector/connectivity — HTTP client, authentication and fetch helpers.
- Example:
client.goconfigures the HTTP client,auth.goholds login/session logic, andfetch.goexposes helpers to perform authenticated requests.
- Example: