You can control the default configurations of Application Real-Time Monitoring Service (ARMS) agents for Java through static configuration files.
Static configuration files only modify some static configurations and default configurations. The priority for these configurations is lower than that for dynamic configurations, Java system properties, and environment variables.
Agents V4.x and later
For these agents, all configuration files are built into the JAR package. You can create an external configuration file for writing external parameters. External configuration files override built-in configuration files in the JAR package, but are still below dynamic configurations, Java system properties, and environment variables.
Modify agent configurations
Create an agent configuration file with the extension
.properties, such asmy-app.properties, preferably in the directory where the agent is.Write the following parameters as needed. Their default values are all empty.
Parameter
Description
arms.licenseKey
The LicenseKey required for installing the agent. You can obtain it by clicking the Java Application Monitor card on the Integration Center page in the ARMS console, or by calling DescribeTraceLicenseKey on 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 of the application.
The last three configuration items specify the tags of the instance monitored in ARMS.
When the agent starts, add
-Dotel.javaagent.configuration-file=/path/to/my-app.propertiesto the startup command or set the environment variableOTEL_JAVAAGENT_CONFIGURATION_FILE=/path/to/my-app.properties.NoteReplace
/path/to/my-app.propertieswith the absolute path of the configuration file.When both the startup command and environment variable are configured, the startup command takes precedence.
Apply the modified configuration file to the installation of any ARMS agent for Java V4.x as needed.
Modify the reporting region
The default data reporting region depends on how it's integrated:
Integration through Alibaba Cloud Container Service for Kubernetes (ACK): The region of your ACK cluster.
Manual integration: The region of the Object Storage Service (OSS) bucket used for agent downloads.
To modify the region where the agent reports monitoring data:
Method 1
For applications deployed in an ACK cluster:
Update the ack-onepilot component to V4.0.0 or later.
Add the ARMS_REPORT_REGION environment variable to the ack-onepilot-ack-onepilot application in the ack-onepilot namespace. The value must be the ID of a region where ARMS is available. Example: cn-hangzhou or cn-beijing.
Restart the existing application or deploy a new application to report data across regions.
NoteAfter the environment variable is added, all applications deployed in the cluster report data to the region specified in the previous step.
Method 2
Add -Daliyun.javaagent.profileId=cn-hangzhou to the startup command, or add the ALIYUN_JAVAAGENT_PROFILEID=cn-hangzhou environment variable.
Replace
cn-hangzhouwith any reporting region supported by ARMS.When both the startup command and environment variable are configured, the startup command takes precedence.
Agents V3.x
Modify agent configurations
Go to the decompressed agent directory and find the
arms-agent.configfile.
Modify the configurations in the
arms-agent.configfile and save the changes, or replace them with anarms-agent.configfile you prepared.ImportantDo not modify other parameters in the configuration file, because this may lead to unexpected sampling results. To modify agent configurations, see Customize settings for a Java application.
Parameter
Description
Default value
arms.licenseKey
The LicenseKey required for installing the agent. Obtain it by clicking the Java Application Monitor card on the Integration Center page in the ARMS console, or by calling DescribeTraceLicenseKey on 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 of 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 dynamic configurations of Application Configuration Management (ACM).
addr-hz-internal.edas.aliyun.com
profiler.acm.region.id
Region where the dynamic configuration of ACM is.
cn-hangzhou
NoteThe
profiler.tags.env,profiler.tags.version, andprofiler.tags.customtagsparameters specify the tags of the instance monitored in ARMS.The last six parameters use the China (Hangzhou) region for example only.
Apply the modified configuration file to the installation of any ARMS agent for Java V3.x as needed.
Modify the reporting region
The default data reporting region depends on how it's integrated:
Integration through Alibaba Cloud Container Service for Kubernetes (ACK): The region of your ACK cluster.
Manual integration: The region of the Object Storage Service (OSS) bucket used for agent downloads.
To modify the region where the agent reports monitoring data:
Method 1 (recommended)
For applications deployed in an ACK cluster:
Update the ack-onepilot component to V4.0.0 or later.
Add the ARMS_REPORT_REGION environment variable to the ack-onepilot-ack-onepilot application in the ack-onepilot namespace. The value must be the ID of a region where ARMS is available. For example, you can set the value to cn-hangzhou or cn-beijing.
Restart the existing application or deploy a new application to report data across regions.
NoteAfter the environment variable is added, all applications deployed in the cluster report data to the region specified in the previous step.
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.
The ARMS agent includes virtual public cloud (VPC) connectivity checks. If VPC connectivity fails, it automatically switches to the public network. Therefore, we recommend that you use VPC endpoints instead.
Agents 2.x
ARMS Application Monitoring no longer supports agents for Java V2.x. Upgrade your agent to a version later than V2.x as soon as possible.