• skywalking集成nacos动态配置


    修改config/application.yml

    configuration:
      selector: ${SW_CONFIGURATION:nacos}
      nacos:
        # Nacos Server Host
        serverAddr: ${SW_CONFIG_NACOS_SERVER_ADDR:192.168.229.130}
        # Nacos Server Port
        port: ${SW_CONFIG_NACOS_SERVER_PORT:8848}
        # Nacos Configuration Group
        group: ${SW_CONFIG_NACOS_SERVER_GROUP:skywalking}
        # Nacos Configuration namespace
        namespace: ${SW_CONFIG_NACOS_SERVER_NAMESPACE:db20ccfd-db01-47bd-a4d3-393b4e7df260}
        # Unit seconds, sync period. Default fetch every 60 seconds.
        period: ${SW_CONFIG_NACOS_PERIOD:10}
        # Nacos auth username
        username: ${SW_CONFIG_NACOS_USERNAME:"nacos"}
        password: ${SW_CONFIG_NACOS_PASSWORD:"nacos"}
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    参考:https://skywalking.apache.org/docs/main/v9.1.0/en/setup/backend/dynamic-config-nacos/

    添加nacos配置

    比如:
    dataid = configuration-discovery.default.agentConfigurations
    group = skywalking
    内容:

    configurations:
      demo-application:
        agent.trace.ignore_path: "**/actuator/**"
    
    • 1
    • 2
    • 3

    在这里插入图片描述
    保存以后,在skywalking的控制台会打印如下输出:

    Nacos config changed: configuration-discovery.default.agentConfigurations: configurations:
      demo-application:
        agent.trace.ignore_path: "**/actuator/**"
    
    • 1
    • 2
    • 3

    支持的配置项

    参考:https://skywalking.apache.org/docs/main/v9.1.0/en/setup/backend/dynamic-config/

    keyValue DescriptionValue Format Example
    agent-analyzer.default.slowDBAccessThresholdThresholds of slow Database statement. Overrides agent-analyzer/default/slowDBAccessThreshold of application.yml.default:200,mongodb:50
    agent-analyzer.default.uninstrumentedGatewaysThe uninstrumented gateways. Overrides gateways.ymlSame as gateways.yml
    alarm.default.alarm-settingsThe alarm settings. Overrides alarm-settings.ymlSame as alarm-settings.yml
    core.default.apdexThresholdThe apdex threshold settings. Overrides service-apdex-threshold.ymlSame as service-apdex-threshold.yml
    core.default.endpoint-name-groupingThe endpoint name grouping setting. Overrides endpoint-name-grouping.ymlSame as endpoint-name-grouping.yml
    core.default.log4j-xmlThe log4j xml configuration. Overrides log4j2.xmlSame as log4j2.xml
    agent-analyzer.default.traceSamplingPolicyThe sampling policy for default and service dimension, override trace-sampling-policy-settings.ymlsame as trace-sampling-policy-settings.yml
    configuration-discovery.default.agentConfigurationsThe ConfigurationDiscovery settings.See configuration-discovery.md

    configuration-discovery.default.agentConfigurations

    参考:https://github.com/apache/skywalking-java/blob/20fb8c81b3da76ba6628d34c12d23d3d45c973ef/docs/en/setup/service-agent/java-agent/configuration-discovery.md

    配置内容的格式

    configurations:
      //service name
      serviceA:
        // Configurations of service A
        // Key and Value are determined by the agent side.
        // Check the agent setup doc for all available configurations.
        key1: value1
        key2: value2
        ...
      serviceB:
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    支持的key

    Key
    agent.sample_n_per_3_secs
    agent.ignore_suffix
    agent.trace.ignore_path
    agent.span_limit_per_segment

    动态配置的用处

    比如:可以动态调整需要ignore的endpoint

  • 相关阅读:
    Quartz定时任务基础学习
    QT day3作业
    terraform简单的开始-安装和一些配置
    前端培训丁鹿学堂:前端也要了解的计算机基础(一)
    4.2 - 线性表
    JVM虚拟机详解
    Windows进程简介
    vue3Blog首页基础布局样式规划
    linux命令之systemctl 详解
    《Java 核心技术卷1 基础知识》第二章 Java 程序设计环境 笔记
  • 原文地址:https://blog.csdn.net/goldenfish1919/article/details/125526679