Skip to content

Commit

Permalink
fix: Deprecate the label truncation functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Nov 10, 2024
1 parent 509cf39 commit 444efd1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions corefunc/truncate_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Uses a "balancing" algorithm between the prefix and the label, so that each
section is truncated as a factor of how much space it takes up in the merged
string.
DEPRECATED: This function is deprecated and will be removed in the 2.0.0
release. It's a bit too specialized to be useful in a general-purpose library.
----
- maxLength (int64): The maximum allowed length of the combined label.
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/str_truncate_label.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description: |-
Uses a “balancing” algorithm between the prefix and the label, so that each
section is truncated as a factor of how much space it takes up in the merged
string.
DEPRECATED: This function is deprecated and will be removed in the 2.0.0
release. It's a bit too specialized to be useful in a general-purpose library.
-> The motivation for this is in working with monitoring systems such
as New Relic and Datadog where there are hundreds of applications in a
monitoring “prod” account, and also hundreds of applications in a monitoring
Expand All @@ -28,6 +30,9 @@ Uses a “balancing” algorithm between the prefix and the label, so that each
section is truncated as a factor of how much space it takes up in the merged
string.

**DEPRECATED:** This function is deprecated and will be removed in the 2.0.0
release. It's a bit too specialized to be useful in a general-purpose library.

-> The motivation for this is in working with monitoring systems such
as New Relic and Datadog where there are hundreds of applications in a
monitoring “prod” account, and also hundreds of applications in a monitoring
Expand Down
5 changes: 5 additions & 0 deletions docs/functions/str_truncate_label.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description: |-
Uses a “balancing” algorithm between the prefix and the label, so that each
section is truncated as a factor of how much space it takes up in the merged
string.
DEPRECATED: This function is deprecated and will be removed in the 2.0.0
release. It's a bit too specialized to be useful in a general-purpose library.
-> The motivation for this is in working with monitoring systems such
as New Relic and Datadog where there are hundreds of applications in a
monitoring “prod” account, and also hundreds of applications in a monitoring
Expand All @@ -28,6 +30,9 @@ Uses a “balancing” algorithm between the prefix and the label, so that each
section is truncated as a factor of how much space it takes up in the merged
string.

**DEPRECATED:** This function is deprecated and will be removed in the 2.0.0
release. It's a bit too specialized to be useful in a general-purpose library.

-> The motivation for this is in working with monitoring systems such
as New Relic and Datadog where there are hundreds of applications in a
monitoring “prod” account, and also hundreds of applications in a monitoring
Expand Down
4 changes: 0 additions & 4 deletions terratest/data-sources/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ func TestTerraform(t *testing.T) {
assert.Equal(t, terraform.Output(t, terraformOptions, "int_leftpad_ds"), corefunc.IntLeftPad(123, 5))
assert.Equal(t, terraform.Output(t, terraformOptions, "str_leftpad_ds"), corefunc.StrLeftPad("abc", 5, '.'))
assert.Equal(t, terraform.Output(t, terraformOptions, "env_ensure_ds"), os.Getenv("GOROOT"))
assert.Equal(t,
terraform.Output(t, terraformOptions, "str_truncate_ds"),
corefunc.TruncateLabel(64, prefix, label),
)
assert.Equal(t,
terraform.Output(t, terraformOptions, "str_iterative_replace_ds"),
corefunc.StrIterativeReplace(
Expand Down
6 changes: 1 addition & 5 deletions terratest/functions/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
// Both must be installed first.
binaries = []string{
"terraform", // 1.8.0+
// "tofu", // 1.8.0+
"tofu", // 1.7.0+
}
)

Expand Down Expand Up @@ -108,10 +108,6 @@ func TestTerraform(t *testing.T) {
assert.Equal(t, terraform.Output(t, terraformOptions, "int_leftpad_fn"), corefunc.IntLeftPad(123, 5))
assert.Equal(t, terraform.Output(t, terraformOptions, "str_leftpad_fn"), corefunc.StrLeftPad("abc", 5, '.'))
assert.Equal(t, terraform.Output(t, terraformOptions, "env_ensure_fn"), os.Getenv("GOROOT"))
assert.Equal(t,
terraform.Output(t, terraformOptions, "str_truncate_fn"),
corefunc.TruncateLabel(64, prefix, label),
)
assert.Equal(t,
terraform.Output(t, terraformOptions, "str_iterative_replace_fn"),
corefunc.StrIterativeReplace(
Expand Down

0 comments on commit 444efd1

Please sign in to comment.