ApplicationInsights-PHP
ApplicationInsights-PHP copied to clipboard
PHP: trackEvent() not making it to App Insights
Hi All, I'm attempting to send an event with some custom data to App Insights and I'm not seeing ANY events appearing there. I have confirmed I'm using the correct Instrumentation Key and have used the same block below to send just an event 'name' for testing, with no luck. Any idea what I could be missing? I'm not seeing any errors and I'm not sure how else to troubleshoot this. Any help is much appreciated! My code block:
public static function uploadJobQueueDataAppInsights($intJobQueueId){
$strEventName = "GccJobQueueUpdate";
$objJobQueue = new JobQueue();
$objJobQueue->id = $intJobQueueId;
$objJobQueueDetails = $objJobQueue->getJobQueueById();
$arrJobQueueDetails = (array)$objJobQueueDetails;
if(isset($arrJobQueueDetails[0])){
$objTelemetryClient = new Telemetry_Client();
$objContext = $objTelemetryClient->getContext();
$objContext->setInstrumentationKey(Utilities::APP_INSIGHTS_INSTRUMENTATION_KEY);
$objTelemetryClient->trackEvent($strEventName, $arrJobQueueDetails[0]);
$objTelemetryClient->flush();
unset($objContext, $objTelemetryClient);
}
}
Try the latest version, trackEvent was finally fixed now it seems