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

     1  # Tracing
     2  
     3  ------
     4  
     5  Trace the `fn` used in the request. the tracer will be reported when origin request was finished.
     6  
     7  ## Model
     8  ### Tracer
     9  | Name | Type   | Description         |
    10  |------|--------|---------------------|
    11  | id   | string | id of tracer        |
    12  | span | Span   | root span of tracer |
    13  
    14  ### Span
    15  
    16  | Name       | Type     | Description                 |
    17  |------------|----------|-----------------------------|
    18  | id         | string   | id of span                  |
    19  | service    | string   | service name                |
    20  | fn         | string   | fn name                     |
    21  | tracerId   | string   | tracer id                   |
    22  | startAt    | time     | start time of fn handing    |
    23  | finishedAt | time     | finished time of fn handled |
    24  | children   | []Span   | sub spans                   |
    25  | tags       | []string | tags                        |
    26  
    27  
    28  
    29  ## Component
    30  ### Reporter
    31  It is an interface, so you can use `opentracing` to implement.
    32  
    33  ## Usage
    34  Add service in `modules/dep.go`
    35  ```go
    36  func dependencies() (services []service.Service) {
    37  	services = append(
    38  		services,
    39  		tracings.Service(&SomeReporter{}),
    40  	)
    41  	return
    42  }
    43  ```
    44  Setup config
    45  ```yaml
    46  tracings:
    47    reporter: {}
    48  ```