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 issue in name trimming not adding all values #641

Conversation

mmatache
Copy link
Contributor

@mmatache mmatache commented Dec 17, 2021

Fixes #596

In the previous PR for this issue a case was missed when submitting the name trimming code.
This issue caused, in certain cases, an error where fmt.Sprintf() would receive less values that the format expected and would therefore have a missing parameter.
The result of this are formatted texts that look like this:

--- FAIL: TestTruncate (0.00s)
    --- FAIL: TestTruncate/first_value_gets_truncated,_second_added (0.00s)
        /home/mihai/projects/open-telemetry/opentelemetry-operator/pkg/naming/triming_test.go:78: 
            	Error Trace:	triming_test.go:78
            	Error:      	Not equal: 
            	            	expected: "4d96-11ea-b174-c85b7644b6b5-5d0c1e62-4d96-11ea-b174--collector"
            	            	actual  : "4d96-11ea-b174-c85b7644b6b5-5d0c1e62-4d96-11e-%!s(MISSING)-coll"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-4d96-11ea-b174-c85b7644b6b5-5d0c1e62-4d96-11ea-b174--collector
            	            	+4d96-11ea-b174-c85b7644b6b5-5d0c1e62-4d96-11e-%!s(MISSING)-coll
            	Test:       	TestTruncate/first_value_gets_truncated,_second_added
FAIL
FAIL	github.com/open-telemetry/opentelemetry-operator/pkg/naming	0.015s
FAIL

Notice the %!s(MISSING). This would also cause the labels to fail when such a case was encountered during execution.

@jpkrohling jpkrohling enabled auto-merge (squash) December 17, 2021 10:04
@jpkrohling jpkrohling merged commit e6b64ee into open-telemetry:main Dec 17, 2021
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
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.

Collector instance not created if name + namespace exceeds 63 due to how the labels are built
2 participants