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

# 获取流程实例统计信息

> Retrieves runtime statistics of the process engine, grouped by process definitions.
These statistics include the number of running process instances, optionally the number of failed jobs
and also optionally the number of incidents either grouped by incident types or
for a specific incident type.
**Note**: This does not include historic data.



## OpenAPI

````yaml GET /process-definition/statistics
openapi: 3.0.2
info:
  title: ORION Platform REST API
  description: OpenApi Spec for ORION Camunda Platform REST API.
  version: 7.22.6-ee
  license:
    name: Apache License 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: http://{host}:{port}/{contextPath}
    description: The API server for the default process engine
    variables:
      host:
        default: localhost
      port:
        default: '8080'
      contextPath:
        default: engine-rest
  - url: http://{host}:{port}/{contextPath}/engine/{engineName}
    description: The API server for a named process engine
    variables:
      host:
        default: localhost
      port:
        default: '8080'
      contextPath:
        default: engine-rest
      engineName:
        default: default
  - url: '{url}'
    description: The API server with a custom url
    variables:
      url:
        default: ''
security:
  - basicAuth: []
tags:
  - name: Authorization
  - name: Batch
  - name: Condition
  - name: Decision Definition
  - name: Decision Requirements Definition
  - name: Deployment
  - name: Engine
  - name: Event Subscription
  - name: Execution
  - name: External Task
  - name: Filter
  - name: Group
  - name: Historic Activity Instance
  - name: Historic Batch
  - name: Historic Decision Definition
  - name: Historic Decision Instance
  - name: Historic Decision Requirements Definition
  - name: Historic Detail
  - name: Historic External Task Log
  - name: Historic Identity Link Log
  - name: Historic Incident
  - name: Historic Job Log
  - name: Historic Process Definition
  - name: Historic Process Instance
  - name: Historic Task Instance
  - name: Historic User Operation Log
  - name: Historic Variable Instance
  - name: History Cleanup
  - name: Identity
  - name: Incident
  - name: Job
  - name: Job Definition
  - name: Message
  - name: Metrics
  - name: Migration
  - name: Modification
  - name: Process Definition
  - name: Process Instance
  - name: Signal
  - name: Schema Log
  - name: Task
  - name: Task Attachment
  - name: Task Comment
  - name: Task Identity Link
  - name: Task Local Variable
  - name: Task Variable
  - name: Telemetry
  - name: Tenant
  - name: User
  - name: Variable Instance
  - name: Version
externalDocs:
  description: Find out more about ORION Rest API
  url: https://docs.eorion.com
