func (m *Metric) ConvertToJSON() (string, error) {
	data, err := json.Marshal(&m)
	if err != nil {
		return "", err
	}
	return string(data), nil
}
ConvertToJSON convert object to json
package model
import (
	"encoding/json"
	"strconv"
	"github.com/prometheus/client_golang/prometheus"
)
const (
	COUNTER string = "counter"
	GAUGE string = "gauge"
	HISTOGRAM string = "histogram"
	SUMMARY string = "summary"
)
type Metric struct {
	Type    string            `json:"type"`
	Name    string            `json:"name"`
	Help    string            `json:"help"`
	Method  string            `json:"method"`
	Value   string            `json:"value"`
	Labels  prometheus.Labels `json:"labels"`
	Buckets []float64         `json:"buckets"`
}
func (m *Metric) LoadFromJSON(data []byte) (bool, error) {
	err := json.Unmarshal(data, &m)
	if err != nil {
		return false, err
	}
	return true, nil
}