|
3 | 3 | page_title: "corefunc_str_truncate_label Data Source - corefunc"
|
4 | 4 | subcategory: ""
|
5 | 5 | description: |-
|
6 |
| - TruncateLabel supports prepending a prefix to a label, while truncating them |
| 6 | + Supports prepending a prefix to a label, while truncating them |
7 | 7 | to meet the maximum length constraints. Useful when grouping labels with a
|
8 | 8 | kind of prefix. Both the prefix and the label will be truncated if necessary.
|
9 |
| - Uses a "balancing" algorithm between the prefix and the label, so that each |
| 9 | + Uses a “balancing” algorithm between the prefix and the label, so that each |
10 | 10 | section is truncated as a factor of how much space it takes up in the merged
|
11 | 11 | string.
|
12 | 12 | -> The motivation for this is in working with monitoring systems such
|
13 | 13 | as New Relic and Datadog where there are hundreds of applications in a
|
14 |
| - monitoring "prod" account, and also hundreds of applications in a monitoring |
15 |
| - "nonprod" account. This allows us to group lists of monitors together using a |
| 14 | + monitoring “prod” account, and also hundreds of applications in a monitoring |
| 15 | + “nonprod” account. This allows us to group lists of monitors together using a |
16 | 16 | shared prefix, but also truncate them appropriately to fit length
|
17 | 17 | constraints for names.
|
| 18 | + Maps to the corefunc.TruncateLabel() https://pkg.go.dev/github.com/northwood-labs/terraform-provider-corefunc/corefunc#TruncateLabel Go method, which can be used in |
| 19 | + Terratest https://terratest.gruntwork.io. |
18 | 20 | ---
|
19 | 21 | -->
|
20 | 22 |
|
21 | 23 | # corefunc_str_truncate_label (Data Source)
|
22 | 24 |
|
23 |
| -TruncateLabel supports prepending a prefix to a label, while truncating them |
| 25 | +Supports prepending a prefix to a label, while truncating them |
24 | 26 | to meet the maximum length constraints. Useful when grouping labels with a
|
25 | 27 | kind of prefix. Both the prefix and the label will be truncated if necessary.
|
26 | 28 |
|
27 |
| -Uses a "balancing" algorithm between the prefix and the label, so that each |
| 29 | +Uses a “balancing” algorithm between the prefix and the label, so that each |
28 | 30 | section is truncated as a factor of how much space it takes up in the merged
|
29 | 31 | string.
|
30 | 32 |
|
31 | 33 | -> The motivation for this is in working with monitoring systems such
|
32 | 34 | as New Relic and Datadog where there are hundreds of applications in a
|
33 |
| -monitoring "prod" account, and also hundreds of applications in a monitoring |
34 |
| -"nonprod" account. This allows us to group lists of monitors together using a |
| 35 | +monitoring “prod” account, and also hundreds of applications in a monitoring |
| 36 | +“nonprod” account. This allows us to group lists of monitors together using a |
35 | 37 | shared prefix, but also truncate them appropriately to fit length
|
36 | 38 | constraints for names.
|
37 | 39 |
|
| 40 | +Maps to the [`corefunc.TruncateLabel()`](https://pkg.go.dev/github.com/northwood-labs/terraform-provider-corefunc/corefunc#TruncateLabel) Go method, which can be used in |
| 41 | +[Terratest](https://terratest.gruntwork.io). |
| 42 | + |
38 | 43 | ## Example Usage
|
39 | 44 |
|
40 | 45 | ```terraform
|
|
0 commit comments