TracekitTracekit
Intermediate1-2 hours

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.

Migration Steps

1

Replace 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.

CategoryBeforeAfter (TraceKit)Notes
PackageMicrosoft.ApplicationInsights (.NET)github.com/tracekit/go-sdk (Go)Cross-language SDK replacement
Packageapplicationinsights (npm)@tracekit/node-apm (npm)Node.js SDK replacement
Packageopencensus-ext-azure (pip)tracekit-apm (pip)Python SDK replacement
2

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.

CategoryBeforeAfter (TraceKit)Notes
AuthenticationAPPLICATIONINSIGHTS_CONNECTION_STRINGTRACEKIT_API_KEY + TRACEKIT_ENDPOINTConnection string splits into key + endpoint
AuthenticationAPPINSIGHTS_INSTRUMENTATIONKEY (legacy)TRACEKIT_API_KEYLegacy key maps to API key
Service IdentityCloudRoleNameTRACEKIT_SERVICE_NAMECloud role maps to service name
Service IdentityCloudRoleInstanceTRACEKIT_TAGS (instance=value)Instance identity via tags
3

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.

CategoryBeforeAfter (TraceKit)Notes
Initializationnew TelemetryClient(connectionString)tracekit.Init(apiKey)SDK initialization
RequestsTrackRequest(name, startTime, duration, responseCode)tracekit.StartSpan(ctx, name) with http.* attributesRequests become spans with HTTP attributes
DependenciesTrackDependency(name, target, data, startTime, duration)tracekit.StartSpan(ctx, name)Dependencies become child spans
ExceptionsTrackException(exception, properties)span.RecordError(err)Exceptions attached to active span
Custom EventsTrackEvent(name, properties, metrics)span.AddEvent(name, attributes)Custom events become span events
4

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.

CategoryBeforeAfter (TraceKit)Notes
SamplingAdaptiveSamplingTelemetryProcessorTRACEKIT_SAMPLE_RATE (0.0-1.0)Fixed rate replaces adaptive sampling
FilteringITelemetryProcessor (custom filter pipeline)tracekit.WithIgnoreEndpoints(patterns)SDK-level endpoint filtering
EnrichmentITelemetryInitializer (add properties)tracekit.WithDefaultAttributes(attrs)Default attributes added to all spans
5

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.

CategoryBeforeAfter (TraceKit)Notes
VerificationAzure Portal > Application Insights > Transaction SearchTraceKit Dashboard > TracesVerify trace capture and search
VerificationApplication MapTraceKit Service MapVerify service dependency view
DashboardsWorkbooks (KQL queries)TraceKit Dashboard (built-in views)Built-in latency, error rate, throughput views

Code Examples

Go
Before
// 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()
}
Node.js
Before
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();
Python
Before
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 logic
After (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 logic

Ready to migrate?

Start free and move your traces to TraceKit in 1-2 hours.

Start Free