Modify ARMS agents for Java parameters and data reporting regions

更新时间:
复制 MD 格式

Control default ARMS Java agent configurations through static configuration files.

Static configuration files modify only static and default configurations. Their priority is lower than that for dynamic configurations, Java system properties, and environment variables.

Agents V4.x and later

All configuration files are built into the JAR package. Create an external configuration file to override built-in defaults. External configuration files take precedence over built-in files but rank below dynamic configurations, Java system properties, and environment variables.

Modify agent configurations

  1. Create a .properties configuration file (for example, my-app.properties), preferably in the agent directory.

  2. Add the following parameters as needed. All default to empty.

    Parameter

    Description

    arms.licenseKey

    The LicenseKey for agent installation. Obtain it from the Java Application Monitor card on the Integration Center page in the Cloud Monitor 2.0 console, or by calling DescribeTraceLicenseKey through the OpenAPI platform.

    arms.appName

    The application name.

    profiler.tags.env

    The application environment tag.

    profiler.tags.version

    The application version tag.

    profiler.tags.customtags

    Custom instance tag for the application.

    The last three parameters specify the tags of the instance in ARMS.

  3. At agent startup, add -Dotel.javaagent.configuration-file=/path/to/my-app.properties to the startup command, or set the environment variable OTEL_JAVAAGENT_CONFIGURATION_FILE=/path/to/my-app.properties.

    Note
    • Replace /path/to/my-app.properties with the absolute path of the configuration file.

    • If both are set, the startup command takes precedence.

  4. Apply the modified configuration file to any ARMS Java agent V4.x installation as needed.

Modify the reporting region

The default reporting region depends on the integration method:

  • ACK integration: The region of your ACK cluster.

  • Manual integration: The region of the OSS bucket used for agent downloads.

To change the reporting region:

Method 1

For applications deployed in an ACK cluster:

  1. Update the ack-onepilot component to V4.0.0 or later.

  2. Add the ARMS_REPORT_REGION environment variable to the ack-onepilot-ack-onepilot application in the ack-onepilot namespace. Set the value to an ARMS-supported region ID, such as cn-hangzhou or cn-beijing.

  3. Restart the existing application or deploy a new application to report data across regions.

    Note

    After this variable is set, all applications in the cluster report data to the specified region.

Method 2

Add -Daliyun.javaagent.profileId=cn-hangzhou to the startup command, or add the ALIYUN_JAVAAGENT_PROFILEID=cn-hangzhou environment variable.

Note

Agents V3.x

