Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilder committed Feb 5, 2025
1 parent 562adb9 commit bdb3b2e
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 950 deletions.
12 changes: 0 additions & 12 deletions alerter/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/Azure/adx-mon/metrics"
"github.com/Azure/adx-mon/pkg/logger"
"github.com/Azure/azure-kusto-go/kusto"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -73,16 +71,6 @@ type KustoClient interface {
Endpoint() string
}

var ruleErrorCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "l2m",
Subsystem: "engine",
Name: "errors",
Help: "Number of errors encountered in the primary execution engine",
},
[]string{"region"},
)

func NewService(opts *AlerterOpts) (*Alerter, error) {
ruleStore := rules.NewStore(rules.StoreOpts{
Region: opts.Region,
Expand Down
15 changes: 0 additions & 15 deletions cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"regexp"
"runtime"
"sort"
"strings"
"syscall"
"time"

Expand Down Expand Up @@ -712,20 +711,6 @@ func getInformer(kubeConfig string, nodeName string, informer *k8s.PodInformer)
return k8s.NewPodInformer(client, nodeName), nil
}

// parseKeyPairs parses a list of key pairs in the form of key=value,key=value
// and returns them as a map.
func parseKeyPairs(kp []string) (map[string]string, error) {
m := make(map[string]string)
for _, encoded := range kp {
split := strings.Split(encoded, "=")
if len(split) != 2 {
return nil, fmt.Errorf("invalid key-pair %s", encoded)
}
m[split[0]] = split[1]
}
return m, nil
}

func getMetricsExporters(exporterNames []string, exporters *config.Exporters, cache map[string]remote.RemoteWriteClient) ([]remote.RemoteWriteClient, error) {
var remoteClients []remote.RemoteWriteClient
for _, exporterName := range exporterNames {
Expand Down
2 changes: 0 additions & 2 deletions collector/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,5 +604,3 @@ func getTargetAnnotationMapOrDefault(p *v1.Pod, key string, defaultVal map[strin
}
return parsedMap
}

var adxmonNamespaceLabel = []byte("adxmon_namespace")
2 changes: 1 addition & 1 deletion ingestor/cluster/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func TestBatcher_Stats(t *testing.T) {
created, err := flakeutil.ParseFlakeID("2359cdac8d6f0001")
require.NoError(t, err)

segments := []wal.SegmentInfo{}
var segments []wal.SegmentInfo

idx := wal.NewIndex()
f1 := wal.SegmentInfo{
Expand Down
8 changes: 0 additions & 8 deletions ingestor/cluster/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,3 @@ func IsInitReady(pod *v1.Pod) bool {
}
return false
}

func reverse(b []byte) []byte {
x := make([]byte, len(b))
for i := 0; i < len(b); i++ {
x[i] = b[len(b)-i-1]
}
return x
}
28 changes: 0 additions & 28 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ var (
Help: "Counter of the number of metrics uploaded to Kusto",
}, []string{"database", "table"})

LogsReceived = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: "ingestor",
Name: "logs_received_total",
Help: "Counter of the number of logs received",
}, []string{"database", "table"})

LogsUploaded = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: "ingestor",
Expand All @@ -107,13 +100,6 @@ var (
Help: "Counter of the number of invalid logs dropped",
}, []string{})

ValidLogsDropped = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: "ingestor",
Name: "valid_logs_dropped",
Help: "Counter of the number of logs dropped due to ingestor errors",
}, []string{})

SampleLatency = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: Namespace,
Subsystem: "ingestor",
Expand Down Expand Up @@ -172,20 +158,6 @@ var (
Help: "Counter of the number of logs uploaded",
}, []string{"database", "table"})

LogsProxyFailures = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: "collector",
Name: "logs_failures",
Help: "Counter of the number of failures when proxying logs to the OTLP endpoints",
}, []string{"endpoint"})

LogsProxyPartialFailures = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: "collector",
Name: "logs_partial_failures",
Help: "Counter of the number of partial failures when proxying logs to the OTLP endpoints",
}, []string{"endpoint"})

LogKeys = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: Namespace,
Subsystem: "collector",
Expand Down
14 changes: 0 additions & 14 deletions pkg/otlp/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package otlp

import (
"log/slog"
"strconv"
"time"

v1 "buf.build/gen/go/opentelemetry/opentelemetry/protocolbuffers/go/opentelemetry/proto/collector/logs/v1"
commonv1 "buf.build/gen/go/opentelemetry/opentelemetry/protocolbuffers/go/opentelemetry/proto/common/v1"
logsv1 "buf.build/gen/go/opentelemetry/opentelemetry/protocolbuffers/go/opentelemetry/proto/logs/v1"
"github.com/Azure/adx-mon/metrics"
"github.com/Azure/adx-mon/pkg/tlv"
)

// Logs is a collection of logs and their resources.
Expand All @@ -24,20 +22,8 @@ type Logs struct {
const (
dbKey = "kusto.database"
tblKey = "kusto.table"

LogsTotalTag = tlv.Tag(0xAB)
)

func EmitMetricsForTLV(tlvs []tlv.TLV, database, table string) {
for _, t := range tlvs {
if t.Tag == LogsTotalTag {
if v, err := strconv.Atoi(string(t.Value)); err == nil {
metrics.LogsUploaded.WithLabelValues(database, table).Add(float64(v))
}
}
}
}

// Group logs into a collection of logs and their resources.
func Group(req *v1.ExportLogsServiceRequest, add []*commonv1.KeyValue, log *slog.Logger) []*Logs {
var grouped []*Logs
Expand Down
12 changes: 0 additions & 12 deletions pkg/prompb/protobuf_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package prompb

import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -130,14 +129,3 @@ func BenchmarkWriteRequestUnmarshal(b *testing.B) {
require.NoError(b, wr.Unmarshal(buf))
}
}

func formatBytes(b []byte) string {
s := ""
for i, v := range b {
if i != 0 {
s += ", "
}
s += fmt.Sprint(v)
}
return s
}
82 changes: 0 additions & 82 deletions pkg/promremote/promremote_test.go

This file was deleted.

Loading

0 comments on commit bdb3b2e

Please sign in to comment.