Skip to content

bug: when adding a metric, if the function fails, the error is swallowed and a "metric type '%d' not existed" error returned  #34

Open
@zamedic

Description

@zamedic

For example:

package main

import (
	"fmt"

	"github.com/penglongli/gin-metrics/ginmetrics"
)

func main() {
	err := ginmetrics.GetMonitor().AddMetric(&ginmetrics.Metric{
		Name: "test",
		Type: ginmetrics.Histogram,
	})
	fmt.Println(err)
}

returns

metric type '3' not existed.

when it should return

metric 'test' is histogram type, cannot lose bucket param.

if err := f(metric); err == nil {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions