Migrate from Azure Monitor to TraceKit
Azure Monitor Application Insights ties your observability to Azure. TraceKit provides the same distributed tracing and application monitoring across any cloud or on-premise infrastructure.
Start FreeReplace Application Insights SDK with TraceKit SDK
Remove the Application Insights SDK package and install TraceKit. Application Insights uses a connection string or instrumentation key for authentication; TraceKit uses an API key.
| Category | Azure Monitor | TraceKit | Notes |
|---|---|---|---|
| Package | Microsoft.ApplicationInsights (.NET) | github.com/tracekit/go-sdk (Go) | Cross-language SDK replacement |
| Package | applicationinsights (npm) | @tracekit/node-apm (npm) | Node.js SDK replacement |
| Package | opencensus-ext-azure (pip) | tracekit-apm (pip) | Python SDK replacement |
Map Connection String and Instrumentation Key
Replace the Application Insights connection string or instrumentation key with TraceKit's API key. Remove Azure-specific configuration from your application settings.
| Category | Azure Monitor | TraceKit | Notes |
|---|---|---|---|
| Authentication | APPLICATIONINSIGHTS_CONNECTION_STRING | TRACEKIT_API_KEY + TRACEKIT_ENDPOINT | Connection string splits into key + endpoint |
| Authentication | APPINSIGHTS_INSTRUMENTATIONKEY (legacy) | TRACEKIT_API_KEY | Legacy key maps to API key |
| Service Identity | CloudRoleName | TRACEKIT_SERVICE_NAME | Cloud role maps to service name |
| Service Identity | CloudRoleInstance | TRACEKIT_TAGS (instance=value) | Instance identity via tags |
Migrate TelemetryClient API Calls
Replace Application Insights TelemetryClient API calls with TraceKit span operations. Application Insights has separate methods for requests, dependencies, traces, and exceptions; TraceKit unifies these as span attributes and events.
| Category | Azure Monitor | TraceKit | Notes |
|---|---|---|---|
| Initialization | new TelemetryClient(connectionString) | tracekit.Init(apiKey) | SDK initialization |
| Requests | TrackRequest(name, startTime, duration, responseCode) | tracekit.StartSpan(ctx, name) with http.* attributes | Requests become spans with HTTP attributes |
| Dependencies | TrackDependency(name, target, data, startTime, duration) | tracekit.StartSpan(ctx, name) | Dependencies become child spans |
| Exceptions | TrackException(exception, properties) | span.RecordError(err) | Exceptions attached to active span |
| Custom Events | TrackEvent(name, properties, metrics) | span.AddEvent(name, attributes) | Custom events become span events |
Update Sampling and Telemetry Processors
Replace Application Insights adaptive sampling and telemetry processors with TraceKit's sampling configuration. Application Insights uses adaptive sampling by default; TraceKit uses a fixed sample rate you control.
| Category | Azure Monitor | TraceKit | Notes |
|---|---|---|---|
| Sampling | AdaptiveSamplingTelemetryProcessor | TRACEKIT_SAMPLE_RATE (0.0-1.0) | Fixed rate replaces adaptive sampling |
| Filtering | ITelemetryProcessor (custom filter pipeline) | tracekit.WithIgnoreEndpoints(patterns) | SDK-level endpoint filtering |
| Enrichment | ITelemetryInitializer (add properties) | tracekit.WithDefaultAttributes(attrs) | Default attributes added to all spans |
Verify Traces and Migrate Workbooks
Deploy the updated application and verify traces appear in TraceKit. Application Insights Workbooks and Kusto (KQL) queries can be recreated using TraceKit's dashboard filters and built-in views.
| Category | Azure Monitor | TraceKit | Notes |
|---|---|---|---|
| Verification | Azure Portal > Application Insights > Transaction Search | TraceKit Dashboard > Traces | Verify trace capture and search |
| Verification | Application Map | TraceKit Service Map | Verify service dependency view |
| Dashboards | Workbooks (KQL queries) | TraceKit Dashboard (built-in views) | Built-in latency, error rate, throughput views |
Code Examples
Before (Azure Monitor)
// Azure Monitor: Use OpenCensus or OTel with Azure exporter
import (
"contrib.go.opencensus.io/exporter/ocagent"
"go.opencensus.io/trace"
)
func main() {
exp, _ := ocagent.NewExporter(
ocagent.WithInsecure(),
ocagent.WithServiceName("my-service"),
ocagent.WithAddress("localhost:55678"),
)
trace.RegisterExporter(exp)
ctx, span := trace.StartSpan(ctx, "process-order")
span.AddAttributes(trace.StringAttribute("order.id", "12345"))
defer span.End()
}After (TraceKit)
import "github.com/tracekit/go-sdk/tracekit"
func main() {
tracekit.Init("tk_your_api_key",
tracekit.WithService("my-service"),
tracekit.WithEnvironment("production"),
)
defer tracekit.Shutdown(context.Background())
ctx, span := tracekit.StartSpan(context.Background(), "process-order")
span.SetAttribute("order.id", "12345")
defer span.End()
}Before (Azure Monitor)
const appInsights = require('applicationinsights');
appInsights.setup('InstrumentationKey=your-key;IngestionEndpoint=https://dc.services.visualstudio.com')
.setAutoDependencyCorrelation(true)
.setAutoCollectRequests(true)
.start();
const client = appInsights.defaultClient;
client.trackRequest({ name: 'GET /api/orders', url: '/api/orders', duration: 125, resultCode: 200, success: true });
client.trackDependency({ target: 'db-server', name: 'SELECT orders', duration: 45, resultCode: 0, success: true, dependencyTypeName: 'SQL' });
client.trackException({ exception: new Error('Order not found') });After (TraceKit)
const tracekit = require('@tracekit/node-apm');
tracekit.init({
apiKey: 'tk_your_api_key',
service: 'my-service',
environment: 'production',
});
const span = tracekit.startSpan('GET /api/orders');
span.setAttribute('http.status_code', 200);
const dbSpan = tracekit.startSpan('SELECT orders', { parent: span });
dbSpan.setAttribute('db.system', 'sql');
dbSpan.end();
span.recordError(new Error('Order not found'));
span.end();Before (Azure Monitor)
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.tracer import Tracer
tracer = Tracer(
exporter=AzureExporter(
connection_string='InstrumentationKey=your-key'
),
)
with tracer.span(name='process-order') as span:
span.add_attribute('order.id', '12345')
# ... business logicAfter (TraceKit)
import tracekit
tracekit.init(
api_key='tk_your_api_key',
service='my-service',
environment='production',
)
with tracekit.start_span('process-order') as span:
span.set_attribute('order.id', '12345')
# ... business logicRelated Resources
Chi Observability
Chi embraces the Go stdlib -- but its compositional routing means middleware chains can be deeply nested, subrouters create invisible context boundaries, and Use/With/Group patterns interact in ways that are hard to trace. TraceKit makes Chi's composition visible.
Go Distributed Tracing Guide
Learn distributed tracing patterns and best practices for Go
APM Implementation Checklist
Step-by-step APM implementation checklist covering SDK installation, instrumentation, alerting, and production rollout with OpenTelemetry best practices.
OTel Config Generator
Generate OpenTelemetry Collector configurations for your stack
Ready to migrate?
Start your free TraceKit account and follow this guide to migrate from Azure Monitor in 1-2 hours.
Start Free Migration