github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/service/metrics/noop/reporter.go (about)

     1  // Licensed under the Apache License, Version 2.0 (the "License");
     2  // you may not use this file except in compliance with the License.
     3  // You may obtain a copy of the License at
     4  //
     5  //     https://www.apache.org/licenses/LICENSE-2.0
     6  //
     7  // Unless required by applicable law or agreed to in writing, software
     8  // distributed under the License is distributed on an "AS IS" BASIS,
     9  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    10  // See the License for the specific language governing permissions and
    11  // limitations under the License.
    12  //
    13  // Original source: github.com/tickoalcantara12/micro/v3/metrics/noop/reporter.go
    14  
    15  package noop
    16  
    17  import (
    18  	"time"
    19  
    20  	"github.com/tickoalcantara12/micro/v3/service/metrics"
    21  )
    22  
    23  // Reporter is an implementation of metrics.Reporter:
    24  type Reporter struct {
    25  	options metrics.Options
    26  }
    27  
    28  // New returns a configured noop reporter:
    29  func New(opts ...metrics.Option) *Reporter {
    30  	return &Reporter{
    31  		options: metrics.NewOptions(opts...),
    32  	}
    33  }
    34  
    35  // Count implements the metrics.Reporter interface Count method:
    36  func (r *Reporter) Count(metricName string, value int64, tags metrics.Tags) error {
    37  	return nil
    38  }
    39  
    40  // Gauge implements the metrics.Reporter interface Gauge method:
    41  func (r *Reporter) Gauge(metricName string, value float64, tags metrics.Tags) error {
    42  	return nil
    43  }
    44  
    45  // Timing implements the metrics.Reporter interface Timing method:
    46  func (r *Reporter) Timing(metricName string, value time.Duration, tags metrics.Tags) error {
    47  	return nil
    48  }