docs(dcgm): add comprehensive package-level documentation and improve godoc#113
Open
cluster2600 wants to merge 1 commit intoNVIDIA:mainfrom
Open
docs(dcgm): add comprehensive package-level documentation and improve godoc#113cluster2600 wants to merge 1 commit intoNVIDIA:mainfrom
cluster2600 wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Add pkg/dcgm/doc.go with a full package-level documentation comment that covers the package purpose, all three Init modes, field watching workflow, GPU group management, health checks, policy violation monitoring, diagnostics, thread-safety guarantees, and resource management patterns. The package currently had a one-line comment scattered between two files (diag.go and hostengine_status.go) with no usage examples. This made it difficult for new users to discover the correct initialisation sequence or understand how the various subsystems relate to each other. Additional changes: - Remove the stray '// Package dcgm ...' line from diag.go (mid-file, not at the package declaration) which confused godoc parsers. - Remove the duplicate package comment from hostengine_status.go now that doc.go is the canonical location. - Expand the godoc for WatchFieldsWithGroupEx to document all three parameters (updateFreq, maxKeepAge, maxKeepSamples) and their units. - Expand the godoc for WatchFieldsWithGroup to document the default parameter values and include a complete runnable example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pkg/dcgm/doc.gowith a comprehensive package-level documentation commentdiag.go(mid-file, not at the package declaration) that confused godoc parsershostengine_status.goWatchFieldsWithGroupExto document all three parameters and their unitsWatchFieldsWithGroupwith default parameter values and a complete runnable exampleWhy
The package currently has no
doc.goand the only package-level comment is a single line spread across two files (diag.goandhostengine_status.go). There are no usage examples in the package documentation, which makes it difficult for new users to:Initmodes)Without this documentation the entry point for learning the package is the
samples/directory, which is not linked frompkg/go.devand requires reading multiple source files.How
New
pkg/dcgm/doc.gocovers:Initmodes (Embedded,Standalone,StartHostengine) with examplesRunDiag)diag.go: Remove the// Package dcgm ...line at line 14 (inside the file body, after the import block). Go's godoc tool ignores package comments that are not immediately above thepackagekeyword, but having them in the middle of a file is confusing and was creating noise in editors.hostengine_status.go: Remove the duplicate// Package dcgm ...comment now thatdoc.gois the canonical package doc location. Go uses the first package comment it finds; multiple comments in different files produce unpredictable output.fields.go:WatchFieldsWithGroupEx: add parameter descriptions with units (microseconds forupdateFreq, seconds formaxKeepAge)WatchFieldsWithGroup: add the concrete default values (30 s, unlimited age, 1 sample) and a copy-paste-ready exampleTesting
go vet ./...passes (requires CGo toolchain; the package comment changes have no runtime effect)go doc ./pkg/dcgmnow renders the full package overviewgrep -rn "Package dcgm" pkg/dcgm/Checklist
doc.gofollow patterns already established insamples/go buildcompatible (doc.go contains only a package comment and thepackage dcgmdeclaration)