Skip to content

Commit

Permalink
feat(forwarder): add debug_endpoint parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jta committed Apr 18, 2024
1 parent 64ad5d2 commit a235c1c
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions modules/forwarder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_content_type_overrides"></a> [content\_type\_overrides](#input\_content\_type\_overrides) | A list of key value pairs. The key is a regular expression which is<br>applied to the S3 source (<bucket>/<key>) of forwarded files. The value<br>is the content type to set for matching files. For example,<br>`\.json$=application/x-ndjson` would forward all files ending in `.json`<br>as newline delimited JSON | <pre>list(object({<br> pattern = string<br> content_type = string<br> }))</pre> | `[]` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets the OTEL\_EXPORTER\_OTLP\_ENDPOINT environment variable for the lambda function. | `string` | `""` | no |
| <a name="input_destination"></a> [destination](#input\_destination) | Destination filedrop | <pre>object({<br> arn = string<br> bucket = string<br> prefix = string<br> })</pre> | n/a | yes |
| <a name="input_lambda_env_vars"></a> [lambda\_env\_vars](#input\_lambda\_env\_vars) | Environment variables to be passed into lambda. | `map(string)` | `{}` | no |
| <a name="input_lambda_memory_size"></a> [lambda\_memory\_size](#input\_lambda\_memory\_size) | Memory size for lambda function. | `number` | `128` | no |
Expand Down
10 changes: 6 additions & 4 deletions modules/forwarder/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ resource "aws_lambda_function" "this" {

environment {
variables = merge({
DESTINATION_URI = "s3://${var.destination.bucket}/${var.destination.prefix}"
MAX_FILE_SIZE = var.max_file_size
CONTENT_TYPE_OVERRIDES = join(",", [for o in var.content_type_overrides : "${o["pattern"]}=${o["content_type"]}"])
SOURCE_BUCKET_NAMES = join(",", var.source_bucket_names)
DESTINATION_URI = "s3://${var.destination.bucket}/${var.destination.prefix}"
MAX_FILE_SIZE = var.max_file_size
CONTENT_TYPE_OVERRIDES = join(",", [for o in var.content_type_overrides : "${o["pattern"]}=${o["content_type"]}"])
SOURCE_BUCKET_NAMES = join(",", var.source_bucket_names)
OTEL_EXPORTER_OTLP_ENDPOINT = var.debug_endpoint
OTEL_TRACES_EXPORTER = var.debug_endpoint == "" ? "none" : "otlp"
}, var.lambda_env_vars)
}
}
Expand Down
7 changes: 7 additions & 0 deletions modules/forwarder/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,10 @@ variable "queue_maximum_batching_window_in_seconds" {
nullable = false
default = 1
}

variable "debug_endpoint" {
description = "Endpoint to send debugging telemetry to. Sets the OTEL_EXPORTER_OTLP_ENDPOINT environment variable for the lambda function."
type = string
nullable = false
default = ""
}
2 changes: 1 addition & 1 deletion modules/logwriter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module "logwriter" {
| <a name="input_bucket_arn"></a> [bucket\_arn](#input\_bucket\_arn) | S3 Bucket ARN to write log records to. | `string` | n/a | yes |
| <a name="input_buffering_interval"></a> [buffering\_interval](#input\_buffering\_interval) | Buffer incoming data for the specified period of time, in seconds, before<br>delivering it to S3. | `number` | `60` | no |
| <a name="input_buffering_size"></a> [buffering\_size](#input\_buffering\_size) | Buffer incoming data to the specified size, in MiBs, before delivering it<br>to S3. | `number` | `1` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets the OTEL\_EXPORTER\_OTL\_ENDPOINT environment variable for the lambda function. | `string` | `null` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets the OTEL\_EXPORTER\_OTLP\_ENDPOINT environment variable for the lambda function. | `string` | `null` | no |
| <a name="input_discovery_rate"></a> [discovery\_rate](#input\_discovery\_rate) | EventBridge rate expression for periodically triggering discovery. If not<br>set, no eventbridge rules are configured. | `string` | `null` | no |
| <a name="input_filter_name"></a> [filter\_name](#input\_filter\_name) | Subscription filter name. Existing filters that have this name as a prefix<br>will be removed. | `string` | `null` | no |
| <a name="input_filter_pattern"></a> [filter\_pattern](#input\_filter\_pattern) | Subscription filter pattern. | `string` | `null` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/logwriter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ variable "lambda_env_vars" {
}

variable "debug_endpoint" {
description = "Endpoint to send debugging telemetry to. Sets the OTEL_EXPORTER_OTL_ENDPOINT environment variable for the lambda function."
description = "Endpoint to send debugging telemetry to. Sets the OTEL_EXPORTER_OTLP_ENDPOINT environment variable for the lambda function."
type = string
default = null
}
}
2 changes: 1 addition & 1 deletion modules/stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module "collection_stack" {
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_config"></a> [config](#input\_config) | Variables for AWS Config collection. | <pre>object({<br> include_resource_types = list(string)<br> exclude_resource_types = optional(list(string))<br> delivery_frequency = optional(string)<br> include_global_resource_types = optional(bool)<br> })</pre> | `null` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets OTEL\_EXPORTER\_OTL\_ENDPOINT environment variable for supported lambda functions. | `string` | `null` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets OTEL\_EXPORTER\_OTLP\_ENDPOINT environment variable for supported lambda functions. | `string` | `null` | no |
| <a name="input_destination"></a> [destination](#input\_destination) | Destination filedrop | <pre>object({<br> arn = string<br> bucket = string<br> prefix = string<br> })</pre> | n/a | yes |
| <a name="input_forwarder"></a> [forwarder](#input\_forwarder) | Variables for forwarder module. | <pre>object({<br> source_bucket_names = optional(list(string), [])<br> source_topic_arns = optional(list(string), [])<br> content_type_overrides = optional(list(object({ pattern = string, content_type = string })), [])<br> max_file_size = optional(number)<br> lambda_memory_size = optional(number)<br> lambda_timeout = optional(number)<br> lambda_env_vars = optional(map(string))<br> retention_in_days = optional(number)<br> queue_max_receive_count = optional(number)<br> queue_delay_seconds = optional(number)<br> queue_message_retention_seconds = optional(number)<br> queue_batch_size = optional(number)<br> queue_maximum_batching_window_in_seconds = optional(number)<br> })</pre> | `{}` | no |
| <a name="input_logwriter"></a> [logwriter](#input\_logwriter) | Variables for AWS CloudWatch Logs collection. | <pre>object({<br> log_group_name_patterns = optional(list(string))<br> log_group_name_prefixes = optional(list(string))<br> buffering_interval = optional(number)<br> buffering_size = optional(number)<br> filter_name = optional(string)<br> filter_pattern = optional(string)<br> num_workers = optional(number)<br> discovery_rate = optional(string, "24 hours")<br> lambda_memory_size = optional(number)<br> lambda_timeout = optional(number)<br> })</pre> | `null` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/stack/forwarder.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ module "forwarder" {
queue_message_retention_seconds = var.forwarder.queue_message_retention_seconds
queue_batch_size = var.forwarder.queue_batch_size
queue_maximum_batching_window_in_seconds = var.forwarder.queue_maximum_batching_window_in_seconds
debug_endpoint = var.debug_endpoint
}
2 changes: 1 addition & 1 deletion modules/stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ variable "metricstream" {
}

variable "debug_endpoint" {
description = "Endpoint to send debugging telemetry to. Sets OTEL_EXPORTER_OTL_ENDPOINT environment variable for supported lambda functions."
description = "Endpoint to send debugging telemetry to. Sets OTEL_EXPORTER_OTLP_ENDPOINT environment variable for supported lambda functions."
type = string
default = null
}
2 changes: 1 addition & 1 deletion modules/subscriber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets the OTEL\_EXPORTER\_OTL\_ENDPOINT environment variable for the lambda function. | `string` | `""` | no |
| <a name="input_debug_endpoint"></a> [debug\_endpoint](#input\_debug\_endpoint) | Endpoint to send debugging telemetry to. Sets the OTEL\_EXPORTER\_OTLP\_ENDPOINT environment variable for the lambda function. | `string` | `""` | no |
| <a name="input_destination_iam_arn"></a> [destination\_iam\_arn](#input\_destination\_iam\_arn) | ARN for destination iam policy | `string` | n/a | yes |
| <a name="input_discovery_rate"></a> [discovery\_rate](#input\_discovery\_rate) | EventBridge scheduler rate expression for periodically triggering discovery. If not set, no scheduler is configured. | `string` | `""` | no |
| <a name="input_filter_name"></a> [filter\_name](#input\_filter\_name) | Subscription filter name. Existing filters that have this name as a prefix will be removed. | `string` | `"observe-logs-subscription"` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/subscriber/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "aws_lambda_function" "subscriber" {
VERBOSITY = 9
NUM_WORKERS = var.num_workers
OTEL_EXPORTER_OTLP_ENDPOINT = var.debug_endpoint
OTEL_TRACES_EXPORTER = var.debug_endpoint == "" ? "none" : "otlp"
}, var.lambda_env_vars)
}
}
}
4 changes: 2 additions & 2 deletions modules/subscriber/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ variable "lambda_env_vars" {
}

variable "debug_endpoint" {
description = "Endpoint to send debugging telemetry to. Sets the OTEL_EXPORTER_OTL_ENDPOINT environment variable for the lambda function."
description = "Endpoint to send debugging telemetry to. Sets the OTEL_EXPORTER_OTLP_ENDPOINT environment variable for the lambda function."
type = string
nullable = false
default = ""
}
}

0 comments on commit a235c1c

Please sign in to comment.