Untitled

Overview

Protocol for handling instrumentation events from the Agentforce SDK. This protocol defines the interface for receiving and processing analytics and monitoring events generated throughout the SDK. Implementations can integrate with various analytics platforms, logging systems, or monitoring services.

Declaration

protocol AgentforceInstrumentationHandling

Methods

Method Signature Description
handleInstrumentationEvent func handleInstrumentationEvent(event: AgentforceInstrumentationEvent) Processes an instrumentation event from the Agentforce SDK.

Implementation Patterns

Analytics Integration

class AnalyticsHandler: AgentforceInstrumentationHandling {
    func handleInstrumentationEvent(event: AgentforceInstrumentationEvent) {
        switch event {
        case .userInteractionEvent(let eventInfo):
            Analytics.track(eventInfo.name, properties: eventInfo.properties)
        case .perfEvent(let eventInfo):
            PerformanceMonitor.recordTiming(eventInfo.name,
                                          duration: eventInfo.endTime - eventInfo.startTime)
        case .errorEvent(let eventInfo):
            ErrorTracker.logError(eventInfo.error, context: eventInfo.properties)
        }
    }
}

Multi-Platform Handling

class MultiPlatformHandler: AgentforceInstrumentationHandling {
    private let analyticsProviders: [AnalyticsProvider]

    func handleInstrumentationEvent(event: AgentforceInstrumentationEvent) {
        // Send to multiple analytics platforms
        analyticsProviders.forEach { provider in
            provider.track(event)
        }
    }
}