Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

PHP: trackEvent() not making it to App Insights #65

Open
cobydodd opened this issue Apr 5, 2019 · 1 comment
Open

PHP: trackEvent() not making it to App Insights #65

cobydodd opened this issue Apr 5, 2019 · 1 comment

Comments

@cobydodd
Copy link

cobydodd commented Apr 5, 2019

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);
}

}

@MichelZ
Copy link

MichelZ commented Apr 28, 2019

Try the latest version, trackEvent was finally fixed now it seems

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants