# -*- mode: yaml; tab-width: 2; indent-tabs-mode: nil; -*-

# AUTOGENERATED BY ./scripts/codegen.py. DO NOT EDIT.

# 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/.

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0

$tags:
  - "Toolkit :: Gecko Trace"

gecko_trace:
  traces:
    type: object
    description: >
      Represents the telemetry traces data collected during browser operation. This data
      provides insights into errors that occur in Firefox during runtime.

      Based on the [TracesData OTLP](1) protobuf definition which provides a standardized
      format for collecting and transmitting trace information.

      [1]: https://github.com/open-telemetry/opentelemetry-proto/blob/c0a98a1847d3124ac5f9ecd02d0e2d2732bbb590/opentelemetry/proto/trace/v1/trace.proto#L38
    send_in_pings:
      - traces
    notification_emails:
      - mvanstraten@mozilla.com
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1930954
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1930954
    expires: never
    version: 0.1
    structure:
      type: object
      properties:
        resource_spans:
          type: array
          items:
            type: object
            properties:
              # A resource represents the entity producing telemetry data, identified by a set
              # of resource attributes.
              #
              # For example, a gecko process producing traces in Firefox has a process ID and
              # a process type (e.g., ContentChild). The opentelemetry-cpp library additionally
              # enforces four extra resource attributes which are listed below. These attributes
              # help identify the source and context of the telemetry data.
              #
              # For more information, see:
              # https://opentelemetry.io/docs/concepts/resources/
              resource:
                type: object
                properties:
                  attributes:
                    type: object
                    properties:
                      gecko.process.internal_id:
                        type: number
                      gecko.process.type:
                        type: string
                      service.name:
                        type: string
                      telemetry.sdk.language:
                        type: string
                      telemetry.sdk.name:
                        type: string
                      telemetry.sdk.version:
                        type: string
              scope_spans:
                type: array
                items:
                  type: object
                  properties:
                    # Instrumentation scope represents a logical unit within the application code with
                    # which the emitted telemetry can be associated. This helps in organizing and
                    # categorizing telemetry data based on its origin within the codebase.
                    #
                    # For more information, see:
                    # https://opentelemetry.io/docs/concepts/instrumentation-scope/
                    scope:
                      type: object
                      properties:
                        name:
                          type: string
                    # A list of Spans that originate from an instrumentation scope. Spans represent
                    # individual operations or units of work within a trace and contain timing,
                    # metadata, and event information about these operations.
                    #
                    # For more information, see:
                    # https://opentelemetry.io/docs/concepts/signals/traces/#spans
                    spans:
                      type: array
                      items:
                        type: object
                        properties:
                          # A unique identifier for a trace. All spans from the same trace share
                          # the same `trace_id`, allowing related spans to be grouped together
                          # and analyzed as a single transaction or operation flow.
                          trace_id:
                            type: string
                          # A unique identifier for a span within a trace. This ID distinguishes
                          # each span from others within the same trace.
                          span_id:
                            type: string
                          # The `span_id` of this span's parent span. This establishes the
                          # hierarchical relationship between spans, creating a tree structure
                          # that represents the execution path.
                          parent_span_id:
                            type: string
                          # A human-readable description of the operation represented by this span.
                          name:
                            type: string
                          start_time_unix_nano:
                            type: number
                          end_time_unix_nano:
                            type: number
                          # Events are time-stamped annotations within a span that mark significant
                          # moments or state changes during the span's lifetime.
                          events:
                            type: array
                            items:
                              type: object
                              properties:
                                name:
                                  type: string
                                # The time the event occurred.
                                time_unix_nano:
                                  type: number
                                # A collection of attribute key/value pairs associated with the event.
                                # These attributes provide detailed information about the event's
                                # context, parameters, and results.
                                #
                                # New attribute key/value pairs can be defined in gecko-trace.yaml
                                # files.
                                attributes:
                                  type: object
                                  properties:
                                    # Generated from: toolkit/components/gecko-trace/gecko-trace.yaml:11:4
                                    source.file:
                                      type: string
                                    source.line:
                                      type: number
                                    # Generated from: dom/quota/gecko-trace.yaml:3:4
                                    frame_id:
                                      type: string
                                    result:
                                      type: string
                                    severity:
                                      type: string
