Custom configuration for Golang applications
Adjust agent feature switches, sampling policies, and other settings on the Custom Configuration tab.
Procedure
Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, choose .
-
On the application list page, click the name of the target application. In the top navigation bar, choose .
-
Configure the custom parameters and click Save.
Sampling settings
In the sampling settings area, configure sampling policies for traces. Golang applications support only fixed-rate sampling. You can also enable full sampling for specific API operations by name, prefix, or suffix.
The Sampling Rate defaults to 10%. A higher sampling rate consumes more system resources, so we recommend keeping the default value. The Full Sampling API Operations feature requires agent version 1.5.2 or later. After you configure the settings, click Save or Save and Copy to Other Applications.
Agent switch settings
In the Agent Switch Settings area, enable or disable Application Monitoring and adjust individual plugin switches.
Changes to enable or disable Application Monitoring take effect immediately without an application restart. Disabling Application Monitoring stops all data collection for your application. Proceed with caution.
Changes to individual plugin switches take effect only after you manually restart the application.
If you enable Disable Application Monitoring, billing is also paused. The Plugin Switches area includes multiple plugins, such as dubbo-plugin, mysql-plugin, redis-plugin, grpc-plugin, and kafka-client-plugin. For hertz-plugin, opentelemetry-plugin, and opentracing-plugin, changes take effect only after you restart the application. After you make changes, click Save, or click Copy to Other Applications.
Runtime switch settings
In the Runtime Switch Settings area, enable or disable Runtime monitoring. For more information, see Runtime monitoring.
Changes take effect immediately without an application restart. If you disable Runtime monitoring, Application Real-Time Monitoring Service (ARMS) will not collect Runtime metrics. Proceed with caution.
After you configure the settings, click Save, or click Save and Copy to Other Applications.
Application log association settings
In the Application Log Association Settings area, configure the log source for your application to include TraceId and SpanId in logs. For more information, see Associate business logs with TraceId for Golang applications.
You can change the field keys for trace_id and span_id that are printed to logs.
After you turn on the Automatically Associate Business Logs with TraceId switch, in the Log Service Binding area, select the region, Project name, and association type (Logstore or StoreView), and specify the Logstore name and association index. Then, click Save or Copy to Other Applications.
URL convergence settings
In the URL Convergence Settings area, enable or disable URL convergence and configure the threshold and rules. URL convergence groups similar URLs and displays them as a single entry. For example, URLs that start with /service/demo/ can be grouped. The convergence threshold is the minimum number of matching URLs required to trigger grouping. For example, if the threshold is 100, convergence occurs only after 100 URLs match a rule. For more information, see ARMS convergence mechanism.
Convergence rules are in regular expression format. Example: /service/(.*?)/demo. Separate multiple rules with commas (,). After you configure the settings, click Save or Save and Copy to Other Applications.
Continuous profiling settings
In the Continuous Profiling Settings area, enable or disable the main switch and the CPU, memory, and code hotspot features. For more information, see Continuous profiling for Golang applications.
You can also enable or disable goroutine hotspots (requires agent version 1.6.0 or later), blocking analysis, and mutex contention analysis (requires agent version 1.6.1 or later). After you configure the settings, click Save, or click Copy to Other Applications.
API call settings
In the API Call Settings area, configure the slow call threshold, HTTP status code whitelist, and invalid API call filtering.
You can also configure the Print HTTP Request Body and Print HTTP Request Header switches (requires agent version 1.5.0 or later), HTTP Body Length (default: 1024, requires agent version 1.4.0 or later), the Include TraceId in HTTP Response switch (adds Eagleeye-TraceId to the response header), the Print HTTP Response Body and Print HTTP Response Header switches (requires agent version 1.5.1 or later), HTTP Response Body Length (default: 1024), and the Write HTTP Request Header Key to Span and Write HTTP Response Header Key to Span fields.
-
Slow call threshold: The default value is 500 ms. An interface call is marked as slow if its response time exceeds this threshold.
-
HTTP Status Code Whitelist:
By default, HTTP status codes greater than 400 are classified as errors. To exclude a status code from being classified as an error, add it to this whitelist.
This setting only affects the HTTP frameworks currently supported by Application Monitoring.
Affected data: Error count metrics for HTTP servers and clients (arms_http_requests_error_count, arms_http_client_requests_error_count, and arms_app_requests_error_count), and span statuses.
Affected features: Error counts on the Application Overview, Inbound Calls, and Dependencies tabs, span statuses on the Trace Analysis page, and alerts for error counts.
Format: Enter a single status code, or multiple status codes separated by commas (,). Wildcard matching is not supported.
Example:
403,502Default: Empty
-
Filter Invalid API Calls:
To hide specific API calls from the Inbound Calls tab, enter their operation names. The agent will stop reporting observability data for these operations, and they will not appear on the API call page.
Affected data: All metrics and spans corresponding to the filtered API operations are ignored.
Affected features: All metrics for the corresponding API operations on the Application Overview, Inbound Calls, and Dependencies tabs, the number of spans on the Trace Analysis page, and the call volume, error count, and slow call alerts for the corresponding API operations.
Format: Use a string or an AntPath expression to match the full name of the invalid API operation. Separate multiple rules with commas (,). The default AntPath expression is used for backward compatibility. Do not delete it; instead, append new rules after the existing ones.
Example:
/api/test/*,/api/playground/createDefault:
/**/*.jpg,/**/*.png,/**/*.js,/**/*.jpeg,/**/*.pdf,/**/*.xlsx,/**/*.txt,/**/*.docs,/**/*.gif,/**/*.csv -
Print HTTP Request Body: If enabled, the http.request.body field is added to the HTTP client span. The default length of the printed body is 1024 characters.
-
Print HTTP Request Header: If enabled, the http.request.header field is added to the HTTP client span.
-
HTTP Body Length: Sets the maximum captured length of the HTTP request body. The default is 1024 characters.
-
Include TraceId in HTTP Response: If enabled, a TraceId is added to the response header with Eagleeye-TraceId as the key.
-
Print HTTP Response Body: If enabled, the http.response.body field is added to the HTTP server span.
-
Print HTTP Response Header: If enabled, the http.response.header field is added to the HTTP server span.
-
HTTP Response Body Length: Sets the maximum captured length of the HTTP response body. The default is 1024 characters.
-
Write HTTP Request Header Key to Span: Specify which request header keys to add to the span, separating multiple keys with commas (,). This adds an http.request.header.key field to the HTTP client span.
-
Write HTTP Response Header Key to Span: Specify which response header keys to add to the span, separating multiple keys with commas (,). This adds an http.response.header.key field to the HTTP server span.
Advanced exception filtering settings
-
Collect plugin exceptions: Enables or disables the collection of exceptions generated by ARMS plugins.
-
Exception filter whitelist: To prevent certain exceptions from being counted on the Exception Analysis tab, add their names to this whitelist. This hides them from the page.
Turn off the Collect plugin exceptions switch to prevent the same exception from being recorded multiple times. In the Exception filter whitelist field, you can enter multiple exception names separated by commas (,), for example, *mysql.MySQLError. Exceptions that match the whitelist are still recorded in the span. This feature is available in agent version 2.3.1 and later.
Database call settings
In the Database Call Settings area, set the slow SQL threshold and maximum length of collected SQL statements, and specify whether to display variable bindings and constant values in SQL statements.
-
Display variable bindings in SQL statements: Captures the variable values bound to PreparedStatement parameters. The change takes effect without an application restart.
-
Display constant values in SQL statements: Truncates SQL statements without additional processing. The change takes effect without an application restart.
The Slow SQL threshold is 500 ms by default. Queries that exceed this threshold are marked as slow SQL. The Maximum length of collected SQL statements is 1024 by default. Content beyond this length is truncated. The Display variable bindings in SQL statements setting is supported only for MySQL. After you configure the settings, click Save or Save and Copy to Other Applications.
Trace propagation protocol settings
In the Trace Propagation Protocol Settings area, select a trace propagation protocol. The default is W3C. Other options include Zipkin, Jaeger, and EagleEye.
Switching protocols requires agent version 1.4.0 or later. The propagation mode supports two options: Priority and Forced. Priority mode first attempts to read the selected protocol's header. If the header is missing, it probes for other protocol headers. Forced mode strictly uses the selected protocol. If its header is missing, it generates a new trace context based on that protocol's specification.
Agent collection settings
In the Agent Collection Settings area, configure the maximum number of traces the agent collects per second and the agent's log level.
The Maximum number of traces collected by the agent per second defaults to 100. Custom metric collection requires agent version 2.0.0 or later. The Turn on span reporting setting requires agent version 1.8.3 or later. Span reporting name requires agent version 1.7.0 or later. You can separate multiple keys with commas (,). Default metric collection filter requires agent version 2.3.0 or later.
Key parameters:
-
Custom metric collection: Controls whether the agent collects metrics defined in your code via the OTel SDK.
-
Turn on span reporting: Enabled by default. If disabled, span reporting stops.
-
Span reporting name: Specifies the names of spans to report even if the main span reporting switch is disabled.
-
Custom metric collection configuration: Configures the scope name for metrics. If not configured, all custom metrics are collected by default.
Default metric collection filter: Filters reporting for specified metric types. Select from the following options:
-
custom_entry: Custom metrics for method monitoring.
-
http: Metrics for HTTP servers.
-
http_client: Metrics for HTTP clients.
-
rpc: Metrics for RPC servers.
-
rpc_client: Metrics for RPC clients.
-
sql: Metrics related to database services.
-
nosql: Metrics related to NoSQL services.
-
cache: Metrics related to caching services.
-
producer: Metrics related to message producers.
-
consumer: Metrics related to message consumers.
-
schedule: Metrics related to scheduling services.
Advanced settings
In the Advanced Settings area, configure percentile statistics, error and slow call sampling, and the maximum length of exception stacks.
The default value for the Maximum Length of Exception Stacks is 4096. After you configure the settings, click Save or Save and Copy to Other Applications.
Copy configurations to other applications
If you need to apply the same configuration to other applications, you can copy the settings.
Copy a single configuration
-
In the corresponding configuration section, click Save and Copy to Other Applications.
-
If the Current settings not saved dialog box appears, click OK to save the configuration for the current application, and then click Save and Copy to Other Applications again.
-
In the dialog box that appears, select the applications to which you want to apply the settings, and then click OK.
Copy all configurations
-
At the bottom of the page, click Save and Copy to Other Applications.
-
If the Current settings not saved dialog box appears, click OK to save the configuration for the current application, and then click Save and Copy to Other Applications again.
-
In the dialog box that appears, select the applications to which you want to apply the settings, and then click OK.
Global default configuration
You can save the current configuration as the global default configuration. This configuration then applies by default when you create new applications.
-
At the bottom of the page, click Save Current App Settings as Global Default Configuration.
-
If the Current settings not saved dialog box appears, click OK to save the configuration for the current application, and then click Save Current App Settings as Global Default Configuration again.
-
In the dialog box that appears, click Confirm.