> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel MetricCalculation

> Cancels the metric calculation. Only applicable for a currently running metric calculation.



## OpenAPI

````yaml /api/metrics/api/metric-calculation.openapi.json post /v1/scheduledMetricCalculations/{scheduledMetricCalculation}/metricCalculations/{metricCalculation}:cancel
openapi: 3.1.0
info:
  title: Confidence Metric-calculation API
  version: 1.0.0
  description: API documentation for metric-calculation
servers: []
security: []
paths:
  /v1/scheduledMetricCalculations/{scheduledMetricCalculation}/metricCalculations/{metricCalculation}:cancel:
    post:
      summary: Cancel MetricCalculation
      description: >-
        Cancels the metric calculation. Only applicable for a currently running
        metric calculation.
      operationId: MetricCalculation.cancel
      parameters:
        - name: scheduledMetricCalculation
          in: path
          required: true
          schema:
            type: string
        - name: metricCalculation
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties: {}
        required: true
      responses:
        '200':
          description: >-
            Returns a
            [MetricCalculation](/api-reference/schemas/metriccalculation).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/confidence.metrics.v1.MetricCalculation'
      security:
        - admin: []
      servers:
        - url: https://metrics.eu.confidence.dev
        - url: https://metrics.us.confidence.dev
        - url: https://metrics.confidence.dev
