func NewRoutingAndIngestingReceiverFromService(service *e2e.FutureInstrumentedRunnable, sharedDir string, replicationFactor int, hashring ...receive.HashringConfig) (*e2e.InstrumentedRunnable, error) {
	var localEndpoint string
	if len(hashring) == 0 {
		localEndpoint = "0.0.0.0:9091"
		hashring = []receive.HashringConfig{{Endpoints: []string{localEndpoint}}}
	} else {
		localEndpoint = service.InternalEndpoint("grpc")
	}

	dir := filepath.Join(sharedDir, "data", "receive", service.Name())
	dataDir := filepath.Join(dir, "data")
	container := filepath.Join(ContainerSharedDir, "data", "receive", service.Name())
	if err := os.MkdirAll(dataDir, 0750); err != nil {
		return nil, errors.Wrap(err, "create receive dir")
	}
	b, err := json.Marshal(hashring)
	if err != nil {
		return nil, errors.Wrapf(err, "generate hashring file: %v", hashring)
	}

	receiver := initiateService(
		service,
		DefaultImage(),
		// TODO(bwplotka): BuildArgs should be interface.
		e2e.NewCommand("receive", e2e.BuildArgs(map[string]string{
			"--debug.name":                 service.Name(),
			"--grpc-address":               ":9091",
			"--grpc-grace-period":          "0s",
			"--http-address":               ":8080",
			"--remote-write.address":       ":8081",
			"--label":                      fmt.Sprintf(`receive="%s"`, service.Name()),
			"--tsdb.path":                  filepath.Join(container, "data"),
			"--log.level":                  infoLogLevel,
			"--receive.replication-factor": strconv.Itoa(replicationFactor),
			"--receive.local-endpoint":     localEndpoint,
			"--receive.hashrings":          string(b),
		})...),
		e2e.NewHTTPReadinessProbe("http", "/-/ready", 200, 200),
	)

	return receiver, nil
}
// NewRoutingAndIngestingReceiverFromService creates a Thanos Receive instances from an unitiated service.
// It is configured both for ingesting samples and routing samples to other receivers.
NewRoutingAndIngestingReceiverFromService creates a Thanos Receive instances from an unitiated service.
It is configured both for ingesting samples and routing samples to other receivers.
// NewRoutingAndIngestingReceiverFromService creates a Thanos Receive instances from an unitiated service . // It is configured both for ingesting samples and routing samples to other receivers .
func NewRoutingAndIngestingReceiverFromService(service *e2e.FutureInstrumentedRunnable, sharedDir string, replicationFactor int, hashring ...receive.HashringConfig) (*e2e.InstrumentedRunnable, error) {
	var localEndpoint string
	if len(hashring) == 0 {
		localEndpoint = "0.0.0.0:9091"
		hashring = []receive.HashringConfig{{Endpoints: []string{localEndpoint}}}
	} else {
		localEndpoint = service.InternalEndpoint("grpc")
	}
	dir := filepath.Join(sharedDir, "data", "receive", service.Name())
	dataDir := filepath.Join(dir, "data")
	container := filepath.Join(ContainerSharedDir, "data", "receive", service.Name())
	if err := os.MkdirAll(dataDir, 0750); err != nil {
		return nil, errors.Wrap(err, "create receive dir")
	}
	b, err := json.Marshal(hashring)
	if err != nil {
		return nil, errors.Wrapf(err, "generate hashring file: %v", hashring)
	}
	receiver := initiateService(
		service,
		DefaultImage(),
		e2e.NewCommand("receive", e2e.BuildArgs(map[string]string{
			"--debug.name":                 service.Name(),
			"--grpc-address":               ":9091",
			"--grpc-grace-period":          "0s",
			"--http-address":               ":8080",
			"--remote-write.address":       ":8081",
			"--label":                      fmt.Sprintf(`receive="%s"`, service.Name()),
			"--tsdb.path":                  filepath.Join(container, "data"),
			"--log.level":                  infoLogLevel,
			"--receive.replication-factor": strconv.Itoa(replicationFactor),
			"--receive.local-endpoint":     localEndpoint,
			"--receive.hashrings":          string(b),
		})...),
		e2e.NewHTTPReadinessProbe("http", "/-/ready", 200, 200),
	)
	return receiver, nil
}
func NewRoutingAndIngestingReceiverFromService ( service * e2e . FutureInstrumentedRunnable , sharedDir string , replicationFactor int , hashring ... receive . HashringConfig ) ( * e2e . InstrumentedRunnable , error ) { var localEndpoint string if len ( hashring ) == 0 { localEndpoint = " " hashring = [ ] receive . HashringConfig { { Endpoints : [ ] string { localEndpoint } } } } else { localEndpoint = service . InternalEndpoint ( " " ) } dir := filepath . Join ( sharedDir , " " , " " , service . Name ( ) ) dataDir := filepath . Join ( dir , " " ) container := filepath . Join ( ContainerSharedDir , " " , " " , service . Name ( ) ) if err := os . MkdirAll ( dataDir , 0750 ) ; err != nil { return nil , errors . Wrap ( err , " " ) } b , err := json . Marshal ( hashring ) if err != nil { return nil , errors . Wrapf ( err , " " , hashring ) } receiver := initiateService ( service , DefaultImage ( ) , e2e . NewCommand ( " " , e2e . BuildArgs ( map [ string ] string { " " : service . Name ( ) , " " : " " , " " : " " , " " : " " , " " : " " , " " : fmt . Sprintf ( `receive="%s"` , service . Name ( ) ) , " " : filepath . Join ( container , " " ) , " " : infoLogLevel , " " : strconv . Itoa ( replicationFactor ) , " " : localEndpoint , " " : string ( b ) , } ) ... ) , e2e . NewHTTPReadinessProbe ( " " , " " , 200 , 200 ) , ) return receiver , nil }
NewRoutingAndIngestingReceiverFromService creates a Thanos Receive instances from an unitiated service.
NewRoutingAndIngestingReceiverFromService creates a Thanos Receive instances from an unitiated service .
// TODO(bwplotka): BuildArgs should be interface.