paths:
  /process-definition/statistics:
    get:
      tags:
        - Process Definition
      summary: Get Process Instance Statistics
      description: >-
        Retrieves runtime statistics of the process engine, grouped by process
        definitions.

        These statistics include the number of running process instances,
        optionally the number of failed jobs

        and also optionally the number of incidents either grouped by incident
        types or

        for a specific incident type.

        **Note**: This does not include historic data.
      operationId: getProcessDefinitionStatistics
      parameters:
        - name: failedJobs
          in: query
          schema:
            type: boolean
          description: >-
            Whether to include the number of failed jobs in the result or not.
            Valid values are `true` or `false`.
        - name: incidents
          in: query
          schema:
            type: boolean
          description: >-
            Valid values for this property are `true` or `false`.

            If this property has been set to `true` the result will include the
            corresponding number of incidents

            for each occurred incident type.

            If it is set to `false`, the incidents will not be included in the
            result.

            Cannot be used in combination with `incidentsForType`.
        - name: incidentsForType
          in: query
          schema:
            type: string
          description: >-
            If this property has been set with any incident type (i.e., a string
            value) the result

            will only include the number of incidents for the assigned incident
            type.

            Cannot be used in combination with `incidents`.

            See the [User
            Guide](https://docs.camunda.org/manual/7.22/user-guide/process-engine/incidents/#incident-types)

            for a list of incident types.
        - name: rootIncidents
          in: query
          schema:
            type: boolean
          description: >-
            Valid values for this property are `true` or `false`.

            If this property has been set to `true` the result will include the
            corresponding number of

            root incidents for each occurred incident type.

            If it is set to `false`, the incidents will not be included in the
            result.

            Cannot be used in combination with `incidentsForType` or
            `incidents`.
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProcessDefinitionStatisticsResultDto'
              examples:
                example-1:
                  summary: GET /process-definition/statistics?failedJobs=true
                  description: Request with Query Parameter `failedJobs=true`
                  value:
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId
                      instances: 123
                      failedJobs: 42
                      definition:
                        id: aProcessDefinitionId
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: 1.0.0
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents: []
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId:2
                      instances: 124
                      failedJobs: 43
                      definition:
                        id: aProcessDefinitionId:2
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: null
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents: []
                example-2:
                  summary: GET /process-definition/statistics?incidents=true
                  description: Request with Query Parameter `incidents=true`
                  value:
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId
                      instances: 123
                      failedJobs: 0
                      definition:
                        id: aProcessDefinitionId
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: 1.0.0
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents:
                        - incidentType: failedJob
                          incidentCount: 42
                        - incidentType: anIncident
                          incidentCount: 20
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId:2
                      instances: 124
                      failedJobs: 0
                      definition:
                        id: aProcessDefinitionId:2
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: null
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents:
                        - incidentType: failedJob
                          incidentCount: 43
                        - incidentType: anIncident
                          incidentCount: 22
                        - incidentType: anotherIncident
                          incidentCount: 15
                example-3:
                  summary: >-
                    GET
                    /process-definition/statistics?incidentsForType=anIncident
                  description: Request with Query Parameter `incidentsForType=anIncident`
                  value:
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId
                      instances: 123
                      failedJobs: 0
                      definition:
                        id: aProcessDefinitionId
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: 1.0.0
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents:
                        - incidentType: anIncident
                          incidentCount: 20
                example-4:
                  summary: GET /process-definition/statistics?rootIncidents=true
                  description: Request with Query Parameter `rootIncidents=true`
                  value:
                    - '@class': >-
                        org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionStatisticsResultDto
                      id: aProcessDefinitionId
                      instances: 123
                      failedJobs: 0
                      definition:
                        id: aProcessDefinitionId
                        key: aKey
                        category: null
                        description: null
                        name: aName
                        version: 0
                        resource: null
                        deploymentId: null
                        diagram: null
                        suspended: false
                        tenantId: null
                        versionTag: 1.0.0
                        historyTimeToLive: null
                        startableInTasklist: false
                      incidents:
                        - incidentType: failedJob
                          incidentCount: 62
                        - incidentType: anIncident
                          incidentCount: 20
          description: Request successful.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionDto'
          description: >-
            Returned if some of the query parameters are invalid.

            See the

            [Introduction](https://docs.camunda.org/manual/7.22/reference/rest/overview/#error-handling)

            for the error response format.
components:
  schemas:
    ProcessDefinitionStatisticsResultDto:
      type: object
      properties:
        id:
          type: string
          nullable: true
          description: The id of the process definition the results are aggregated for.
        instances:
          type: integer
          format: int32
          description: >-
            The total number of running process instances of this process
            definition.
        failedJobs:
          type: integer
          format: int32
          description: |-
            The total number of failed jobs for the running instances.
            **Note**: Will be `0` (not `null`), if failed jobs were excluded.
        incidents:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/IncidentStatisticsResultDto'
          description: >-
            Each item in the resulting array is an object which contains
            `incidentType` and `incidentCount`.

            **Note**: Will be an empty array, if `incidents` or
            `incidentsForType` were excluded.

            Furthermore, the array will be also empty if no incidents were
            found.
        '@class':
          type: string
          nullable: true
          description: |-
            The fully qualified class name of the data transfer object class.
            The class name might change in future releases.
        definition:
          $ref: '#/components/schemas/ProcessDefinitionDto'
    ExceptionDto:
      title: ExceptionDto
      type: object
      properties:
        type:
          type: string
          nullable: true
          description: An exception class indicating the occurred error.
        message:
          type: string
          nullable: true
          description: A detailed message of the error.
        code:
          type: number
          description: >-
            The code allows your client application to identify the error in an
            automated fashion.

            You can look up the meaning of all built-in codes and learn how to
            add custom codes

            in the [User
            Guide](https://docs.camunda.org/manual/7.22/user-guide/process-engine/error-handling/#exception-codes).
    IncidentStatisticsResultDto:
      type: object
      properties:
        incidentType:
          type: string
          nullable: true
          description: >-
            The type of the incident the number of incidents is aggregated for.

            See the [User
            Guide](https://docs.camunda.org/manual/7.22/user-guide/process-engine/incidents/#incident-types)
            for a list of incident types.
        incidentCount:
          type: integer
          format: int32
          nullable: true
          description: The total number of incidents for the corresponding incident type.
    ProcessDefinitionDto:
      type: object
      properties:
        id:
          type: string
          nullable: true
          description: The id of the process definition
        key:
          type: string
          nullable: true
          description: >-
            The key of the process definition, i.e., the id of the BPMN 2.0 XML
            process definition.
        category:
          type: string
          nullable: true
          description: The category of the process definition.
        description:
          type: string
          nullable: true
          description: The description of the process definition.
        name:
          type: string
          nullable: true
          description: The name of the process definition.
        version:
          type: integer
          format: int32
          nullable: true
          description: >-
            The version of the process definition that the engine assigned to
            it.
        resource:
          type: string
          nullable: true
          description: The file name of the process definition.
        deploymentId:
          type: string
          nullable: true
          description: The deployment id of the process definition.
        diagram:
          type: string
          nullable: true
          description: The file name of the process definition diagram, if it exists.
        suspended:
          type: boolean
          nullable: true
          description: A flag indicating whether the definition is suspended or not.
        tenantId:
          type: string
          nullable: true
          description: The tenant id of the process definition.
        versionTag:
          type: string
          nullable: true
          description: The version tag of the process definition.
        historyTimeToLive:
          type: integer
          format: int32
          nullable: true
          minimum: 0
          description: >-
            History time to live value of the process definition.

            Is used within [History
            cleanup](https://docs.camunda.org/manual/7.22/user-guide/process-engine/history/#history-cleanup).
        startableInTasklist:
          type: boolean
          nullable: true
          description: >-
            A flag indicating whether the process definition is startable in
            Tasklist or not.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````