Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty log lines parsing in parse_cassandra_log, add automated tes… #1424

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

burmanm
Copy link
Contributor

@burmanm burmanm commented Oct 2, 2024

…ts for Vector

What this PR does:
Changes the rules to strip whitespace from logs, this removes empty loglines also (which cause a crash of Vector grok parsing).

Also, add tests that generate Vector files from our Telemetry rules and then run vector test against them.

Which issue(s) this PR fixes:
Fixes #1409
Fixes #1425

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CHANGELOG.md updated (not required for documentation PRs)
  • CLA Signed: DataStax CLA

@burmanm burmanm requested a review from a team as a code owner October 2, 2024 14:50
Copy link
Contributor

@olim7t olim7t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that we could address that quickly.
Approved (pending the install issue, but you're already working on that).

@@ -346,6 +356,10 @@ cert-manager-multi: ## Install cert-manager to the clusters
make cert-manager; \
done

.PHONY: vector-install
vector-install:
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev | bash -s -- --prefix $(LOCALBIN) -y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to comment that I'm getting an error on this, but I see that you have opened an issue with the Vector project :)

@@ -159,6 +159,15 @@ else
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GO_FLAGS) ./apis/... ./pkg/... ./test/yq/... ./controllers/... -covermode=atomic -coverprofile coverage.out
endif

.PHONY: vector-test
vector-test: ## Run vector tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] shouldn't this depend on vector-install?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want it to depend on the vector-install if some person (well, maybe just me?) has it installed through brew or other means. Also, since it was broken on some platforms like MacOS (the fix isn't merged yet), it would make running the tests difficult.

$(eval TMP := $(shell mktemp -d))
VECTOR_TEST_FILES=true OUTPUT_PATH=$(TMP) go test -v ./pkg/telemetry -run=TestGenerateTomlTestFiles
@echo Running vector test files
OUTPUT_PATH=$(TMP) VECTOR=$(VECTOR) scripts/run-vector-tests.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[thought] Couldn't we just run the vector executable (and assert its return value) from within the Go test?
That way it would be a regular test, we wouldn't need a dedicated make target / script file / CI step to run it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do that also, but I don't think we've done that too often in our tests. It's an external program, so not really running go test code.

But would we really want Vector installation to be a dependency on running Go tests? make test would require then vector to be always installed.

…prevent old versions from being in the path, change vector-test back to Makefile entirely for GHA
Copy link

sonarqubecloud bot commented Oct 4, 2024

@burmanm burmanm merged commit 78728eb into k8ssandra:main Oct 4, 2024
62 checks passed
adejanovski pushed a commit that referenced this pull request Oct 7, 2024
#1424)

* Fix empty log lines parsing in parse_cassandra_log, add automated tests for Vector

* Fix kustomize paths in tests, remove manual old kustomize install to prevent old versions from being in the path, change vector-test back to Makefile entirely for GHA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make manifests requires kustomize as pre-step Vector error when parsing Cassandra logs
2 participants