Azure Container Apps tracing for Go
You can set up tracing for Go applications that are deployed in Azure Container Apps by using the Instana Go in-process collector. To enable the Go in-process collector, instrument your application with the Instana Go Tracer SDK, deploy it to the Azure Container Apps, and ensure that the necessary environment variables are set.
Supported runtimes
Instana Go in-process collector supports Go 1.21 and later.
Limitations
Currently, Instana doesn't support collecting infrastructure metrics of Azure Container Apps.
Setting up Azure Container Apps tracing for Go
To set up Azure Container Apps tracing for Go, see the following sections:
Prerequisites
Ensure that you use the latest version of the Go in-process
collector module. To make sure that you are using the latest
version of the Go in-process collector module, check the
go.mod file in your project or run the following
command:
go get github.com/instana/go-sensor@latest
If you do not have the latest Go in-process collector, download
the latest version and update the required version in the
go.mod file. For more information, see Go installation.
Configuring Azure Container Apps
Instana
Go in-process collector 1.63.0 supports Azure Container Apps in
its Azure agent. After you instrument your Go application with the
Instana Go Tracer SDK, the Instana Go in-process collector switches
to serverless mode. Instead of sending collected spans to the host
agent, the collector submits them directly to the Instana
serverless acceptor endpoint, which is configured with the help of
INSTANA_ENDPOINT_URL
environmental
variable.
This process uses an agent key that is defined in the
INSTANA_AGENT_KEY
environment
variable. The Azure Container Apps' resource ID is used as the
entity ID for infrastructure correlation. To construct the resource
ID, the environment variables
AZURE_SUBSCRIPTION_ID
and
AZURE_RESOURCE_GROUP
need to be
set.
To send collected spans to the Instana backend, set the following environment variables in Azure Container Apps:
-
INSTANA_ENDPOINT_URL: Set to the URL of your Instana backend endpoint. -
INSTANA_AGENT_KEY: Set to your agent key. -
INSTANA_TIMEOUT: Set to an appropriate timeout value that depends on the zone that you configured.
For infrastructure correlation, set the following environment variables:
-
AZURE_SUBSCRIPTION_ID: Set to your Azure subscription ID. -
AZURE_RESOURCE_GROUP: Set to your Azure resource group.
Enabling tracing
To enable tracing for a Go application in Azure Container Apps, complete the following steps:
-
After you download the Instana Go Tracer SDK, instrument your application with the downloaded SDK.
-
Create a container image of your application.
-
Deploy the container image to Azure Container Apps.
Note: Before you deploy the image, ensure that the required environment variables are set in Azure Container Apps. For more information, see Configuring Azure Container Apps.
Now you can view your Go application traces in the Instana UI.
Example
Suppose that you have a web server that is written with
gin. To enable tracing, instrument your application by
using the Instana Go Tracer SDK
github.com/instana/go-sensor/tree/main/instrumentation/instagin
.
Then, create a container image of your application and deploy it in
Azure Container Apps. Ensure that you set the required environment
variables when you deploy the image.