Skip to content

Commit 5797c13

Browse files
Peter Goronpgoron
authored andcommitted
refactor: move probe entrypoints from probes/ to cmd/
follow the standard Go project layout convention by placing binary entrypoints under cmd/<name>/. Updated Makefile, README, and moved associated READMEs.
1 parent 389de66 commit 5797c13

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ test:
88
build: build_aerospike build_milvus build_opensearch
99

1010
build_aerospike:
11-
CGO_ENABLED=0 go build -o build/aerospike_probe probes/aerospike/main.go
11+
CGO_ENABLED=0 go build -o build/aerospike_probe ./cmd/aerospike
1212

1313
build_linux_aerospike:
14-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/aerospike_probe probes/aerospike/*.go
14+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/aerospike_probe ./cmd/aerospike
1515

1616
build_milvus:
17-
CGO_ENABLED=0 go build -o build/milvus_probe probes/milvus/main.go
17+
CGO_ENABLED=0 go build -o build/milvus_probe ./cmd/milvus
1818

1919
build_linux_milvus:
20-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/milvus_probe probes/milvus/*.go
20+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/milvus_probe ./cmd/milvus
2121

2222
build_opensearch:
23-
CGO_ENABLED=0 go build -o build/opensearch_probe probes/opensearch/main.go
23+
CGO_ENABLED=0 go build -o build/opensearch_probe ./cmd/opensearch
2424

2525
build_linux_opensearch:
26-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/opensearch_probe probes/opensearch/*.go
26+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/opensearch_probe ./cmd/opensearch
2727

2828
build_linux: build_linux_aerospike build_linux_milvus build_linux_opensearch
2929

3030
lint:
31-
gofmt -d -e -s pkg/**/*.go probes/**/*.go
31+
gofmt -d -e -s pkg/**/*.go cmd/**/*.go
3232
go vet ./...
3333

3434
image:

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Aerospike blackbox probe
5050
5151
Flags:
5252
-h, --help Show context-sensitive help (also try --help-long and --help-man).
53-
--web.listen-address="0.0.0.0:8080"
53+
--web.listen-address="0.0.0.0:8080"
5454
Address to listen on for UI, API, and telemetry.
55-
--config.path="config.yaml"
55+
--config.path="config.yaml"
5656
Path to the probe configuration file
5757
--log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error]
5858
--log.format=logfmt Output format of log messages. One of: [logfmt, json]
@@ -82,27 +82,27 @@ The prober will schedule checks (either cluster or node level) for each endpoint
8282

8383
## Conventions
8484

85-
Metrics should use seconds as unit or prefix with the unit (`_ms`)
85+
Metrics should use seconds as unit or prefix with the unit (`_ms`)
8686

8787

8888
## Implementations
8989

90-
Probes are defined in the probes/\<name of db\> directory.
90+
Probes are defined in the cmd/\<name of db\> directory.
9191
The probes have to define 3 things:
9292

9393
### Endpoints
9494

95-
A implementation of the `toplogy.ProbeableEndpoint`. It contains the client
95+
A implementation of the `toplogy.ProbeableEndpoint`. It contains the client
9696
(and everything necessary) to connect to the database. State, locks or
9797
connections should not be shared between endpoints as it may affect recorded
9898
latencies.
9999

100-
See [probes/aerospike/endpoint.go](probes/aerospike/endpoint.go) for an example
100+
See [cmd/aerospike/endpoint.go](cmd/aerospike/endpoint.go) for an example
101101

102102
### Endpoint builder
103103

104104
The discovery is responsible for creating the topology. When creating a
105-
discoverer, a builder function should be provided:
105+
discoverer, a builder function should be provided:
106106
`topologyBuilderFn func(log.Logger, []ServiceEntry) (topology.ClusterMap, error)`
107107
This function takes all the service entries (services found by the service
108108
discovery) and return a topology. A generic version of this function is
@@ -116,7 +116,7 @@ GetGenericTopologyBuilder(
116116
`ClusterFn` should generate a cluster level endpoint
117117
`NodeFn` should generate a node level endpoint
118118

119-
See [probes/aerospike/discovery.go](probes/aerospike/discovery.go) for an example
119+
See [cmd/aerospike/discovery.go](cmd/aerospike/discovery.go) for an example
120120

121121
### Checks
122122

@@ -132,4 +132,4 @@ p.RegisterNewClusterCheck(scheduler.Check{
132132
```
133133
`scheduler.Noop` is a placeholder function
134134

135-
See [probes/aerospike/main.go](probes/aerospike/main.go) for an example
135+
See [cmd/aerospike/main.go](cmd/aerospike/main.go) for an example
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ be 100% accurate, having latency per server is very useful for debugging.
5858
The durability check is working by writing many item once and checking if they
5959
are still there and if their data is correct.
6060

61-
It is done in two phases:
61+
It is done in two phases:
6262

6363
#### Prepare phase
6464

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ be 100% accurate, having latency per server is very useful for debugging.
4040
The durability check is working by writing many item once and checking if they
4141
are still there and if their data is correct.
4242

43-
It is done in two phases:
43+
It is done in two phases:
4444

4545
#### Prepare phase
4646

0 commit comments

Comments
 (0)