Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Tracer is a library which intercepts API calls to DIGIT services which have imported tracer and logs errors.

A new utility method has been added to tracer using which modules can prepare error details and invoke this utility method to persist these error objects on database for retrying them.

Here are the steps using which any module can utilize this functionality to store error objects -

  1. The concerned module has to prepare error details.

  2. The concerned module can then make a call to exceptionHandler method which takes a list of errorDetails as its argument. This method will do a couple of enrichments and then emit these errorDetails to kafka for indexer-service to pick it up and persist.

  3. Create an index with the name - egov-tracer-error-details using this command on Kibana -

PUT egov-tracer-error-details
{
}

4. Create mapping for this index -

PUT /egov-tracer-error-details/general/_mapping
{
  "properties" : {
          "Data" : {
            "properties" : {
              "@timestamp" : {
                "type" : "date"
              },
              "apiDetails" : {
                "properties" : {
                  "contentType" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "id" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "requestBody" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "url" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  }
                }
              },
              "auditDetails" : {
                "properties" : {
                  "createdTime" : {
                    "type" : "long"
                  },
                  "lastModifiedTime" : {
                    "type" : "long"
                  }
                }
              },
              "errors" : {
                "properties" : {
                  "errorCode" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "errorMessage" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "exception" : {
                    "properties" : {
                      "code" : {
                        "type" : "text",
                        "fields" : {
                          "keyword" : {
                            "type" : "keyword",
                            "ignore_above" : 256
                          }
                        }
                      },
                      "localizedMessage" : {
                        "type" : "text",
                        "fields" : {
                          "keyword" : {
                            "type" : "keyword",
                            "ignore_above" : 256
                          }
                        }
                      },
                      "message" : {
                        "type" : "text",
                        "fields" : {
                          "keyword" : {
                            "type" : "keyword",
                            "ignore_above" : 256
                          }
                        }
                      },
                      "stackTrace" : {
                        "properties" : {
                          "className" : {
                            "type" : "text",
                            "fields" : {
                              "keyword" : {
                                "type" : "keyword",
                                "ignore_above" : 256
                              }
                            }
                          },
                          "fileName" : {
                            "type" : "text",
                            "fields" : {
                              "keyword" : {
                                "type" : "keyword",
                                "ignore_above" : 256
                              }
                            }
                          },
                          "lineNumber" : {
                            "type" : "long"
                          },
                          "methodName" : {
                            "type" : "text",
                            "fields" : {
                              "keyword" : {
                                "type" : "keyword",
                                "ignore_above" : 256
                              }
                            }
                          },
                          "nativeMethod" : {
                            "type" : "boolean"
                          }
                        }
                      }
                    }
                  },
                  "type" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  }
                }
              },
              "retryCount" : {
                "type" : "long"
              },
              "status" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              },
              "uuid" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              }
            }
          }
        }
}

5. Setup indexer with the following indexer configuration file -

https://github.com/egovernments/configs/blob/dpg-1125/egov-indexer/egov-error-queue-indexer.yml

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.