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

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

Description

@cobydodd

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

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions