tencent cloud

Tencent Cloud Observability Platform

Release Notes and Announcements
Release Notes
Product Introduction
Overview
Strengths
Basic Features
Basic Concepts
Use Cases
Use Limits
Purchase Guide
Tencent Cloud Product Monitoring
Application Performance Management
Mobile App Performance Monitoring
Real User Monitoring
Cloud Automated Testing
Prometheus Monitoring
Grafana
EventBridge
PTS
Quick Start
Monitoring Overview
Instance Group
Tencent Cloud Product Monitoring
Application Performance Management
Real User Monitoring
Cloud Automated Testing
Performance Testing Service
Prometheus Getting Started
Grafana
Dashboard Creation
EventBridge
Alarm Service
Cloud Product Monitoring
Tencent Cloud Service Metrics
Operation Guide
CVM Agents
Cloud Product Monitoring Integration with Grafana
Troubleshooting
Practical Tutorial
Application Performance Management
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Parameter Information
FAQs
Mobile App Performance Monitoring
Overview
Operation Guide
Access Guide
Practical Tutorial
Tencent Cloud Real User Monitoring
Product Introduction
Operation Guide
Connection Guide
FAQs
Cloud Automated Testing
Product Introduction
Operation Guide
FAQs
Performance Testing Service
Overview
Operation Guide
Practice Tutorial
JavaScript API List
FAQs
Prometheus Monitoring
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Terraform
FAQs
Grafana
Product Introduction
Operation Guide
Guide on Grafana Common Features
FAQs
Dashboard
Overview
Operation Guide
Alarm Management
Console Operation Guide
Troubleshooting
FAQs
EventBridge
Product Introduction
Operation Guide
Practical Tutorial
FAQs
Report Management
FAQs
General
Alarm Service
Concepts
Monitoring Charts
CVM Agents
Dynamic Alarm Threshold
CM Connection to Grafana
Documentation Guide
Related Agreements
Application Performance Management Service Level Agreement
APM Privacy Policy
APM Data Processing And Security Agreement
RUM Service Level Agreement
Mobile Performance Monitoring Service Level Agreement
Cloud Automated Testing Service Level Agreement
Prometheus Service Level Agreement
TCMG Service Level Agreements
PTS Service Level Agreement
PTS Use Limits
Cloud Monitor Service Level Agreement
API Documentation
History
Introduction
API Category
Making API Requests
Monitoring Data Query APIs
Alarm APIs
Legacy Alert APIs
Notification Template APIs
TMP APIs
Grafana Service APIs
Event Center APIs
TencentCloud Managed Service for Prometheus APIs
Monitoring APIs
Data Types
Error Codes
Glossary

Setting Global Options

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-03-10 22:14:20
To customize the behavior (passing in custom parameter values and overriding the default configuration) of the performance testing engine during the execution of performance testing tasks, you can set the global Options to control parameters, such as Transport Layer Security (TLS)/HTTP/WebSocket communication configuration parameters and preprocessing/post-processing timeout interval.
To set the global Options, you can define an option object (export const option = {...}) at the outermost layer of the script, and define fields, such as tlsConfig and http in the option object based on your needs.
Note:
For parameter details, see the PTS JavaScript API documentation Option.

HTTP Global Configuration

Through the http field in option, you can configure relevant parameters for the performance testing engine as an HTTP client. These parameters take effect globally for all HTTP requests in this performance testing task.
Common parameters are as follows:
headers: Request header.
basicAuth: When using HTTP basic authentication, pass in the username and password through this parameter.
disableKeepAlives: To disable persistent connection, set this field to true.
discardResponseBody: To discard the response body returned by the server, set this field to true.
http2: To enable HTTP/2, set this field to true.
maxIdleConns: Maximum number of connections per VU. The default value is 100.
maxIdleConnsPerHost: Maximum number of connections per VU for a single host (address + port). The default value is 2.
maxRedirects: Maximum number of redirects. The default value is 10.
timeout: Request timeout interval, in milliseconds. The default value is 10000 (10 seconds).
Script example:
import http from 'pts/http';
import { check } from 'pts';

export const option = {
http: {
maxRedirects: 10,
maxIdleConns: 100,
headers: {
'key': 'value'
}
}
}
export default function () {
// get request with headers and parameters
const resp1 = http.get('http://httpbin.org/get', {
headers: {
Connection: 'keep-alive',
'User-Agent': 'pts-engine',
},
query: {
name1: 'value1',
name2: 'value2',
},
});

console.log(resp1.json().args.name1); // 'value1'
check('status is 200', () => resp1.statusCode === 200);
check('body.args.name1 equals value1', () => resp1.json().args.name1 === 'value1');
check('headers.key equals value', () => resp1.json().headers.key === 'value')
}

WebSocket Global Configuration

Through the ws field in option, you can configure relevant parameters for the performance testing engine as a WebSocket client. These parameters take effect globally for all WebSocket requests in this performance testing task.
Common parameters are as follows:
handshakeTimeout: Handshake timeout interval, in milliseconds. The default value is 30 seconds.
readTimeout: Timeout interval for reading messages, in milliseconds. It is not limited by default.
writeControlTimeout: Timeout interval for writing control instructions, in milliseconds. The default value is 10 seconds.
writeTimeout: Timeout interval for writing messages, in milliseconds. It is not limited by default.
Example:
export const option = {
ws: {
writeTimeout: 3000,
readTimeout: 3000,
}
}

TLS Global Configuration

As the client, the performance testing engine supports the following configuration options when a TLS connection is established:
insecureSkipVerify: Whether to verify the certificate chain and hostname of the server. If it is set to true, no validation will be performed (the default value is false).
rootCAs: A set of root certificate authorities used when verifying server certificates. If it is left empty, the root CA set of the host will be used by default.
certificates: A list of certificates provided by the client for server verification in mutual TLS authentication (certificate files can be uploaded through File Management > Request File in the scenario).
Example:
export const option = {
tlsConfig: {
'localhost': {
insecureSkipVerify: false,
rootCAs: [open('ca.crt')],
certificates: [{cert: open('client.crt'), key: open('client.key')}]
}
}
}

Preprocessing and Post-Processing Configuration

setupTimeoutSeconds: timeout interval for the preprocessing (setup) step. The default value is 60 seconds. Example:
export const option = { setupTimeoutSeconds: 30 }
teardownTimeoutSeconds: Timeout interval for the post-processing (teardown) step. The default value is 60 seconds.
export const option = {
teardownTimeoutSeconds: 30
}
Note:
For details on script preprocessing/post-processing, see Script Overview.


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백