Skip to content

Commit 14e68bc

Browse files
pracuccigouthamve
authored andcommitted
Removed unused code (#1740)
Signed-off-by: Marco Pracucci <[email protected]>
1 parent 5f39048 commit 14e68bc

File tree

16 files changed

+2
-133
lines changed

16 files changed

+2
-133
lines changed

pkg/alertmanager/multitenant.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"net/url"
1111
"os"
1212
"path/filepath"
13-
"strings"
1413
"sync"
1514
"time"
1615

@@ -72,8 +71,7 @@ var (
7271
Name: "alertmanager_configs",
7372
Help: "How many configs the multitenant alertmanager knows about.",
7473
})
75-
statusTemplate *template.Template
76-
allConnectionStates = []string{"established", "pending", "retrying", "failed", "connecting"}
74+
statusTemplate *template.Template
7775
)
7876

7977
func init() {
@@ -88,17 +86,6 @@ func init() {
8886
}).Parse(statusPage))
8987
}
9088

91-
// Print counts in a specified order
92-
func counts(counts map[string]int, keys []string) string {
93-
var stringCounts []string
94-
for _, key := range keys {
95-
if count, ok := counts[key]; ok {
96-
stringCounts = append(stringCounts, fmt.Sprintf("%d %s", count, key))
97-
}
98-
}
99-
return strings.Join(stringCounts, ", ")
100-
}
101-
10289
// MultitenantAlertmanagerConfig is the configuration for a multitenant Alertmanager.
10390
type MultitenantAlertmanagerConfig struct {
10491
DataDir string

pkg/chunk/cache/redis_cache.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,3 @@ func (c *RedisCache) ping(ctx context.Context) error {
141141
}
142142
return err
143143
}
144-
145-
func redisStatusCode(err error) string {
146-
switch err {
147-
case nil:
148-
return "200"
149-
case redis.ErrNil:
150-
return "404"
151-
default:
152-
return "500"
153-
}
154-
}

pkg/chunk/cassandra/storage_client.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ import (
1414
"github.com/cortexproject/cortex/pkg/chunk/util"
1515
)
1616

17-
const (
18-
maxRowReads = 100
19-
)
20-
2117
// Config for a StorageClient
2218
type Config struct {
2319
Addresses string `yaml:"addresses,omitempty"`

pkg/chunk/chunk_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ func TestChunkCodec(t *testing.T) {
130130

131131
const fixedTimestamp = model.Time(1557654321000)
132132

133-
func encodeForCompatibilityTest(t *testing.T) {
134-
dummy := dummyChunkForEncoding(fixedTimestamp, labelsForDummyChunks, encoding.Bigchunk, 1)
135-
encoded, err := dummy.Encoded()
136-
require.NoError(t, err)
137-
fmt.Printf("%q\n%q\n", dummy.ExternalKey(), encoded)
138-
}
139-
140133
func TestChunkDecodeBackwardsCompatibility(t *testing.T) {
141134
// Chunk encoded using code at commit b1777a50ab19
142135
rawData := []byte("\x00\x00\x00\xb7\xff\x06\x00\x00sNaPpY\x01\xa5\x00\x00\x04\xc7a\xba{\"fingerprint\":18245339272195143978,\"userID\":\"userID\",\"from\":1557650721,\"through\":1557654321,\"metric\":{\"bar\":\"baz\",\"toms\":\"code\",\"__name__\":\"foo\"},\"encoding\":3}\n\x00\x00\x00\x15\x01\x00\x11\x00\x00\x01\xd0\xdd\xf5\xb6\xd5Z\x00\x00\x00\x00\x00\x00\x00\x00\x00")

pkg/chunk/encoding/chunk.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const ChunkLen = 1024
3131

3232
var (
3333
errChunkBoundsExceeded = errors.New("attempted access outside of chunk boundaries")
34-
errAddedToEvictedChunk = errors.New("attempted to add sample to evicted chunk")
3534
)
3635

3736
// Chunk is the interface for all chunks. Chunks are generally not

pkg/chunk/gcp/bigtable_index_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const (
2727
column = "c"
2828
separator = "\000"
2929
maxRowReads = 100
30-
null = string('\xff')
3130
)
3231

3332
// Config for a StorageClient

pkg/chunk/local/boltdb_index_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var bucketName = []byte("index")
2222

2323
const (
2424
separator = "\000"
25-
null = string('\xff')
2625
dbReloadPeriod = 10 * time.Minute
2726
)
2827

pkg/chunk/testutils/testutils.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ func CreateChunks(startIndex, batchSize int, start model.Time) ([]string, []chun
7171
return keys, chunks, nil
7272
}
7373

74-
func dummyChunk(now model.Time) chunk.Chunk {
75-
return dummyChunkFor(now, labels.Labels{
76-
{Name: model.MetricNameLabel, Value: "foo"},
77-
{Name: "bar", Value: "baz"},
78-
{Name: "toms", Value: "code"},
79-
})
80-
}
81-
8274
func dummyChunkFor(now model.Time, metric labels.Labels) chunk.Chunk {
8375
cs := promchunk.New()
8476
cs.Add(model.SamplePair{Timestamp: now, Value: 0})

pkg/distributor/distributor.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ var (
5959
Name: "distributor_deduped_samples_total",
6060
Help: "The total number of deduplicated samples.",
6161
}, []string{"user", "cluster"})
62-
sendDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
63-
Namespace: "cortex",
64-
Name: "distributor_send_duration_seconds",
65-
Help: "Time spent sending a sample batch to multiple replicated ingesters.",
66-
Buckets: []float64{.001, .0025, .005, .01, .025, .05, .1, .25, .5, 1},
67-
}, []string{"method", "status_code"})
6862
labelsHistogram = promauto.NewHistogram(prometheus.HistogramOpts{
6963
Namespace: "cortex",
7064
Name: "labels_per_sample",

pkg/distributor/ha_tracker.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ func NewReplicaDesc() *ReplicaDesc {
5959
return &ReplicaDesc{}
6060
}
6161

62-
const (
63-
longPollDuration = 10 * time.Second
64-
)
65-
6662
// Track the replica we're accepting samples from
6763
// for each HA cluster we know about.
6864
type haTracker struct {

0 commit comments

Comments
 (0)