Skip to content

Commit

Permalink
remove redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamloe committed Oct 10, 2024
1 parent 813f611 commit 5dc52a9
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,38 +120,6 @@ func getListenerUrl(log zap.Logger) string {
}
}

func updateMetricTimestamps(metrics pmetric.Metrics, log *zap.Logger) {
for i := 0; i < metrics.ResourceMetrics().Len(); i++ {
resourceMetrics := metrics.ResourceMetrics().At(i)
for j := 0; j < resourceMetrics.ScopeMetrics().Len(); j++ {
scopeMetrics := resourceMetrics.ScopeMetrics().At(j)
for k := 0; k < scopeMetrics.Metrics().Len(); k++ {
m := scopeMetrics.Metrics().At(k)
switch m.Type() {
case pmetric.MetricTypeGauge:
for l := 0; l < m.Gauge().DataPoints().Len(); l++ {
m.Gauge().DataPoints().At(l).SetTimestamp(pcommon.NewTimestampFromTime(time.Now()))
}
case pmetric.MetricTypeSum:
for l := 0; l < m.Sum().DataPoints().Len(); l++ {
m.Sum().DataPoints().At(l).SetTimestamp(pcommon.NewTimestampFromTime(time.Now()))
}
case pmetric.MetricTypeHistogram:
for l := 0; l < m.Histogram().DataPoints().Len(); l++ {
m.Histogram().DataPoints().At(l).SetTimestamp(pcommon.NewTimestampFromTime(time.Now()))
}
case pmetric.MetricTypeSummary:
for l := 0; l < m.Summary().DataPoints().Len(); l++ {
m.Summary().DataPoints().At(l).SetTimestamp(pcommon.NewTimestampFromTime(time.Now()))
}
default:
log.Info("Unknown metric type", zap.Field{Key: "metric_type", Type: zapcore.StringType, String: m.Type().String()})
}
}
}
}
}

func extractHeaders(request events.APIGatewayProxyRequest) (string, string) {
requestId := request.Headers["X-Amz-Firehose-Request-Id"]
if requestId == "" {
Expand Down Expand Up @@ -283,8 +251,6 @@ func processRecord(protoBuffer *proto.Buffer, log *zap.Logger) (pmetric.Metrics,
exportRequestMetrics := exportRequest.Metrics()
minMaxMetrics := pmetric.NewMetrics()
minMaxMetrics.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty()
// TODO remove this after testing
updateMetricTimestamps(exportRequestMetrics, log)
// Parse metrics according to logzio naming conventions
for i := 0; i < exportRequestMetrics.ResourceMetrics().Len(); i++ {
resourceMetrics := exportRequestMetrics.ResourceMetrics().At(i)
Expand Down

0 comments on commit 5dc52a9

Please sign in to comment.