-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (57 loc) · 1.47 KB
/
Copy pathMakefile
File metadata and controls
70 lines (57 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Makefile.PHONY: build run test clean docker
# Build the application
build:
go build -o influxdb-proxy cmd/proxy/main.go
# Run the application
run:
go run cmd/proxy/main.go
# Run with custom config
run-config:
go run cmd/proxy/main.go -config config.yaml
# Run tests
test:
go test ./...
# Run tests with coverage
test-coverage:
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Clean build artifacts
clean:
rm -f influxdb-proxy
rm -f coverage.out coverage.html
go clean -cache
# Download dependencies
deps:
go mod download
go mod tidy
# Build Docker image
docker-build:
docker build -t influxdb-proxy .
# Format code
fmt:
go fmt ./...
# Lint code (requires golangci-lint)
lint:
golangci-lint run
# Install development tools
dev-tools:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Generate example queries for testing
example-queries:
@echo "Valid query:"
@echo "curl -X POST 'http://localhost:8087/query' -d 'q=SELECT value FROM cpu WHERE time > now() - 1h AND time < now()&db=mydb'"
@echo ""
@echo "Invalid query (no time filter):"
@echo "curl -X POST 'http://localhost:8087/query' -d 'q=SELECT * FROM cpu&db=mydb'"
@echo ""
@echo "Health check:"
@echo "curl http://localhost:8087/proxy_health"
@echo ""
@echo "Metrics:"
@echo "curl http://localhost:8087/proxy_metrics"
# Sanity checks
sanity:
go clean -cache
go fmt ./...
go test ./... -v
go build -o influxdb-proxy cmd/proxy/main.go