paroscale/PrometheusGoHandler
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
A parser that parses go structures to prometheus exposition format. For now, we only support data models Counter, Gauge and Histogram.
Note : This parsers only parses provide text output, Its responsibilty of the user to start the http service to publish
the text in /metrics.
- Constants Defined
HISTOGRAM
GAUGE
COUNTER
UNTYPE
- Append data to variable of type HandlerStructure
```
addToHandler = append(addToHandler, struct {
MType int
MName string
LabelMap map[string]string
MValue interface{}
}{MType: prometheus_handler.GAUGE, MName: "Field1", MValue: 2, LabelMap: labelMap})
```
To use this library user has to pass the structure defined as per above guidelines and filled with values to following function
func GenericPromDataParser(structure HandlerStructure) string