Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/dotnet-ec2-default-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ on:
required: false
type: string
default: '8.0'
cpu-architecture:
description: "Permitted values: x86_64 or arm64"
required: false
type: string
default: "x86_64"
outputs:
job-started:
value: ${{ jobs.dotnet-ec2-default.outputs.job-started }}
Expand Down Expand Up @@ -96,12 +101,13 @@ jobs:

- name: Set Get ADOT Distro command environment variable
run: |
ARCH_SUFFIX=${{ inputs.cpu-architecture == 'arm64' && 'arm64' || 'x64' }}
if [ "${{ env.REPOSITORY_NAME }}" = "aws-otel-dotnet-instrumentation" ]; then
# Get staging distro file from staging bucket
echo GET_ADOT_DISTRO_COMMAND="aws s3 cp s3://adot-autoinstrumentation-dotnet-staging/${{ env.ADOT_DISTRO_NAME }} ./${{ env.ADOT_DISTRO_NAME }} && unzip -d dotnet-distro ${{ env.ADOT_DISTRO_NAME }}" >> $GITHUB_ENV
else
# After Release will switch to latest tag instead of hard code version for canary purpose
echo GET_ADOT_DISTRO_COMMAND="wget -O aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip https://github.com/aws-observability/aws-otel-dotnet-instrumentation/releases/latest/download/aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip && unzip -d dotnet-distro aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip" >> $GITHUB_ENV
echo GET_ADOT_DISTRO_COMMAND="wget -O aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip https://github.com/aws-observability/aws-otel-dotnet-instrumentation/releases/latest/download/aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && unzip -d dotnet-distro aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip" >> $GITHUB_ENV
fi

- name: Set Get CW Agent command environment variable
Expand Down Expand Up @@ -149,6 +155,7 @@ jobs:
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
-var="get_adot_distro_command=${{ env.GET_ADOT_DISTRO_COMMAND }}" \
-var="language_version=${{ env.DOTNET_VERSION }}" \
-var="cpu_architecture=${{ inputs.cpu-architecture }}" \
|| deployment_failed=$?

if [ $deployment_failed -eq 1 ]; then
Expand Down
18 changes: 12 additions & 6 deletions terraform/dotnet/ec2/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ data "aws_ami" "ami" {
most_recent = true
filter {
name = "name"
values = ["al20*-ami-minimal-*-x86_64"]
values = ["al20*-ami-minimal-*-${var.cpu_architecture}"]
}
filter {
name = "state"
values = ["available"]
}
filter {
name = "architecture"
values = ["x86_64"]
values = [var.cpu_architecture]
}
filter {
name = "image-type"
Expand All @@ -79,7 +79,7 @@ data "aws_ami" "ami" {

resource "aws_instance" "main_service_instance" {
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
instance_type = "t3.small"
instance_type = var.cpu_architecture == "x86_64" ? "t3.small" : "t4g.small"
key_name = local.ssh_key_name
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]
Expand Down Expand Up @@ -140,12 +140,15 @@ resource "null_resource" "main_service_setup" {
current_dir=$(pwd)
echo $current_dir

# Set architecture-specific path
ARCH_PATH="${var.cpu_architecture == "x86_64" ? "linux-x64" : "linux-arm64"}"

# Export environment variables for instrumentation
cd ./asp_frontend_service
dotnet build
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/$ARCH_PATH/OpenTelemetry.AutoInstrumentation.Native.so
export DOTNET_ADDITIONAL_DEPS=$current_dir/dotnet-distro/AdditionalDeps
export DOTNET_SHARED_STORE=$current_dir/dotnet-distro/store
export DOTNET_STARTUP_HOOKS=$current_dir/dotnet-distro/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
Expand Down Expand Up @@ -188,7 +191,7 @@ resource "null_resource" "main_service_setup" {

resource "aws_instance" "remote_service_instance" {
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
instance_type = "t3.small"
instance_type = var.cpu_architecture == "x86_64" ? "t3.small" : "t4g.small"
key_name = local.ssh_key_name
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]
Expand Down Expand Up @@ -249,12 +252,15 @@ resource "null_resource" "remote_service_setup" {
current_dir=$(pwd)
echo $current_dir

# Set architecture-specific path
ARCH_PATH="${var.cpu_architecture == "x86_64" ? "linux-x64" : "linux-arm64"}"

# Export environment variables for instrumentation
cd ./asp_remote_service
dotnet build
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/$ARCH_PATH/OpenTelemetry.AutoInstrumentation.Native.so
export DOTNET_ADDITIONAL_DEPS=$current_dir/dotnet-distro/AdditionalDeps
export DOTNET_SHARED_STORE=$current_dir/dotnet-distro/store
export DOTNET_STARTUP_HOOKS=$current_dir/dotnet-distro/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
Expand Down
4 changes: 4 additions & 0 deletions terraform/dotnet/ec2/default/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ variable "canary_type" {

variable "language_version" {
default = "8.0"
}

variable "cpu_architecture" {
default = "x86_64"
}