github.com/aacfactory/fns@v1.2.86-0.20240310083819-80d667fc0a17/docs/metric.md (about)

     1  # Metric
     2  
     3  ------
     4  
     5  Measurement each fn handling result stats in request. so there are more than one stats of one request.
     6  
     7  ## Model
     8  
     9  | Name      | Type     | Description            |
    10  | --------- | -------- | ---------------------- |
    11  | service   | string   | name of service        |
    12  | fn        | string   | name of fn             |
    13  | succeed   | bool     | handled succeed or not |
    14  | errorCode | int      | code of error          |
    15  | errorName | string   | name or error          |
    16  | latency   | duration | time cost              |
    17  
    18  
    19  ## Component
    20  ### Reporter 
    21  It is an interface, so you can use `Prometheus` to implement. 
    22  
    23  ## Usage
    24  Add service in `modules/dependencies.go`
    25  ```go
    26  func dependencies() (services []service.Service) {
    27  	services = append(
    28  		services,
    29  		stats.Service(&SomeReporter{}),
    30  	)
    31  	return
    32  }
    33  ```
    34  Setup config
    35  ```yaml
    36  stats:
    37    reporter: {}
    38  ```