Modify agent configurations

  1. Go to the decompressed agent directory and find the arms-agent.config file.

    image

  2. Edit the arms-agent.config file and save your changes, or replace it with a prepared arms-agent.config file.

    Expand to View the arms-agent.config File (Example)

    ########################################################################
    #  Specify arms.licenseKey (obtained from the console) and arms.appName (the name of the integrated application).
    #
    #  Example:
    #  arms.licenseKey=XXXXXXXXXXXXXXX
    #  arms.appName=Demo-Service
    #
    ########################################################################
    
    arms.licenseKey=
    
    arms.appName=
    
    ########################################################################
    #  The ARMS agent operates with default system configurations. Maintain these settings to ensure system stability.
    ########################################################################
    
    profiler.collector.trace.endpoint=arms-dc-hz.aliyuncs.com
    profiler.collector.metric.endpoint=cn-hangzhou.arms.aliyuncs.com
    profiler.collector.meta.endpoint=arms-dc-hz.aliyuncs.com
    profiler.collector.endpoint=arms-dc-hz.aliyuncs.com
    
    
    profiler.log.report.support=true
    
    profiler.acm.endpoint=addr-hz-internal.edas.aliyun.com
    profiler.acm.tenant=c845a7b4-23a1-4f28-a380-5ab30d8a280f
    profiler.acm.region.id=cn-hangzhou
    
    # The region where the ARMS agent reports the Microservices Engine (MSE) monitoring data.
    profiler.mse.region=cn-hangzhou
    
    
    # The agent log level: ERROR < WARN <  INFO <  DEBUG < TRACE
    # Settings with a higher priority will output logs with a lower level.
    profiler.agent.logger.level=WARN
    
    # Global configuration: specifies whether to enable instrumentation. Retain the value true for the agent to work properly.
    profiler.enable=true
    
    # Global configuration: specifies whether to enable sampling function is enabled. Retain the value true to sample data properly.
    profiler.sampling.enable=true
    
    # Global configuration: the sampling rate, unit: %.
    profiler.sampling.rate=10
    
    ###########################################################
    # Dubbo                                                   #
    ###########################################################
    profiler.dubbo.enable=true
    
    ###########################################################
    # Google HTTP Client                                      #
    ###########################################################
    profiler.googlehttpclient.enable=true
    
    ###########################################################
    # Alibaba Cloud High-speed Service Framework (HSF)        #
    ###########################################################
    profiler.hsf.enable=true
    
    ###########################################################
    # HTTPClient3                                             #
    ###########################################################
    profiler.httpclient3.enable=true
    
    ###########################################################
    # HTTPClient4                                             #
    ###########################################################
    profiler.httpclient4.enable=true
    
    ###########################################################
    # JDK HTTP                                                #
    ###########################################################
    profiler.jdkhttp.enable=true
    
    ###########################################################
    # Jetty                                                   #
    ###########################################################
    profiler.jetty.enable=true
    
    ###########################################################
    # MyBatis                                                 #
    ###########################################################
    profiler.mybatis.enable=true
    
    ###########################################################
    # MySQL JDBC                                             #
    ###########################################################
    profiler.mysql.enable=true
    
    ###########################################################
    # OkHttp                                                 #
    ###########################################################
    profiler.okhttp.enable=true
    
    ###########################################################
    # Oracle JDBC                                             #
    ###########################################################
    profiler.oracle.enable=true
    
    ###########################################################
    # PostgreSQL JDBC                                         #
    ###########################################################
    profiler.postgresql.enable=true
    
    ###########################################################
    # Redis                                                   #
    ###########################################################
    profiler.redis.enable=true
    
    ###########################################################
    # Spring                                                  #
    ###########################################################
    profiler.spring.enable=true
    
    ###########################################################
    # Spring-boot                                             #
    ###########################################################
    profiler.springboot.enable=true
    
    ###########################################################
    # Tomcat                                                  #
    ###########################################################
    profiler.tomcat.enable=true
    
    ###########################################################
    # MongoDB                                                 #
    ###########################################################
    profiler.mongodb.enable=true
    
    ###########################################################
    # Lettuce                                                 #
    ###########################################################
    profiler.lettuce.enable=true
    
    ###########################################################
    # GRPC                                                    #
    ###########################################################
    profiler.grpc.enable=true
    
    ###########################################################
    # Thrift                                                  #
    ###########################################################
    profiler.thrift.enable=true
    
    ###########################################################
    # Memcached                                               #
    ###########################################################
    profiler.memcached.enable=true
    
    # Configurations for an invalid URL.
    
    
    profiler.thresholds.limit=100
    
    profiler.defined.method=
    
    profiler.callstack.maxLength=128
    
    profiler.callsql.maxLength=1024
    
    profiler.tprof.enableThreadProfiler=true
    
    profiler.alibabacloud.metaserver.address=100.100.100.200
    ###########################################################
    # SOFARPC                                                #
    ###########################################################
    profiler.sofa.rpc.enable=true
    
    profiler.exception.stacktrace=2
    
    ###########################################################
    # Tags                                                    #
    ###########################################################
    #profiler.tags.env=prod
    profiler.tags.env=
    
    #profler.tags.version=v1.0
    profiler.tags.version=
    
    #profiler.tags.customtags=key1:value1&key2:value2
    profiler.tags.customtags=
    Important

    Do not modify other parameters. Unexpected sampling behavior may result. To modify agent configurations, see Java application custom configuration.

    Parameter

    Description

    Default value

    arms.licenseKey

    The LicenseKey for agent installation. Obtain it from the Java Application Monitor card on the Integration Center page in the Cloud Monitor 2.0 console, or by calling DescribeTraceLicenseKey through the OpenAPI platform.

    -

    arms.appName

    The application name.

    -

    profiler.tags.env

    The application environment tag.

    -

    profiler.tags.version

    The application version tag.

    -

    profiler.tags.customtags

    Custom instance tag for the application.

    -

    profiler.collector.trace.endpoint

    Endpoint for reporting trace data.

    arms-dc-hz.aliyuncs.com

    profiler.collector.metric.endpoint

    Endpoint for reporting metric data.

    cn-hangzhou.arms.aliyuncs.com

    profiler.collector.meta.endpoint

    Endpoint for reporting metadata.

    arms-dc-hz.aliyuncs.com

    profiler.collector.endpoint

    Endpoint for reporting other information.

    arms-dc-hz.aliyuncs.com

    profiler.acm.endpoint

    Endpoint for listening to ACM dynamic configurations.

    addr-hz-internal.edas.aliyun.com

    profiler.acm.region.id

    Region of the ACM dynamic configuration.

    cn-hangzhou

    Note
    • The profiler.tags.env, profiler.tags.version, and profiler.tags.customtags parameters specify the tags of the instance monitored in ARMS.

    • The last six parameters use China (Hangzhou) as an example.

  3. Apply the modified configuration file to any ARMS Java agent V3.x installation as needed.

Modify the reporting region

The default reporting region depends on the integration method:

  • ACK integration: The region of your ACK cluster.

  • Manual integration: The region of the OSS bucket used for agent downloads.

To change the reporting region:

Method 1 (recommended)

For applications deployed in an ACK cluster:

  1. Update the ack-onepilot component to V4.0.0 or later.

  2. Add the ARMS_REPORT_REGION environment variable to the ack-onepilot-ack-onepilot application in the ack-onepilot namespace. Set the value to an ARMS-supported region ID. For example, you can set the value to cn-hangzhou or cn-beijing.

  3. Restart the existing application or deploy a new application to report data across regions.

    Note

    After this variable is set, all applications in the cluster report data to the specified region.

Method 2 (recommended)

For a manually installed agent, obtain a new installation package in the target region, and reinstall the agent.

Method 3 (not recommended)

Modify the parameters profiler.collector.trace.endpoint, profiler.collector.metric.endpoint, profiler.collector.meta.endpoint, profiler.collector.endpoint, profiler.acm.endpoint, and profiler.acm.region.id in the configuration file. For information about the endpoints, see Endpoints.

Important

The ARMS agent checks VPC connectivity and automatically switches to the public network on failure. Use VPC endpoints.

Agents 2.x

ARMS Application Monitoring no longer supports Java agent V2.x. Upgrade your agent to a version later than V2.x as soon as possible.