03. SkyWalking - Agent 配置詳解

對應于源碼/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java 類

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */


package org.apache.skywalking.apm.agent.core.conf;

import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
import org.apache.skywalking.apm.agent.core.logging.core.LogLevel;
import org.apache.skywalking.apm.agent.core.logging.core.WriterFactory;

/**
 * This is the core config in sniffer agent.
 *
 * @author wusheng
 */
public class Config {

    public static class Agent {
        /**
         * Namespace isolates headers in cross process propagation. The HEADER name will be `HeaderName:Namespace`.
         */
        public static String NAMESPACE = "";  //此參數(shù)用以表明跨進程鏈路之中的header搀崭;不同的namespace在一次跨進程鏈路中會導致鏈路中斷

        /**
         * Application code is showed in sky-walking-ui. Suggestion: set an unique name for each application, one
         * application's nodes share the same code.
         */
        public static String APPLICATION_CODE = ""; //一個項目的唯一標示婉称,用來展示在web之上

        /**
         * Authentication active is based on backend setting, see application.yml for more details.
         * For most scenarios, this needs backend extensions, only basic match auth provided in default implementation.
         */
        public static String AUTHENTICATION = ""; //與Coilector進行通信的token,需要與collector設置的一樣

        /**
         * Negative or zero means off, by default. {@link #SAMPLE_N_PER_3_SECS} means sampling N {@link TraceSegment} in
         * 10 seconds tops.
         */
        public static int SAMPLE_N_PER_3_SECS = -1;  //每三秒收集的TraceSegment的數(shù)量

        /**
         * If the operation name of the first span is included in this set, this segment should be ignored.
         */
        public static String IGNORE_SUFFIX = ".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg"; //需要忽略的調(diào)用

        /**
         * The max number of spans in a single segment. Through this config item, skywalking keep your application
         * memory cost estimated.
         */
        public static int SPAN_LIMIT_PER_SEGMENT = 300; //每個Segment中最多有多少個Span

        /**
         * If true, skywalking agent will save all instrumented classes files in `/debugging` folder.
         * Skywalking team may ask for these files in order to resolve compatible problem.
         */
        public static boolean IS_OPEN_DEBUGGING_CLASS = false; //是否保存增強后的字節(jié)碼文件
    }

    public static class Collector {
        /**
         * grpc channel status check interval
         */
        public static long GRPC_CHANNEL_CHECK_INTERVAL = 30;  //grpc通道心跳的間隔
        /**
         * application and service registry check interval
         */
        public static long APP_AND_SERVICE_REGISTER_CHECK_INTERVAL = 3; //應用和調(diào)用注冊的心跳間隔
        /**
         * discovery rest check interval
         */
        public static long DISCOVERY_CHECK_INTERVAL = 60;  //發(fā)現(xiàn)服務的心跳間隔
        /**
         * Collector naming/jetty service addresses.
         * Primary address setting.
         *
         * e.g.
         * SERVERS="127.0.0.1:10800"  for single collector node.
         * SERVERS="10.2.45.126:10800,10.2.45.127:10800"  for multi collector nodes.
         */
        public static String SERVERS = ""; //collector公布的naming/jetty地址和端口

        /**
         * Collector agent_gRPC/grpc service addresses.
         * Secondary address setting, only effect when #SERVERS is empty.
         *
         * By using this, no discovery mechanism provided. The agent only uses these addresses to uplink data.
         *
         */
        public static String DIRECT_SERVERS = ""; //直連gRpc的地址

        /**
         * Collector service discovery REST service name
         */
        public static String DISCOVERY_SERVICE_NAME = "/agent/gRPC"; //collector收集agent的參數(shù)的path
    }

    public static class Jvm {
        /**
         * The buffer size of collected JVM info.
         */
        public static int BUFFER_SIZE = 60 * 10; //jvm參數(shù)的通道緩存數(shù)量
    }

    public static class Buffer {
        public static int CHANNEL_SIZE = 5; // 用于發(fā)送至collector的內(nèi)存通道的數(shù)量

        public static int BUFFER_SIZE = 300; //每個內(nèi)存通道之中保存的traceSegment的數(shù)量
    }

