探针配置(后端)

本文介绍服务端探针配置,包括详细的配置参数,和需放入应用项目的探针配置文件的文件结构。

探针配置参数

配置属性   类型 描述 示列数据
Enable bool 是否启用探针,默认:true true
ProductCode string 天眼平台产品编码 fast
AppCode string 天眼平台应用编码 analysis
AppKey string 天眼平台应用Key xxxxxxxxxxxxx,用于获取STS
EnvCode string 应用运行环境编码 可选值:dev、test、beta、prod
TenantCode string 租户编码(常量),TenantCode与TenantCodeReader二者选其一。若已配置TenantCode,则TenantCodeReader不生效 XXX租户
EnvCodeReader array<object> 运行环境编码获取 [{"ReaderType": "Environment", "ReaderKey": "env"}] ,参考:CodeReader
TenantCodeReader array<object> 租户编码获取 [{"ReaderType": "QueryString", "ReaderKey": "tenant"}] ,参考:CodeReader
UserCodeReader array<object> 用户编码获取 [{"ReaderType": "Cookie", "ReaderKey": "keeplastname"}] ,参考:CodeReader
Logging.Level string 探针日志记录级别 Verbose、Debug、Information、Warning、Error、Fatal
Logging.FilePath string 探针日志文件存储路径 logs/fast-tracker/{Date}.log
CarrierHeader.TrackerName string 链路间HTTP调用穿透链路的请求头名称 fast-tracker
CarrierHeader.TraceIdName string 用于前端穿透链路的请求头名称(TraceID) x-log-id
Event.Components array<string> 收集相关软件包,框架,类库或模块的事件 [ "SqlClient", "HttpClient", "CustomEvent" ]
Event.CustomEventSourceName string 自定义事件源名称 FAST-Tracker-Custom-Event
Event.IgnoreEntryPaths array<string> 忽略入口请求(虚拟路径) [ "/api/values","/api/*","*/values" ]
Event.IgnoreEntryFiles array<string> 忽略入口文件请求 [ ".ico", ".js", ".css", ".woff", ".woff2", ".svg", ".ttf", ".jpg", ".jpeg", ".png", ".gif", ".bmp" ]
Event.IgnoreNullReference bool 忽略无引用关系的Span true
Sampling.SamplePer3Secs int 每三秒采样数量(默认为:-1,关闭该采样) 100:每三秒采集100条Trace
Sampling.Percentage double 按百分比采样(默认为:-1,关闭该采样) 60:采集60%的Trace
Transport.QueueSize int 日志缓存队列大小 1572864
Transport.BatchSize int 批次上报日志条数 3072
Transport.Interval int 数据上报时间间隔(单位:ms) 3000
Transport.Report.TokenServerEndpoint string Report上报模式,获取服务端上报日志STS https://fast-tools.mypaas.com.cn/api/sts/serverlog
Transport.Forward.Host string Forward上报模式,Fluentd Server 主机名 localhost
Transport.Forward.Port int Forward上报模式,Fluentd Server 端口号 24224
Transport.Local.FilePath string Local上报模式,日志存储文件路径 logs/fast-tracker/trace/log-.log
Transport.Local.FileSize int Local上报模式,单个文件大小,单位MB,默认10MB 10
Transport.Local.RetainedFileCount int Local上报模式,保留文件数,日志文件会按照文件大小进行轮转 10

配置文件FastTracker.json 模板

{
  "FastTracker": {
    "ProductCode": "天眼平台产品编码",
    "AppCode": "天眼平台应用编码",
    "AppKey": "天眼平台应用Key",
    "EnvCode": "环境编码",
    "TenantCode": "租户编码",
    "UserCodeReader": [
      {
        "ReaderType": "Cookie",
        "ReaderKey": "keeplastname"
      }
    ],
    "Logging": {
      "Level": "Information",
      "FilePath": "logs/fast-tracker/.log"
    },
    "CarrierHeader": {
      "TrackerName": "fast-tracker",
      "TraceIdName": "x-log-id"
    },
    "Event": {
      "Components": [ "SqlClient", "HttpClient", "CustomEvent" ],
      "CustomeEventSourceName": "FAST-Tracker-Custome-Event",
      "IgnoreEntryPaths": [ "/api/values" ],
      "IgnoreEntryFiles": [ ".ico", ".js", ".css", ".woff", ".woff2", ".svg", ".ttf", ".jpg", ".jpeg", ".png", ".gif", ".bmp" ],
      "IgnoreNullReference": true
    },
    "Sampling": {
      "SamplePer3Secs": -1,
      "Percentage": -1.0
    },
    "Transport": {
          // 上报模式支持:Report、Forward、Local。根据部署要求或日志使用场景进行选择
          //"Report": {
          //  "TokenServerEndpoint": "https://fast-tools.mypaas.com.cn/api/sts/serverlog"
          //},
          //"Forward": {
          //  "Host": "localhost",
          //  "Port": 24224
          //},
          "Local": {
            "FilePath": "logs/fast-tracker/trace/log-.log",
            "FileSize": 10,
            "RetainedFileCount": 10
          },
          "QueueSize": 1572864,
          "BatchSize": 1000
        }
  }
}
CodeReader

CodeReader 由ReaderType与ReaderKey 组成

ReaderType支持 Cookie、QueryString、RequestHeader、Registry、Environment

ReaderType 说明 示列
Cookie 从HttpRequest.Cookies中获取 {"ReaderType": "Cookie", "ReaderKey": "keeplastname" }
QueryString 从HttpRequest.QueryString中获取 {"ReaderType": "QueryString", "ReaderKey": "tenant_code" }
RequestHeader 从HttpRequest.Headers中获取 {"ReaderType": "RequestHeader", "ReaderKey": "tenant_code" }
Registry 从Windows注册表中获取 {"ReaderType": "Registry", "ReaderKey": "HKEY_LOCAL_MACHINE\\SOFTWARE\\mysoft\\customer\\CustomerId" }
Environment 从系统环境变量中读取 {"ReaderType": "Environment", "ReaderKey": "CUSTOMERID" }
日志上报模式

results matching ""

    No results matching ""