Files
76c2c85b97 [Generator] Add DRAIN span_name sanitizer (#6098)
* [Generator] Add DRAIN span_name sanitizer

* Fix linter

* Fix formatting

* Update default manifest

* Fix build error in update-fixtures

* Remove bad test

* Remove misleading comment

* Add per-tenant override for drain mode

* Do a machines job

* Address PR feedback

* Address PR review: rename drain_mode config and improve sanitizer

- Rename `drain_mode` to `span_name_sanitization` across all config,
  legacy config, interfaces, and overrides for better user-facing clarity
- Add explicit default value "disabled" in RegisterFlagsAndApplyDefaults
- Add ValidateSpanNameSanitization function in validation/fields.go
- Rename metrics to remove DRAIN reference:
  `drain_spans_compacted_total` -> `spans_sanitized_total`
  `post_drain_demand_estimate` -> `post_sanitization_demand_estimate`
- Pass configured staleDuration to NewDrainSanitizer instead of
  hardcoded 15min, consistent with other registry components
- Extract "span_name" magic string to labelSpanName constant
- Update all tests with new names and signatures

* Update manifest

* Use empty string as disabled

* Update CHANGELOG.md

Co-authored-by: Suraj Nath <[email protected]>

* Update manifest

---------

Co-authored-by: Suraj Nath <[email protected]>
2026-02-22 00:55:22 -08:00

56 lines
1.2 KiB
Makefile

SHELL := /bin/bash
SCRIPTS := "./.github/workflows/scripts"
.PHONY: deps
deps: ## Install all the build and lint dependencies
bash $(SCRIPTS)/deps.sh
.PHONY: fmt
fmt: ## Run format tools on all go files
gci write --skip-vendor --skip-generated \
-s standard -s default -s "prefix(github.com/maypok86/otter)" .
gofumpt -l -w .
.PHONY: lint
lint: ## Run all the linters
golangci-lint run -v ./...
.PHONY: test
test: test.unit ## Run all the tests
.PHONY: test.unit
test.unit: ## Run all unit tests
bash $(SCRIPTS)/run-tests.sh
.PHONY: test.32-bit
test.32-bit: ## Run tests on 32-bit arch
GOARCH=386 go test -v ./...
.PHONY: cover
cover: test.unit ## Run all the tests and opens the coverage report
go tool cover -html=coverage.txt
.PHONY: ci
ci: lint test ## Run all the tests and code checks
.PHONY: generate
generate: gennode fmt ## Generate files for the project
.PHONY: gennode
gennode: ## Generate nodes
go run ./cmd/generator ./internal/generated/node
.PHONY: clean
clean: ## Remove temporary files
@go clean
@rm -rf bin/
@rm -rf coverage.txt lint.txt
@echo "SUCCESS!"
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL:= help