Skip to content

Commit 06c9135

Browse files
committed
terraform: support TBS in standalone_apm_server
1 parent ab03846 commit 06c9135

File tree

6 files changed

+33
-8
lines changed

6 files changed

+33
-8
lines changed

testing/benchmark/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ module "standalone_apm_server" {
160160
apm_server_bin_path = var.apm_server_bin_path
161161
ea_managed = false
162162

163+
apm_server_tail_sampling = var.apm_server_tail_sampling
164+
apm_server_tail_sampling_storage_limit = var.apm_server_tail_sampling_storage_limit
165+
163166
aws_provisioner_key_name = var.private_key
164167

165168
elasticsearch_url = module.moxy[0].moxy_url

testing/infra/terraform/modules/standalone_apm_server/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ This module can be used to create a standalone APM Server deployment against a s
3333
|------|-------------|------|---------|:--------:|
3434
| <a name="input_apm_instance_type"></a> [apm\_instance\_type](#input\_apm\_instance\_type) | Optional apm server instance type overide | `string` | `""` | no |
3535
| <a name="input_apm_server_bin_path"></a> [apm\_server\_bin\_path](#input\_apm\_server\_bin\_path) | Optionally use the apm-server binary from the specified path instead | `string` | `""` | no |
36+
| <a name="input_apm_server_tail_sampling"></a> [apm\_server\_tail\_sampling](#input\_apm\_server\_tail\_sampling) | Whether or not to enable APM Server tail-based sampling. Defaults to false | `bool` | `false` | no |
37+
| <a name="input_apm_server_tail_sampling_storage_limit"></a> [apm\_server\_tail\_sampling\_storage\_limit](#input\_apm\_server\_tail\_sampling\_storage\_limit) | Storage size limit of APM Server tail-based sampling. Defaults to 10GB | `string` | `"10GB"` | no |
3638
| <a name="input_aws_os"></a> [aws\_os](#input\_aws\_os) | Optional aws EC2 instance OS | `string` | `""` | no |
3739
| <a name="input_aws_provisioner_key_name"></a> [aws\_provisioner\_key\_name](#input\_aws\_provisioner\_key\_name) | ssh key name to create the aws key pair and remote provision the EC2 instance | `string` | n/a | yes |
3840
| <a name="input_ea_managed"></a> [ea\_managed](#input\_ea\_managed) | Whether or not install Elastic Agent managed APM Server | `bool` | `false` | no |
3941
| <a name="input_elasticsearch_password"></a> [elasticsearch\_password](#input\_elasticsearch\_password) | The Elasticsearch password | `string` | n/a | yes |
4042
| <a name="input_elasticsearch_url"></a> [elasticsearch\_url](#input\_elasticsearch\_url) | The secure Elasticsearch URL | `string` | n/a | yes |
4143
| <a name="input_elasticsearch_username"></a> [elasticsearch\_username](#input\_elasticsearch\_username) | The Elasticsearch username | `string` | n/a | yes |
4244
| <a name="input_stack_version"></a> [stack\_version](#input\_stack\_version) | Optional stack version | `string` | `"latest"` | no |
43-
| <a name="input_tags"></a> [tags](#input\_tags) | Optional set of tags to use for all deployments | `map(string)` | `{}` | no |
4445
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID to provision the EC2 instance | `string` | n/a | yes |
4546

4647
## Outputs

testing/infra/terraform/modules/standalone_apm_server/apm-server.yml.tftpl

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ apm-server:
1010
enabled: true
1111
pprof:
1212
enabled: true
13-
13+
sampling:
14+
tail:
15+
enabled: ${apm_server_tail_sampling}
16+
storage_limit: ${apm_server_tail_sampling_storage_limit}
1417
output:
1518
elasticsearch:
1619
hosts: [ ${elasticsearch_url} ]

testing/infra/terraform/modules/standalone_apm_server/elastic-agent.yml.tftpl

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
rum:
2626
enabled: true
2727
host: '0.0.0.0:${apm_port}'
28+
sampling:
29+
tail:
30+
enabled: ${apm_server_tail_sampling}
31+
storage_limit: ${apm_server_tail_sampling_storage_limit}
2832
logging.level: debug
2933
logging.to_files: true
3034
logging.files:

testing/infra/terraform/modules/standalone_apm_server/main.tf

+8-6
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,14 @@ resource "aws_instance" "apm" {
185185
provisioner "file" {
186186
destination = local.conf_path
187187
content = templatefile(var.ea_managed ? "${path.module}/elastic-agent.yml.tftpl" : "${path.module}/apm-server.yml.tftpl", {
188-
elasticsearch_url = "${var.elasticsearch_url}",
189-
elasticsearch_username = "${var.elasticsearch_username}",
190-
elasticsearch_password = "${var.elasticsearch_password}",
191-
apm_version = "${var.stack_version}"
192-
apm_secret_token = "${random_password.apm_secret_token.result}"
193-
apm_port = "${local.apm_port}"
188+
elasticsearch_url = "${var.elasticsearch_url}",
189+
elasticsearch_username = "${var.elasticsearch_username}",
190+
elasticsearch_password = "${var.elasticsearch_password}",
191+
apm_version = "${var.stack_version}"
192+
apm_secret_token = "${random_password.apm_secret_token.result}"
193+
apm_port = "${local.apm_port}"
194+
apm_server_tail_sampling = "${var.apm_server_tail_sampling}"
195+
apm_server_tail_sampling_storage_limit = "${var.apm_server_tail_sampling_storage_limit}"
194196
})
195197
}
196198

testing/infra/terraform/modules/standalone_apm_server/variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,15 @@ variable "apm_server_bin_path" {
5454
type = string
5555
description = "Optionally use the apm-server binary from the specified path instead"
5656
}
57+
58+
variable "apm_server_tail_sampling" {
59+
default = false
60+
description = "Whether or not to enable APM Server tail-based sampling. Defaults to false"
61+
type = bool
62+
}
63+
64+
variable "apm_server_tail_sampling_storage_limit" {
65+
default = "10GB"
66+
description = "Storage size limit of APM Server tail-based sampling. Defaults to 10GB"
67+
type = string
68+
}

0 commit comments

Comments
 (0)