...

Package gendoc

import "github.com/hyperledger/fabric/common/metrics/gendoc"
Overview
Index

Overview ▾

func FileOptions

func FileOptions(f *ast.File) ([]interface{}, error)

FileOptions walks the specified ast.File for options structs used when creating metrics and returns instances that are recreated from the source.

func Options

func Options(pkgs []*packages.Package) ([]interface{}, error)

Options scans the provided list of packages for options structs used when creating metrics and returns instances that are recreated from the source tree.

type Cell

type Cell struct {
    // contains filtered or unexported fields
}

func (Cell) BucketFormat

func (c Cell) BucketFormat() string

func (Cell) Description

func (c Cell) Description() string

func (Cell) Field

func (c Cell) Field(f Field) string

func (Cell) Labels

func (c Cell) Labels() string

func (Cell) Name

func (c Cell) Name() string

func (Cell) Type

func (c Cell) Type() string

type Cells

type Cells []Cell

func NewCells

func NewCells(options []interface{}) (Cells, error)

NewCells transforms metrics options to cells that can be used for doc generation.

func (Cells) Len

func (c Cells) Len() int

func (Cells) Less

func (c Cells) Less(i, j int) bool

func (Cells) MaxLen

func (c Cells) MaxLen(f Field) int

func (Cells) Swap

func (c Cells) Swap(i, j int)

type Column

A Column represents a column of data in the reference table.

type Column struct {
    Field Field
    Name  string
    Width int
}

type Field

A Field represents data that is included in the reference table for metrics.

type Field uint8
const (
    Name        Field = iota // Name is the meter name.
    Type                     // Type is the type of meter option.
    Description              // Description is the help text from the meter option.
    Labels                   // Labels is the meter's label information.
    Bucket                   // Bucket is the statsd bucket format
)

type Table

A Table maintains the cells and columns used to generate the restructured text formatted reference documentation.

type Table struct {
    Columns []Column
    Cells   Cells
}

func NewPrometheusTable

func NewPrometheusTable(cells Cells) Table

NewPrometheusTable creates a table that can be used to document Prometheus metrics maintained by Fabric.

func NewStatsdTable

func NewStatsdTable(cells Cells) Table

NewStatsdTable creates a table that can be used to document StatsD metrics maintained by Fabric.

func (Table) Generate

func (t Table) Generate(w io.Writer)

Generate generates a restructured text formatted table from the cells and columns contained in the table.