Tracer DRM switch

更新时间:
复制 MD 格式

Dynamic configuration items

By default, Tracer generates detailed and statistical logs for calls to various network middleware. Because Tracer generates logs asynchronously, this process has a minimal impact on performance. However, for special requirements, Tracer provides a dynamic configuration switch to disable middleware digest logs.

The dynamic configuration for Tracer provides switches at two levels:

Global switch

A global switch is a site-wide configuration that is pushed to all systems that use Tracer. The dynamic configuration backend already contains the global dynamic configuration. The resource ID for this dynamic configuration is:

Alipay.middlewareTracer:name=com.alipay.common.tracer.manage.TracerDrm

It contains one resource property:

disableMiddlewareDigestLog

The following describes the specific values to push for this field:

  • If the pushed value is true, all digest logs are disabled.

  • If the pushed value is false or an empty string, all digest logs are enabled.

  • If the pushed value is log1=true&log2=true, specific digest logs are disabled. In this format, log1 and log2 represent the keys for the logs. To disable multiple logs, separate them with an ampersand (&). The available keys are:

    • rpc-client: RPCClient digest log

    • rpc-server: RPCServer digest log

    • msg-publisher: MSG Publisher digest log

    • msg-subscriber: MSG Subscriber digest log

    • http-client: HTTPClient digest log

    • mvc: MVC digest log

    • zdal-db: ZDALDB digest log

    • zdal-tair: ZDALTAIR digest log

Push examples:

// Disable all digest logs
true

// Enable all digest logs
false

// Disable the zdal-db digest log
zdal-db=true

// Disable the zdal-db and rpc-client digest logs
zdal-db=true&rpc-client=true

If you have disabled multiple logs and want to re-enable one of them, remove the corresponding log key from the pushed value. For example:

// The zdal-db and rpc-client digest logs are already disabled
zdal-db=true&rpc-client=true

// To enable the rpc-client log, push the following value
zdal-db=true

Application-level switch

The properties for the application-level switch are the same as those for the global switch. The only difference is the dynamic configuration ID:

Alipay.${appName}:name=com.alipay.common.tracer.manage.TracerDrm

By default, this dynamic configuration is not configured in the dynamic configuration backend. To use it, you can add this configuration to your application. Follow these steps:

  1. In your local SOFABoot project, import the following dependencies:

    <dependency>
        <groupId>com.alipay.sofa</groupId>
        <artifactId>ddcs-enterprise-sofa-boot-starter</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>tracer</artifactId>
                <groupId>com.alipay.common</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    
    <dependency>
        <groupId>com.alipay.common</groupId>
        <artifactId>tracer-manage</artifactId>
    </dependency>
  2. Configure the dynamic configuration resource bean. The following is an example:

    <bean id="tracerDrm" class="com.alipay.common.tracer.manage.TracerDrm" init-method="init">
    <constructor-arg name="appName" value="tracerDrmBoot"/>
    </bean>
  3. Go to the Microservice Platform > Microservices > Dynamic Configuration page in the console. Add application metadata, and then create and push the corresponding dynamic configuration. For more information, see Get started with Dynamic Configuration > Manage dynamic configuration classes in the cloud.