components:
  schemas:
    confidence.metrics.v1.MetricCalculation:
      title: MetricCalculation
      type: object
      description: Represents the calculation of a metric for a specific time window.
      properties:
        name:
          type: string
          description: |-
            Unique identifier of the metric calculation.
             For example: `metricCalculations/0smva5nxuhv4yts6paxt`
        metricCalculationSpec:
          type: object
          properties:
            metric:
              type: string
              description: The metric to calculate.
            exposureTable:
              type: string
              description: The exposure table used for the calculation.
            splitDimensions:
              type: array
              items:
                type: object
                properties:
                  column:
                    type: string
                  factTable:
                    type: string
                  dimensionTable:
                    type: string
                  exposureTable:
                    type: string
                required:
                  - column
              description: Dimensions to calculate the metric on.
            measurementTable:
              type: string
              description: >-
                Internal reference to a measurement table when the metric is
                open.
            exposureGroups:
              type: array
              items:
                type: string
              description: >-
                Groups to filter exposure by. Leave empty to use all groups in
                exposure table.
          required:
            - metric
            - exposureTable
          description: The metric to calculate.
        startTime:
          type: object
          description: Start time of the calculation in terms of exposure.
        endTime:
          type: object
          description: >-
            End time of the calculation in terms of facts. Must be set if
            exposure_end_time is not set,
             if exposure_end_time is set, this field will be set to the inferred fact end time.
        state:
          type: string
          enum:
            - STATE_UNSPECIFIED
            - STATE_FAILED
            - STATE_RUNNING
            - STATE_COMPLETED
            - STATE_CANCELLED
          description: Current state of the calculation.
        metricResults:
          type: object
          properties:
            metricBucketStats:
              type: array
              items:
                type: object
                properties:
                  dimensions:
                    type: array
                    items:
                      type: object
                      properties:
                        dimension:
                          type: string
                          description: Name of the dimension.
                        value:
                          type: string
                          description: Value of the dimension.
                    description: Set of dimensions the metric was computed on.
                  summaryStats:
                    type: object
                    properties:
                      averageSummaryStats:
                        type: object
                        properties:
                          sum:
                            type: number
                            description: Sum of values.
                          sumOfSquares:
                            type: number
                            description: |2-

                               Sum of squared values.
                          count:
                            type: integer
                            description: >-
                              Number of entities with a non-missing measurement
                              after handling nulls.
                          countMissing:
                            type: integer
                            description: >-
                              Number of entities with a missing measurement
                              before handling nulls.
                          countMissingRows:
                            type: integer
                            description: Total number of rows with a missing measurement.
                          mean:
                            type: number
                            description: Mean of values.
                          variance:
                            type: number
                            description: Variance of values.
                          varianceReductionStats:
                            type: object
                            properties:
                              count:
                                type: integer
                                description: >-
                                  Number of entities with a non-missing pre- and
                                  post measurement after handling nulls.
                              countMissing:
                                type: integer
                                description: >-
                                  Number of entities with a missing pre- and
                                  post measurement before handling nulls.
                              countMissingRows:
                                type: integer
                                description: >-
                                  Total number of rows with a missing pre
                                  exposure measurement.
                              sum:
                                type: number
                                description: Sum of values.
                              postSum:
                                type: number
                                description: >-
                                  Sum of post exposure measurements that had a
                                  non-missing pre exposure measurement.
                              postCount:
                                type: integer
                                description: >-
                                  Count of post exposure entities that had a
                                  non-missing pre exposure measurement.
                              sumOfSquares:
                                type: number
                                description: |2-

                                   Sum of squared values.
                              sumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre and post exposure values.
                              mean:
                                type: number
                                description: Mean of values.
                              variance:
                                type: number
                                description: Variance of values.
                              covariance:
                                type: number
                                description: >-
                                  Covariance between pre and post exposure
                                  measurements.
                            description: Summary statistics for variance reduction.
                        description: Summary statistics for an average metric.
                      ratioSummaryStats:
                        type: object
                        properties:
                          numeratorSum:
                            type: number
                            description: Sum of numerator values.
                          numeratorSumOfSquares:
                            type: number
                            description: |2-

                               Sum of squared numerator values.
                          denominatorSum:
                            type: number
                            description: Sum of denominator values.
                          denominatorSumOfSquares:
                            type: number
                            description: |2-

                               Sum of squared denominator values.
                          sumOfProducts:
                            type: number
                            description: |2-

                               Sum of product between numerator and denominator.
                          count:
                            type: integer
                            description: >-
                              Number of entities with a non-missing numerator
                              and denominator after handling nulls.
                          countMissing:
                            type: integer
                            description: >-
                              Number of entities with a missing numerator or
                              denominator before handling nulls.
                          countMissingRows:
                            type: integer
                            description: >-
                              Total number of rows with a missing numerator or
                              denominator.
                          numeratorMean:
                            type: number
                            description: Variance of the mean.
                          numeratorVariance:
                            type: number
                            description: Variance of the numerator.
                          denominatorMean:
                            type: number
                            description: Mean of the denominator.
                          denominatorVariance:
                            type: number
                            description: Variance of the denominator.
                          numeratorDenominatorCovariance:
                            type: number
                            description: Covariance between numerator and denominator.
                          varianceReductionStats:
                            type: object
                            properties:
                              count:
                                type: integer
                                description: >-
                                  Number of entities with a non-missing pre
                                  exposure numerator and denominator, and
                                   non-missing post exposure numerator and denominator after handling nulls.
                              countMissing:
                                type: integer
                                description: >-
                                  Number of entities with a missing pre exposure
                                  numerator or denominator before handling
                                   nulls.
                              countMissingRows:
                                type: integer
                                description: >-
                                  Total number of rows with a missing pre
                                  exposure numerator or denominator.
                              numeratorSum:
                                type: number
                                description: Sum of values.
                              postNumeratorSum:
                                type: number
                                description: >-
                                  Sum of post exposure numerator values that had
                                  a pre exposure numerator.
                              numeratorSumOfSquares:
                                type: number
                                description: |2-

                                   Sum of squared values.
                              denominatorSum:
                                type: number
                                description: Sum of values.
                              postDenominatorSum:
                                type: number
                                description: >-
                                  Sum of post exposure denominator values that
                                  had a pre exposure denominator.
                              denominatorSumOfSquares:
                                type: number
                                description: |2-

                                   Sum of squared values.
                              sumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre and post exposure values.
                              numeratorNumeratorSumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre numerator and post numerator.
                              numeratorDenominatorSumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre numerator and post denominator.
                              denominatorNumeratorSumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre denominator and post numerator.
                              denominatorDenominatorSumOfProducts:
                                type: number
                                description: |2-

                                   Sum of product between pre denominator and post denominator.
                              numeratorMean:
                                type: number
                                description: Variance of the mean.
                              numeratorVariance:
                                type: number
                                description: Variance of the numerator.
                              denominatorMean:
                                type: number
                                description: Mean of the denominator.
                              denominatorVariance:
                                type: number
                                description: Variance of the denominator.
                              numeratorDenominatorCovariance:
                                type: number
                                description: Covariance between numerator and denominator.
                              preNumeratorPostNumeratorCovariance:
                                type: number
                                description: >-
                                  Covariance between pre numerator and post
                                  numerator.
                              preNumeratorPostDenominatorCovariance:
                                type: number
                                description: >-
                                  Covariance between pre numerator and post
                                  denominator.
                              preDenominatorPostNumeratorCovariance:
                                type: number
                                description: >-
                                  Covariance between pre denominator and post
                                  numerator.
                              preDenominatorPostDenominatorCovariance:
                                type: number
                                description: >-
                                  Covariance between pre denominator and post
                                  denominator.
                            description: Summary statistics for variance reduction.
                        description: Summary statistics for a ratio metric.
                    description: Metric-type dependent summary statistics.
                  variant:
                    type: string
                    description: The variant that the metrics were computed for.
                required:
                  - summaryStats
                  - variant
              description: Keyed computed metric values.
          description: Holds the results of the metric calculate when completed.
        schedule:
          type: string
          description: >-
            Resource reference to the schedule if the calculation originated
            from a
             schedule.
        sqlJob:
          type: string
          description: >-
            Resource name of the corresponding job that performs the
            calculation.
        supersededBy:
          type: string
          description: |2-

             Set if the metric calculation has been replaced by a newer calculation,
             occurs for example when parameters of the metric changes.
        sql:
          type: string
          description: >-
            The warehouse-specific query that is used to perform the
            calculation.
        superseeds:
          type: string
          description: |2-

             Set if this metric calculation replaced an older metric calculation.
        scheduleIteration:
          type: object
          description: The iteration of the schedule that this calculation belongs to.
        times:
          type: object
          properties:
            exposureStartTime:
              type: object
              description: Start time of exposure
            exposureEndTime:
              type: object
              description: End time of exposure
            factStartTime:
              type: object
              description: Start time of facts
            factEndTime:
              type: object
              description: End time of facts
          required:
            - exposureStartTime
            - exposureEndTime
            - factStartTime
            - factEndTime
          description: Info about the start / end timestamps used for the calculation
        retriggered:
          type: boolean
          description: >-
            Determines whether this calculation overlaps with a retriggered
            range
        outdatedSourceDataInfo:
          type: object
          properties:
            table:
              type: string
            expectedCount:
              type: integer
            actualCount:
              type: integer
            queryStartTime:
              type: object
            queryEndTime:
              type: object
          required:
            - table
            - expectedCount
            - actualCount
            - queryStartTime
            - queryEndTime
          description: >-
            If the underlying tables changed for the queried values since
            running the calculation,
             this contains information about what changed and where.
        error:
          type: string
          description: Descriptive error if the calculation failed.
        createTime:
          type: object
          description: Time when the metric calculation was first created.
        updateTime:
          type: object
          description: Time when the metric calculation was last updated.
        labels:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
          description: Custom labels for this metric calculation.
        creator:
          type: string
          description: Reference to the identity that created this metric calculation.
        updater:
          type: string
          description: Reference to the identity that last updated this metric calculation.
        owner:
          type: string
          description: The owner of the resource. If not set will default to the creator.
      required:
        - metricCalculationSpec
        - startTime
        - scheduleIteration
        - times
        - createTime
        - updateTime
        - creator
        - updater
  securitySchemes:
    admin:
      type: http
      scheme: bearer

````