    public static class Dictionary {
        /**
         * The buffer size of application codes and peer
         */
        public static int APPLICATION_CODE_BUFFER_SIZE = 10 * 10000;

        public static int OPERATION_NAME_BUFFER_SIZE = 1000 * 10000;
    }

    public static class Logging {
        /**
         * Log file name.
         */
        public static String FILE_NAME = "skywalking-api.log"; //日志的文件名

        /**
         * Log files directory. Default is blank string, means, use "system.out" to output logs.
         *
         * Ref to {@link WriterFactory#getLogWriter()}
         */
        public static String DIR = ""; //日志打印的目錄

        /**
         * The max size of log file. If the size is bigger than this, archive the current file, and write into a new
         * file.
         */
        public static int MAX_FILE_SIZE = 300 * 1024 * 1024;  //日志更換新文件的閾值

        /**
         * The log level. Default is debug.
         */
        public static LogLevel LEVEL = LogLevel.DEBUG; //日志打印的等級
    }

    public static class Plugin {
        public static class MongoDB {
            /**
             * If true, trace all the parameters, default is false. Only trace the operation, not include parameters.
             */
            public static boolean TRACE_PARAM = false;
        }
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末诚欠,一起剝皮案震驚了整個濱河市种远,隨后出現(xiàn)的幾起案子款筑,更是在濱河造成了極大的恐慌,老刑警劉巖咕娄,帶你破解...
    沈念sama閱讀 216,402評論 6 499
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件亥揖,死亡現(xiàn)場離奇詭異,居然都是意外死亡圣勒,警方通過查閱死者的電腦和手機费变,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,377評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來圣贸,“玉大人挚歧,你說我怎么就攤上這事∮蹙” “怎么了滑负?”我有些...
    開封第一講書人閱讀 162,483評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長锡搜。 經(jīng)常有香客問我橙困,道長,這世上最難降的妖魔是什么耕餐? 我笑而不...
    開封第一講書人閱讀 58,165評論 1 292
  • 正文 為了忘掉前任凡傅,我火速辦了婚禮,結(jié)果婚禮上肠缔,老公的妹妹穿的比我還像新娘夏跷。我一直安慰自己,他們只是感情好明未,可當我...
    茶點故事閱讀 67,176評論 6 388
  • 文/花漫 我一把揭開白布槽华。 她就那樣靜靜地躺著,像睡著了一般趟妥。 火紅的嫁衣襯著肌膚如雪猫态。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,146評論 1 297
  • 那天,我揣著相機與錄音亲雪,去河邊找鬼勇凭。 笑死,一個胖子當著我的面吹牛义辕,可吹牛的內(nèi)容都是我干的虾标。 我是一名探鬼主播,決...
    沈念sama閱讀 40,032評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼灌砖,長吁一口氣:“原來是場噩夢啊……” “哼璧函!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起基显,我...
    開封第一講書人閱讀 38,896評論 0 274
  • 序言:老撾萬榮一對情侶失蹤蘸吓,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后撩幽,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體美澳,經(jīng)...
    沈念sama閱讀 45,311評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,536評論 2 332
  • 正文 我和宋清朗相戀三年摸航,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片舅桩。...
    茶點故事閱讀 39,696評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡酱虎,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出擂涛,到底是詐尸還是另有隱情读串,我是刑警寧澤,帶...
    沈念sama閱讀 35,413評論 5 343
  • 正文 年R本政府宣布撒妈,位于F島的核電站恢暖,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏狰右。R本人自食惡果不足惜杰捂,卻給世界環(huán)境...
    茶點故事閱讀 41,008評論 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望棋蚌。 院中可真熱鬧嫁佳,春花似錦、人聲如沸谷暮。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽湿弦。三九已至瓤漏,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背蔬充。 一陣腳步聲響...
    開封第一講書人閱讀 32,815評論 1 269
  • 我被黑心中介騙來泰國打工蝶俱, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人娃惯。 一個月前我還...
    沈念sama閱讀 47,698評論 2 368
  • 正文 我出身青樓跷乐,卻偏偏與公主長得像,于是被迫代替她去往敵國和親趾浅。 傳聞我的和親對象是個殘疾皇子愕提,可洞房花燭夜當晚...
    茶點故事閱讀 44,592評論 2 353

推薦閱讀更多精彩內(nèi)容