Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Telemetry class Error in D365 .42 version

(3) ShareShare
ReportReport
Posted on by 72
Hi,

I am getting the below error while running a batch job and it
 
Method not found: 'Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase.addProperty(Dynamics.AX.Application.SysApplicationInsightsProperty)'.
Telemetry Event Processing Error: className : CustomTelemetryBatchLogging - EventName: Custom BATCH ERROR
Batch task failed: MissingMethodException
 
I have extended the global class for logging the telemetry but getting the above errors , I havent called the "SysApplicationInsightsTelemetryContractBase" class but it seems it is referring somewhere .
This was working fine long time back but it has started giving error recently.
 
thanks,
VK
Categories:
  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    Telemetry class Error in D365 .42 version
    You surely can create classes like TelemetryPurchaseOrderConfirm, but that doesn't mean that you need to duplicate the component communicating with Application Insights. Your classes can use the existing API and simply add any logic on top of it. The standard feature expicitly supports custom events and metrics.
  • VM-02050213-0 Profile Picture
    VM-02050213-0 72 on at
    Telemetry class Error in D365 .42 version
    Thanks Martin for taking out time to check the telemetry code.
    I have written similar code previously but as per Microsoft this is an old way and a better approach is to create the custom classes for processes and extend them to telemetry classes as per link D365-FO-MonitoringAndTelemetry-Samples and then add those properties.
    We can even enable /disable logging for those processes.
     
    Map properties = new Map(Types::String, Types::String);
    properties.add('Feature', 'My feature 1');
    properties.add('MyCorrelationId', '123456');
     
    SysGlobalTelemetry::logTraceWithCustomProperties('Custom message from X++', properties)
    For Eg.
    final class TelemetryPurchaseOrderConfirm extends MyTelemetryBase
    protected void populateProperties()
        {
            // Setting elapsed milliseconds in the concrete implementation so that the implementer can decide what is the right way to get elapsed time.
            this.setElapsedMilliseconds();
            this.addBaseProperty(MyApplicationInsightsEventProperties::PurchId, purchTable.PurchId);
            this.addBaseProperty(MyApplicationInsightsEventProperties::PurchStatus, strFmt("%1", purchTable.PurchStatus));
            this.addBaseProperty(MyApplicationInsightsEventProperties::DeliveryDate, DateTimeUtil::toStr(purchTable.DeliveryDate));
        }
    If I want I can enable or disable the metric for this later on .
    The major reason is that the std code is generic and it wont print more details about a process. For example lets say a PO invoice is done in for 1000's of line and we will get a generic error and wont get the exact line where the error sits for which line and hence the customization.

    Thanks,
    VK
  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    Telemetry class Error in D365 .42 version
    Now you seem to be mixing two different things.
     
    The setup doesn't seem to be related to your extension of Global::error() at all. It's about custom events that you'll call from places like WhsShipConfirm_Extension. You believe that you must develop your own solution because the one from Microsoft doesn't support custom properties, but it's not true. It can be done by code like this:
    Map properties = new Map(Types::String, Types::String);
    properties.add('Feature', 'My feature 1');
    properties.add('MyCorrelationId', '123456');
     
    SysGlobalTelemetry::logTraceWithCustomProperties('Custom message from X++', properties)
    Therefore both scenarios are covered by SysGlobalTelemetry, so you don't have to invest time fixing your custom solution.
  • VM-02050213-0 Profile Picture
    VM-02050213-0 72 on at
    Telemetry class Error in D365 .42 version
    Hi Martin,
     
    The problem is that the std telemetry does not have proper dimension in place to create the dashboards and with the custom ones we can add our own dimension to monitor and add more details as well.

    So we can enable and disable the logging for any custom process from the below screen.
    HowToDisableParticularTelemetry.png
    So the issue is that I am getting the error logs for other processes but not for a particular one and the erroneous batch job has the same try catch methodology implemented.
    What i am not able to figure out is for the below error the standard class "SysApplicationInsightsTelemetryContractBase" is not even having the add property method so from where its being called . its not even showing in the debug. Is there a way i can check if this class is updated to new version ?

    Method not found: 'Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase.addProperty(Dynamics.AX.Application.SysApplicationInsightsProperty)'.
    Telemetry Event Processing Error: className : CustomTelemetryBatchLogging - EventName: Custom BATCH ERROR
    Batch task failed: MissingMethodException
     
    thanks,
    VK
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    Telemetry class Error in D365 .42 version
    What you're trying to implement is already included in F&O out-of-the-box, therefore the right fix likely is throwing your code away.
     
    There is a feature called Monitoring and telemetry that covers your scenario - and several others. The logging of errors is implemented in SysGlobalTelemetry::Global_Pre_error() method. To learn more, check out Dynamics 365 Finance & Operations Monitoring and Telemetry using Application Insights, for instance.
  • VM-02050213-0 Profile Picture
    VM-02050213-0 72 on at
    Telemetry class Error in D365 .42 version
    Hi Martin,
     
    I am calling the prehandler for 
     [PreHandlerFor(classStr(Global), staticMethodStr(Global, error))]
    and then getting the below error. It is actually overriding the std error message.
    Method not found: 'Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase Dynamics.AX.Application.SysApplicationInsightsTelemetryContractBase.addProperty(Dynamics.AX.Application.SysApplicationInsightsProperty)'.
    Telemetry Event Processing Error: className : CustomTelemetryBatchLogging - EventName: Custom BATCH ERROR
    Batch task failed: MissingMethodException
     
    Thanks,
    Vikas
  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    Telemetry class Error in D365 .42 version
    What is the code causing the error?
     
    Do I understand correctly that the standard Monitoring and telemetry works a bug is only in your CustomTelemetryBatchLogging class?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans