Skip to content

Commit

Permalink
Fix instance_id in application telemetry (closes #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeemster committed Mar 8, 2023
1 parent 182861e commit 42f7267
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module "transformer_kinesis" {
|------|--------|---------|
| <a name="module_instance_type_metrics"></a> [instance\_type\_metrics](#module\_instance\_type\_metrics) | snowplow-devops/ec2-instance-type-metrics/aws | 0.1.2 |
| <a name="module_kcl_autoscaling"></a> [kcl\_autoscaling](#module\_kcl\_autoscaling) | snowplow-devops/dynamodb-autoscaling/aws | 0.2.0 |
| <a name="module_service"></a> [service](#module\_service) | snowplow-devops/service-ec2/aws | 0.1.0 |
| <a name="module_service"></a> [service](#module\_service) | snowplow-devops/service-ec2/aws | 0.1.1 |
| <a name="module_telemetry"></a> [telemetry](#module\_telemetry) | snowplow-devops/telemetry/snowplow | 0.4.0 |

## Resources
Expand Down
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ locals {
})

user_data = templatefile("${path.module}/templates/user-data.sh.tmpl", {
config = local.config
iglu_resolver = local.iglu_resolver
version = local.app_version
config_b64 = base64encode(local.config)
iglu_resolver_b64 = base64encode(local.iglu_resolver)
version = local.app_version

telemetry_script = join("", module.telemetry.*.amazon_linux_2_user_data)

Expand All @@ -380,7 +380,7 @@ locals {

module "service" {
source = "snowplow-devops/service-ec2/aws"
version = "0.1.0"
version = "0.1.1"

user_supplied_script = local.user_data
name = var.name
Expand Down
1 change: 0 additions & 1 deletion templates/config.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"secure": ${telemetry_secure}
"userProvidedId": "${telemetry_user_provided_id}"
"autoGeneratedId": "${telemetry_auto_gen_id}"
"instanceId": "$${TELEMETRY_INSTANCE_ID}"
"moduleName": "${telemetry_module_name}"
"moduleVersion": "${telemetry_module_version}"
}
Expand Down
20 changes: 4 additions & 16 deletions templates/user-data.sh.tmpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
readonly CONFIG_DIR=/opt/snowplow/config

sudo mkdir -p $${CONFIG_DIR}
sudo cat << EOF > $${CONFIG_DIR}/transformer_kinesis.json
${config}
EOF

sudo cat << EOF > $${CONFIG_DIR}/iglu_resolver.json
${iglu_resolver}
EOF

# Launch the loader
sudo docker run \
-d \
Expand All @@ -24,11 +13,10 @@ sudo docker run \
--log-opt max-size=10m \
--log-opt max-file=5 \
%{ endif ~}
-v $${CONFIG_DIR}:/snowplow/config \
-e 'JAVA_OPTS=${java_opts}' \
-e "TELEMETRY_INSTANCE_ID=$(get_instance_id)" \
-e 'JAVA_OPTS=-Dconfig.override_with_env_vars=true ${java_opts}' \
-e "CONFIG_FORCE_telemetry_instanceId=$(get_instance_id)" \
snowplow/transformer-kinesis:${version} \
--config $(base64 -w 0 $CONFIG_DIR/transformer_kinesis.json) \
--iglu-config $(base64 -w 0 $CONFIG_DIR/iglu_resolver.json)
--config ${config_b64} \
--iglu-config ${iglu_resolver_b64}

${telemetry_script}

0 comments on commit 42f7267

Please sign in to comment.