Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
### Removed

### Fixed
- [#8175](https://github.com/thanos-io/thanos/pull/8175) Query: fix endpointset setup

## [v0.38.0 - <in progress>](https://github.com/thanos-io/thanos/tree/release-0.38)

Expand Down
7 changes: 4 additions & 3 deletions cmd/thanos/endpointset.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ func setupEndpointSet(

addresses := make([]string, 0, len(endpointConfig.Endpoints))
for _, ecfg := range endpointConfig.Endpoints {
if addr := ecfg.Address; !ecfg.Group && !ecfg.Strict {
// originally only "--endpoint" addresses got resolved
if addr := ecfg.Address; dns.IsDynamicNode(addr) && !ecfg.Group {
addresses = append(addresses, addr)
}
}
Expand All @@ -318,14 +317,16 @@ func setupEndpointSet(
endpointConfig := configProvider.config()

specs := make([]*query.GRPCEndpointSpec, 0)
// groups and non dynamic endpoints
for _, ecfg := range endpointConfig.Endpoints {
strict, group, addr := ecfg.Strict, ecfg.Group, ecfg.Address
if group {
specs = append(specs, query.NewGRPCEndpointSpec(fmt.Sprintf("thanos:///%s", addr), strict, append(dialOpts, extgrpc.EndpointGroupGRPCOpts()...)...))
} else {
} else if !dns.IsDynamicNode(addr) {
specs = append(specs, query.NewGRPCEndpointSpec(addr, strict, dialOpts...))
}
}
// dynamic endpoints
for _, addr := range dnsEndpointProvider.Addresses() {
specs = append(specs, query.NewGRPCEndpointSpec(addr, false, dialOpts...))
}
Expand Down
36 changes: 0 additions & 36 deletions test/e2e/e2ethanos/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,7 @@ type QuerierBuilder struct {
proxyStrategy string
disablePartialResponses bool
fileSDStoreAddresses []string
ruleAddresses []string
metadataAddresses []string
envVars map[string]string
targetAddresses []string
exemplarAddresses []string
enableFeatures []string
endpoints []string
strictEndpoints []string
Expand Down Expand Up @@ -340,26 +336,6 @@ func (q *QuerierBuilder) WithFileSDStoreAddresses(fileSDStoreAddresses ...string
return q
}

func (q *QuerierBuilder) WithRuleAddresses(ruleAddresses ...string) *QuerierBuilder {
q.ruleAddresses = ruleAddresses
return q
}

func (q *QuerierBuilder) WithTargetAddresses(targetAddresses ...string) *QuerierBuilder {
q.targetAddresses = targetAddresses
return q
}

func (q *QuerierBuilder) WithExemplarAddresses(exemplarAddresses ...string) *QuerierBuilder {
q.exemplarAddresses = exemplarAddresses
return q
}

func (q *QuerierBuilder) WithMetadataAddresses(metadataAddresses ...string) *QuerierBuilder {
q.metadataAddresses = metadataAddresses
return q
}

func (q *QuerierBuilder) WithEndpoints(endpoints ...string) *QuerierBuilder {
q.endpoints = endpoints
return q
Expand Down Expand Up @@ -475,18 +451,6 @@ func (q *QuerierBuilder) collectArgs() ([]string, error) {
for _, addr := range q.storeAddresses {
args = append(args, "--endpoint="+addr)
}
for _, addr := range q.ruleAddresses {
args = append(args, "--endpoint="+addr)
}
for _, addr := range q.targetAddresses {
args = append(args, "--endpoint="+addr)
}
for _, addr := range q.metadataAddresses {
args = append(args, "--endpoint="+addr)
}
for _, addr := range q.exemplarAddresses {
args = append(args, "--endpoint="+addr)
}
for _, feature := range q.enableFeatures {
args = append(args, "--enable-feature="+feature)
}
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/exemplars_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ config:

qBuilder = qBuilder.
WithStoreAddresses(stores...).
WithExemplarAddresses(stores...).
WithTracingConfig(tracingCfg)

q := qBuilder.Init()
Expand All @@ -82,7 +81,6 @@ config:
t.Cleanup(cancel)

testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(2), []string{"thanos_store_nodes_grpc_connections"}, e2emon.WaitMissingMetrics()))
testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(2), []string{"thanos_query_endpoints_dns_provider_results"}, e2emon.WaitMissingMetrics()))

now := time.Now()
start := timestamp.FromTime(now.Add(-time.Hour))
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/info_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,10 @@ func TestInfo(t *testing.T) {
testutil.Ok(t, e2e.StartAndWaitReady(store))

// Register `sidecar1` in all flags (i.e. '--store', '--rule', '--target', '--metadata', '--exemplar', '--endpoint') to verify
// '--endpoint' flag works properly works together with other flags ('--target', '--metadata' etc.).
// '--endpoint' flag works properly
// Register 2 sidecars and 1 storeGW using '--endpoint'.
// Register `sidecar3` twice to verify it is deduplicated.
q := e2ethanos.NewQuerierBuilder(e, "1", sidecar1.InternalEndpoint("grpc")).
WithTargetAddresses(sidecar1.InternalEndpoint("grpc")).
WithMetadataAddresses(sidecar1.InternalEndpoint("grpc")).
WithExemplarAddresses(sidecar1.InternalEndpoint("grpc")).
WithRuleAddresses(sidecar1.InternalEndpoint("grpc")).
WithEndpoints(
sidecar1.InternalEndpoint("grpc"),
sidecar2.InternalEndpoint("grpc"),
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/metadata_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ func TestMetadataAPI_Fanout(t *testing.T) {
testutil.Ok(t, e2e.StartAndWaitReady(prom1, sidecar1, prom2, sidecar2))

stores := []string{sidecar1.InternalEndpoint("grpc"), sidecar2.InternalEndpoint("grpc")}
q := e2ethanos.NewQuerierBuilder(
e, "query", stores...).
WithMetadataAddresses(stores...).
Init()
q := e2ethanos.NewQuerierBuilder(e, "query", stores...).Init()
testutil.Ok(t, e2e.StartAndWaitReady(q))

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
t.Cleanup(cancel)

testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(2), []string{"thanos_store_nodes_grpc_connections"}, e2emon.WaitMissingMetrics()))
testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(2), []string{"thanos_query_endpoints_dns_provider_results"}, e2emon.WaitMissingMetrics()))

var promMeta map[string][]metadatapb.Meta
// Wait metadata response to be ready as Prometheus gets metadata after scrape.
Expand Down
5 changes: 1 addition & 4 deletions test/e2e/rules_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ func TestRulesAPI_Fanout(t *testing.T) {
testutil.Ok(t, e2e.StartAndWaitReady(r1, r2))

stores := []string{sidecar1.InternalEndpoint("grpc"), sidecar2.InternalEndpoint("grpc"), r1.InternalEndpoint("grpc"), r2.InternalEndpoint("grpc")}
q := qBuilder.
WithStoreAddresses(stores...).
WithRuleAddresses(stores...).
Init()
q := qBuilder.WithStoreAddresses(stores...).Init()
testutil.Ok(t, e2e.StartAndWaitReady(q))

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/targets_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ func TestTargetsAPI_Fanout(t *testing.T) {
testutil.Ok(t, e2e.StartAndWaitReady(prom1, sidecar1, prom2, sidecar2))

stores := []string{sidecar1.InternalEndpoint("grpc"), sidecar2.InternalEndpoint("grpc")}
q := e2ethanos.NewQuerierBuilder(e, "query", stores...).
WithTargetAddresses(stores...).
Init()
q := e2ethanos.NewQuerierBuilder(e, "query", stores...).Init()
testutil.Ok(t, err)
testutil.Ok(t, e2e.StartAndWaitReady(q))

Expand Down
Loading