# This Source Code Form is subject to the terms of the Mozilla Public↩
# License, v. 2.0. If a copy of the MPL was not distributed with this↩
# file, You can obtain one at http://mozilla.org/MPL/2.0/.↩

# Adding a new metric? We have docs for that!↩
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html↩

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Core :: Machine Learning'


firefox.ai.runtime:
  engine_creation_success:
    type: labeled_timing_distribution
    time_unit: millisecond
    description: >
      An inference engine was created
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891685
    data_reviews:
      - https://phabricator.services.mozilla.com/D238583
    data_sensitivity:
      - interaction
    notification_emails:
      - tziade@mozilla.com
    expires: never
    labels:
      - autofill-ml
      - pdfjs
      - ml-suggest-intent
      - ml-suggest-ner
      - about-inference
      - webextension
      - default-engine

  engine_creation_failure:
    type: event
    description: >
      An inference engine has failed to create
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891685
    data_reviews:
      - https://phabricator.services.mozilla.com/D238583
    data_sensitivity:
      - interaction
    notification_emails:
      - tziade@mozilla.com
    expires: never
    extra_keys:
      modelId:
        type: string
        description: model id
      featureId:
        description: feature id
        type: string
      taskName:
        description: taskName id
        type: string
      engineId:
        description: engine id
        type: string
      error:
        description: error class
        type: string

  run_inference_failure:
    type: event
    description: >
      An inference run has failed
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891685
    data_reviews:
      - https://phabricator.services.mozilla.com/D238583
    data_sensitivity:
      - interaction
    notification_emails:
      - tziade@mozilla.com
    expires: never
    extra_keys:
      modelId:
        type: string
        description: model id
      featureId:
        description: feature id
        type: string
      engineId:
        description: Engine id
        type: string

  run_inference_success:
    type: labeled_timing_distribution
    time_unit: millisecond
    description: >
      An inference engine was created
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891685
    data_reviews:
      - https://phabricator.services.mozilla.com/D238583
    data_sensitivity:
      - interaction
    notification_emails:
      - tziade@mozilla.com
    expires: never
    labels:
      - autofill-ml
      - pdfjs
      - ml-suggest-intent
      - ml-suggest-ner
      - about-inference
      - webextension
      - default-engine
