Repository: honeycombio/honeycomb-kubernetes-agent
Pull request #229 (2022-02-20 05:25:17)

Unify logging, fix log verbosity
- Simplifies and standardizes logging across the entire agent. Everything uses the static logrus logger, instead of creating multiple instances.
- Will now properly respect `verbosity` config setting 
- also fixes setting `version.VERSION` in build flags
- reclassifies some debug log statements as trace level

This is the first PR as a prelude to fix retry logic. While trying to fix it, I realized logging was inconsistent and not at the levels I would configure for the agent. The vast majority of the changes here are mundane changes to reference the static `logrus` logger instead of an instance once passed in. Going this route ensures we can set all logging settings on startup and everything will respect it.




Patch:
diff --git a/.ko.yaml b/.ko.yaml
index 9dd4a17..43c20f3 100644
--- a/.ko.yaml
+++ b/.ko.yaml
@@ -6,4 +6,4 @@ builds:
   - id: honeycomb-kubernetes-agent
     main: .
     ldflags:
-      - -X honeycomb-kubernetes-agent/version.VERSION={{.Env.VERSION}}
+      - -X github.com/honeycombio/honeycomb-kubernetes-agent/version.VERSION={{.Env.VERSION}}
diff --git a/handlers/handlers.go b/handlers/handlers.go
index 6a23145..996b08d 100644
--- a/handlers/handlers.go
+++ b/handlers/handlers.go
@@ -114,6 +114,6 @@ func (h *LineHandlerImpl) Handle(rawLine string) {
 			return
 		}
 	}
-	logrus.WithField("parsed", event).Debug("Sending line")
+	logrus.WithField("parsed", event).Trace("Sending line")
 	h.transmitter.Send(event)
 }
diff --git a/main.go b/main.go
index f9f3411..d476369 100644
--- a/main.go
+++ b/main.go
@@ -42,16 +42,11 @@ type CmdLineOptions struct {
 	Validate   bool   `long:"validate" description:"Validate configuration and exit"`
 }
 
-var (
-	VERSION string
-)
-
 func init() {
 	// set the version string to our desired format
 	// version.VERSION is the importPath.name ld flag specified by build.sh
 	if version.VERSION == "" {
 		version.VERSION = "dev"
-
 	}
 	// init libhoney user agent properly
 	libhoney.UserAgentAddition = fmt.Sprintf("kubernetes/" + version.VERSION)
@@ -81,8 +76,14 @@ func main() {
 		logrus.Info("Configured split logging. trace, debug, info, and warn levels will now go to stdout")
 	}
 
-	if cfg.Verbosity == "debug" {
-		logrus.SetLevel(logrus.DebugLevel)
+	if cfg.Verbosity != "" {
+		level, err := logrus.ParseLevel(cfg.Verbosity)
+		if err == nil {
+			logrus.WithFields(logrus.Fields{
+				"newLevel": level.String(),
+			}).Info("Setting log verbosity")
+			logrus.SetLevel(level)
+		}
 	}
 
 	// Read write key from environment if not specified in config file.
@@ -230,9 +231,7 @@ func startMetricsService(config *config.MetricsConfig) error {
 			builder.AddField(k, v)
 		}
 
-		logger := logrus.StandardLogger()
-
-		svc, err := service.NewMetricsService(config, builder, logger, kubeClient)
+		svc, err := service.NewMetricsService(config, builder, kubeClient)
 		if err != nil {
 			return err
 		}
diff --git a/metrics/accumulator.go b/metrics/accumulator.go
index 7fc36b6..9dde373 100644
--- a/metrics/accumulator.go
+++ b/metrics/accumulator.go
@@ -30,13 +30,12 @@ type MetricDataAccumulator struct {
 	metadata              *Metadata
 	metricGroupsToCollect map[MetricGroup]bool
 	time                  time.Time
-	logger                *logrus.Logger
 }
 
 func (a *MetricDataAccumulator) nodeStats(nodeResource *Resource, s stats.NodeStats) {
-	a.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"name": nodeResource.Name,
-	}).Debug("nodeStats")
+	}).Trace("nodeStats")
 
 	if !a.metricGroupsToCollect[NodeMetricGroup] {
 		return
@@ -53,9 +52,9 @@ func (a *MetricDataAccumulator) nodeStats(nodeResource *Resource, s stats.NodeSt
 }
 
 func (a *MetricDataAccumulator) podStats(podResource *Resource, s stats.PodStats) {
-	a.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"name": podResource.Name,
-	}).Debug("podStats")
+	}).Trace("podStats")
 
 	if !a.metricGroupsToCollect[PodMetricGroup] {
 		return
@@ -72,10 +71,10 @@ func (a *MetricDataAccumulator) podStats(podResource *Resource, s stats.PodStats
 }
 
 func (a *MetricDataAccumulator) containerStats(podResource *Resource, s stats.ContainerStats) {
-	a.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"podName": podResource.Name,
 		"name":    s.Name,
-	}).Debug("containerStats")
+	}).Trace("containerStats")
 
 	if !a.metricGroupsToCollect[ContainerMetricGroup] {
 		return
@@ -88,7 +87,7 @@ func (a *MetricDataAccumulator) containerStats(podResource *Resource, s stats.Co
 	resource, err := getContainerResource(podResource, s)
 
 	if err != nil {
-		a.logger.WithFields(logrus.Fields{
+		logrus.WithFields(logrus.Fields{
 			"pod":       podResource.Labels[LabelPodName],
 			"container": podResource.Labels[LabelContainerName],
 		}).Warn("failed to fetch container metrics")
@@ -105,10 +104,10 @@ func (a *MetricDataAccumulator) containerStats(podResource *Resource, s stats.Co
 }
 
 func (a *MetricDataAccumulator) volumeStats(podResource *Resource, s stats.VolumeStats) {
-	a.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"podName": podResource.Name,
 		"name":    s.Name,
-	}).Debug("volumeStats")
+	}).Trace("volumeStats")
 
 	if !a.metricGroupsToCollect[VolumeMetricGroup] {
 		return
diff --git a/metrics/metadata.go b/metrics/metadata.go
index 542911f..ac453b6 100644
--- a/metrics/metadata.go
+++ b/metrics/metadata.go
@@ -16,16 +16,14 @@ type Metadata struct {
 	NodesMetadata     *v1.NodeList
 	OmitLabels        []OmitLabel
 	IncludeNodeLabels bool
-	logger            *logrus.Logger
 }
 
-func NewMetadata(podsMetadata *v1.PodList, nodesMetadata *v1.NodeList, omitLabels []OmitLabel, includeNodeLabels bool, logger *logrus.Logger) *Metadata {
+func NewMetadata(podsMetadata *v1.PodList, nodesMetadata *v1.NodeList, omitLabels []OmitLabel, includeNodeLabels bool) *Metadata {
 	return &Metadata{
 		PodsMetadata:      podsMetadata,
 		NodesMetadata:     nodesMetadata,
 		OmitLabels:        omitLabels,
 		IncludeNodeLabels: includeNodeLabels,
-		logger:            logger,
 	}
 }
 
@@ -36,7 +34,7 @@ func (m *Metadata) GetNodeMetadataByName(name string) (*NodeMetadata, error) {
 		}
 	}
 
-	m.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"nodeName": name,
 	}).Error("Metadata: Node not found")
 	return &NodeMetadata{}, errors.New("node not found")
@@ -49,7 +47,7 @@ func (m *Metadata) GetPodMetadataByUid(uid types.UID) (*PodMetadata, error) {
 		}
 	}
 
-	m.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"podUid": uid,
 	}).Error("Metadata: Pod not found")
 	return &PodMetadata{}, errors.New("pod not found")
@@ -173,7 +171,7 @@ func (p *PodMetadata) GetStatusForContainer(name string) map[string]interface{}
 		}
 	}
 	if s.ContainerID == "" {
-		p.Metadata.logger.WithFields(logrus.Fields{
+		logrus.WithFields(logrus.Fields{
 			"podName":       p.Pod.Name,
 			"containerName": name,
 		}).Error("Metadata: Container not found")
diff --git a/metrics/processor.go b/metrics/processor.go
index 634e893..8959331 100644
--- a/metrics/processor.go
+++ b/metrics/processor.go
@@ -1,8 +1,6 @@
 package metrics
 
 import (
-	"github.com/sirupsen/logrus"
-
 	"time"
 
 	stats "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
@@ -10,15 +8,13 @@ import (
 
 type Processor struct {
 	counterCache *Cache
-	logger       *logrus.Logger
 }
 
-func NewMetricsProcessor(fetchInterval time.Duration, logger *logrus.Logger) *Processor {
+func NewMetricsProcessor(fetchInterval time.Duration) *Processor {
 	timeout := fetchInterval * (5 + 1)
 	cache := NewCache(timeout)
 	return &Processor{
 		counterCache: cache,
-		logger:       logger,
 	}
 
 }
@@ -30,7 +26,6 @@ func (p *Processor) GenerateMetricsData(summary *stats.Summary, metadata *Metada
 		metricGroupsToCollect: metricGroupsToCollect,
 		mp:                    p,
 		time:                  time.Now(),
-		logger:                p.logger,
 	}
 
 	nodeResource := getNodeResource(summary.Node, metadata)
diff --git a/service/runnable.go b/service/runnable.go
index 6db6fdb..497d1e3 100644
--- a/service/runnable.go
+++ b/service/runnable.go
@@ -33,11 +33,10 @@ type runnable struct {
 	includeNodeLabels bool
 
 	metricGroupsToCollect map[metrics.MetricGroup]bool
-	logger                *logrus.Logger
 	apiClient             corev1.NodesGetter
 }
 
-func newRunnable(rc kubelet.RestClient, builder *libhoney.Builder, opt Options, logger *logrus.Logger, client *corev1.CoreV1Client) *runnable {
+func newRunnable(rc kubelet.RestClient, builder *libhoney.Builder, opt Options, client *corev1.CoreV1Client) *runnable {
 	return &runnable{
 		interval:              opt.Interval,
 		k8sClusterName:        opt.ClusterName,
@@ -46,20 +45,19 @@ func newRunnable(rc kubelet.RestClient, builder *libhoney.Builder, opt Options,
 		omitLabels:            opt.OmitLabels,
 		includeNodeLabels:     opt.IncludeNodeLabels,
 		metricGroupsToCollect: opt.MetricGroupsToCollect,
-		logger:                logger,
 		apiClient:             client,
 	}
 }
 
 // Sets up the kubelet connection at startup time.
 func (r *runnable) Setup() error {
-	r.logger.Info("Creating Metrics Service Providers...")
+	logrus.Info("Creating Metrics Service Providers...")
 
 	r.statsProvider = kubelet.NewStatsProvider(r.restClient)
 	r.metadataProvider = kubelet.NewMetadataProvider(r.restClient)
-	r.metricsProvider = metrics.NewMetricsProcessor(r.interval, r.logger)
+	r.metricsProvider = metrics.NewMetricsProcessor(r.interval)
 
-	r.logger.Debug("Metrics Service Providers created")
+	logrus.Debug("Metrics Service Providers created")
 	return nil
 }
 
@@ -71,7 +69,7 @@ func (r *runnable) Run() error {
 		logrus.WithError(err).Error("Could not retrieve stats")
 		return nil
 	}
-	r.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"podCount": len(summary.Pods),
 	}).Debug("Retrieved Stats")
 
@@ -79,10 +77,10 @@ func (r *runnable) Run() error {
 	var podsMetadata *v1.PodList
 	podsMetadata, err = r.metadataProvider.Pods()
 	if err != nil {
-		r.logger.WithError(err).Error("Could not retrieve pod metadata")
+		logrus.WithError(err).Error("Could not retrieve pod metadata")
 		return nil
 	}
-	r.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"podCount": len(podsMetadata.Items),
 	}).Debug("Retrieved Pod Metadata")
 
@@ -91,18 +89,18 @@ func (r *runnable) Run() error {
 	if r.includeNodeLabels {
 		nodesMetadata, err = r.apiClient.Nodes().List(context.TODO(), metav1.ListOptions{})
 		if err != nil {
-			r.logger.WithError(err).Error("Could not retrieve node metadata")
+			logrus.WithError(err).Error("Could not retrieve node metadata")
 			return nil
 		}
-		r.logger.WithFields(logrus.Fields{
+		logrus.WithFields(logrus.Fields{
 			"nodeCount": len(nodesMetadata.Items),
 		}).Debug("Retrieved Node Metadata")
 	}
 
 	// Get resource metrics
-	metadata := metrics.NewMetadata(podsMetadata, nodesMetadata, r.omitLabels, r.includeNodeLabels, r.logger)
+	metadata := metrics.NewMetadata(podsMetadata, nodesMetadata, r.omitLabels, r.includeNodeLabels)
 	resourceMetrics := r.metricsProvider.GenerateMetricsData(summary, metadata, r.metricGroupsToCollect)
-	r.logger.WithFields(logrus.Fields{
+	logrus.WithFields(logrus.Fields{
 		"resourceCount": len(resourceMetrics),
 	}).Debug("Processing Metrics Data...")
 
@@ -112,14 +110,14 @@ func (r *runnable) Run() error {
 		// create event from Resource meta
 		ev, err := r.createEventFromResource(rm.Resource)
 		if err != nil {
-			r.logger.WithFields(logrus.Fields{
+			logrus.WithFields(logrus.Fields{
 				"resourceType": rm.Resource.Type,
 				"resourceName": rm.Resource.Name,
 			}).WithError(err).Error("Could not create event for resource")
 			continue
 		}
 
-		r.logger.WithFields(logrus.Fields{
+		logrus.WithFields(logrus.Fields{
 			"resourceType": rm.Resource.Type,
 			"resourceName": rm.Resource.Name,
 		}).Trace("Creating event for resource")
@@ -128,7 +126,7 @@ func (r *runnable) Run() error {
 
 		// loop through all metrics to add them to resource event
 		for k, v := range rm.Metrics {
-			r.logger.WithFields(logrus.Fields{
+			logrus.WithFields(logrus.Fields{
 				"resourceType": rm.Resource.Type,
 				"resourceName": rm.Resource.Name,
 				"metricName":   k,
@@ -146,7 +144,7 @@ func (r *runnable) Run() error {
 			ev.AddField(pre+k, val)
 		}
 
-		r.logger.WithFields(logrus.Fields{
+		logrus.WithFields(logrus.Fields{
 			"resourceType": rm.Resource.Type,
 			"resourceName": rm.Resource.Name,
 			"metricCount":  len(rm.Metrics),
@@ -154,7 +152,7 @@ func (r *runnable) Run() error {
 
 		// send resource event to Honeycomb
 		if err = ev.Send(); err != nil {
-			r.logger.WithFields(logrus.Fields{
+			logrus.WithFields(logrus.Fields{
 				"resourceType": rm.Resource.Type,
 				"resourceName": rm.Resource.Name,
 				"metricCount":  len(rm.Metrics),
diff --git a/service/service.go b/service/service.go
index 481e081..eb3c31a 100644
--- a/service/service.go
+++ b/service/service.go
@@ -32,7 +32,6 @@ type Service struct {
 	runner     *interval.Runner
 	options    Options
 	builder    *libhoney.Builder
-	logger     *logrus.Logger
 	client     *corev1.CoreV1Client
 }
 
@@ -44,7 +43,7 @@ type Options struct {
 	MetricGroupsToCollect map[metrics.MetricGroup]bool
 }
 
-func NewMetricsService(cfg *config.MetricsConfig, builder *libhoney.Builder, logger *logrus.Logger, client *corev1.CoreV1Client) (*Service, error) {
+func NewMetricsService(cfg *config.MetricsConfig, builder *libhoney.Builder, client *corev1.CoreV1Client) (*Service, error) {
 
 	if cfg.Endpoint == "" {
 		// Not all Managed K8s offerings allow the nodename to be DNS reachable, try by IP if available.
@@ -55,7 +54,7 @@ func NewMetricsService(cfg *config.MetricsConfig, builder *libhoney.Builder, log
 		}
 	}
 
-	rc, err := createRestClient(cfg, logger)
+	rc, err := createRestClient(cfg)
 	if err != nil {
 		return nil, err
 	}
@@ -83,28 +82,27 @@ func NewMetricsService(cfg *config.MetricsConfig, builder *libhoney.Builder, log
 		restClient: rc,
 		options:    *opt,
 		builder:    builder,
-		logger:     logger,
 		client:     client,
 	}, nil
 }
 
-func createRestClient(cfg *config.MetricsConfig, logger *logrus.Logger) (kubelet.RestClient, error) {
-	logger.WithFields(logrus.Fields{
+func createRestClient(cfg *config.MetricsConfig) (kubelet.RestClient, error) {
+	logrus.WithFields(logrus.Fields{
 		"endpoint": cfg.Endpoint,
 	}).Debug("Creating REST Client...")
 
 	clientProvider, err := kubelet.NewClientProvider(cfg.Endpoint)
 	if err != nil {
-		logger.Error("Could not create Client Provider: ", err)
+		logrus.Error("Could not create Client Provider: ", err)
 		return nil, err
 	}
 	client, err := clientProvider.BuildClient()
 	if err != nil {
-		logger.Error("Could not create Client: ", err)
+		logrus.Error("Could not create Client: ", err)
 		return nil, err
 	}
 	rest := kubelet.NewRestClient(client)
-	logger.Debug("REST Client created")
+	logrus.Debug("REST Client created")
 	return rest, nil
 }
 
@@ -127,23 +125,23 @@ func getMapFromSlice(collect []metrics.MetricGroup) (map[metrics.MetricGroup]boo
 
 func (s *Service) Start() error {
 
-	s.logger.WithFields(logrus.Fields{
-		"interval":     s.options.Interval,
-		"clusterName":  s.options.ClusterName,
-		"omitLabels":   s.options.OmitLabels,
+	logrus.WithFields(logrus.Fields{
+		"interval":          s.options.Interval,
+		"clusterName":       s.options.ClusterName,
+		"omitLabels":        s.options.OmitLabels,
 		"includeNodeLabels": s.options.IncludeNodeLabels,
-		"metricGroups": s.options.MetricGroupsToCollect,
+		"metricGroups":      s.options.MetricGroupsToCollect,
 	}).Info("Creating Metrics Service Runner...")
 
 	// setup primary interval runner for metrics service
-	runnable := newRunnable(s.restClient, s.builder, s.options, s.logger, s.client)
+	runnable := newRunnable(s.restClient, s.builder, s.options, s.client)
 	s.runner = interval.NewRunner("k8s-stats", s.options.Interval, runnable)
-	s.logger.Debug("Metrics Service Runner created")
+	logrus.Debug("Metrics Service Runner created")
 
 	// start metrics service in go routine
 	go func() {
 		if err := s.runner.Start(); err != nil {
-			s.logger.WithError(err).Error("Failed to start Metrics Service")
+			logrus.WithError(err).Error("Failed to start Metrics Service")
 		}
 	}()
 	return nil


Test patch:
diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go
index b903dec..a7c4791 100644
--- a/metrics/metrics_test.go
+++ b/metrics/metrics_test.go
@@ -9,7 +9,6 @@ import (
 
 	"github.com/honeycombio/honeycomb-kubernetes-agent/kubelet"
 	metrics_mock "github.com/honeycombio/honeycomb-kubernetes-agent/metrics/mock"
-	"github.com/sirupsen/logrus"
 	"github.com/stretchr/testify/assert"
 	v1 "k8s.io/api/core/v1"
 	stats "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
@@ -31,7 +30,7 @@ func createMockSourceAssets(isSum bool, isMeta bool, omitLabels []OmitLabel, inc
 		metadataProvider := kubelet.NewMetadataProvider(rc)
 		podsMetadata, _ := metadataProvider.Pods()
 		nodesMetadata := getMockNodesResponse()
-		metadata = NewMetadata(podsMetadata, &nodesMetadata, omitLabels, includeNodeLabels, logrus.StandardLogger())
+		metadata = NewMetadata(podsMetadata, &nodesMetadata, omitLabels, includeNodeLabels)
 	}
 
 	return summary, metadata
@@ -46,14 +45,13 @@ func getMockNodesResponse() v1.NodeList {
 
 func createMockAccumulator(metadata *Metadata, mg map[MetricGroup]bool) *MetricDataAccumulator {
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	return &MetricDataAccumulator{
 		metadata:              metadata,
 		metricGroupsToCollect: mg,
 		mp:                    p,
 		time:                  time.Now(),
-		logger:                logrus.StandardLogger(),
 	}
 }
 
@@ -172,7 +170,7 @@ func TestGetStatusForContainer(t *testing.T) {
 func TestGenerateMetricsData(t *testing.T) {
 	summary, metadata := createMockSourceAssets(true, true, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	assert.Equal(t, 42, len(p.GenerateMetricsData(summary, metadata, map[MetricGroup]bool{
 		"node":      true,
@@ -192,7 +190,7 @@ func TestGenerateMetricsData(t *testing.T) {
 func TestCpuMetrics(t *testing.T) {
 	summary, _ := createMockSourceAssets(true, false, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.CpuMetrics(summary.Pods[0].CPU, 0.2)
 
@@ -205,7 +203,7 @@ func TestCpuMetrics(t *testing.T) {
 func TestCpuMetricsOptional(t *testing.T) {
 	summary, _ := createMockSourceAssets(true, false, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.CpuMetrics(summary.Pods[1].CPU, 0)
 
@@ -217,7 +215,7 @@ func TestCpuMetricsOptional(t *testing.T) {
 func TestMemMetrics(t *testing.T) {
 	summary, _ := createMockSourceAssets(true, false, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.MemMetrics(summary.Pods[0].Memory, 2147483648)
 
@@ -231,7 +229,7 @@ func TestMemMetrics(t *testing.T) {
 func TestNetworkMetrics(t *testing.T) {
 	summary, _ := createMockSourceAssets(true, false, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.NetworkMetrics(summary.Pods[0].Network)
 
@@ -244,7 +242,7 @@ func TestNetworkMetrics(t *testing.T) {
 func TestVolumeMetrics(t *testing.T) {
 	summary, _ := createMockSourceAssets(true, false, nil, false)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.VolumeMetrics(summary.Pods[0].VolumeStats[0])
 
@@ -262,7 +260,7 @@ func TestCounterMetrics(t *testing.T) {
 	node := getNodeResource(summary.Node, metadata)
 	pod := getPodResource(node, podStats, metadata)
 
-	p := NewMetricsProcessor(10*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(10 * time.Second)
 
 	metrics := p.GenerateMetricsData(summary, metadata, map[MetricGroup]bool{"pod": true})
 
@@ -288,7 +286,7 @@ func TestExpiredCounterMetrics(t *testing.T) {
 	pod := getPodResource(node, podStats, metadata)
 
 	// short expiration time to allow test to run faster
-	p := NewMetricsProcessor(1*time.Second, logrus.StandardLogger())
+	p := NewMetricsProcessor(1 * time.Second)
 
 	metrics := p.GenerateMetricsData(summary, metadata, map[MetricGroup]bool{"pod": true})