El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Signature Conventions

Updated on 2024-04-08 GMT+08:00

Request Signatures

func(map[string]string) interface{}

Input parameters: CodeArts PerfTest built-in parameters and custom parameters.

Output parameters: The IResultV1 interface needs to be implemented. If necessary, use IResultV1 Interface Implementation provided by CodeArts PerfTest.

Table 1 CodeArts PerfTest built-in parameters

Name

Description

Remarks

__name

Name of a request

-

__goroutine_id

Coroutine ID

-

__executor_index

Executor index

The sequence number starts from 0.

__executor_count

Total number of executors

-

Function Signatures

func(map[string]string) string

Input parameters: customized parameters

Output parameters: character strings

Checkpoint Signatures

func(map[string]string) string

Input parameters: customized parameters.

Output parameters: character strings. An empty character string indicates that the check is successful, and a non-empty character string indicates the check fails.

IResultV1 Interface Implementation

package main

import (
	"fmt"
	"time"
)

const (
	InnerVarName          = "__name"
	InnerVarGoroutineId   = "__goroutine_id"
	InnerVarExecutorIndex = "__executor_index"
	InnerVarExecutorCount = "__executor_count"
)

type IResultV1 interface {
	GetName() string
	GetUrl() string
	GetMethod() string
	GetRequestHeader() map[string]string
	GetRequestBody() string
	GetSentBytes() int
	GetResponseCode() int
	GetResponseHeader() map[string]string
	GetResponseBody() string
	GetReceivedBytes() int
	GetFailureMessage() string
	IsSuccess() bool
	GetBeginTime() int64
	GetEndTime() int64
	GetSubResults() []interface{}
}

//acquireResult generates root result.
//just call one time on the main func and generate sub result using parent.addSub()
func acquireResult(name string) *Result {
	result := &Result{}
	result.Name = name
	result.RequestHeader = map[string]string{}
	result.ResponseHeader = map[string]string{}
	result.ResponseCode = 200
	result.Success = true
	result.BeginTime = time.Now().UnixMilli()
	result.EndTime = time.Now().UnixMilli()
	return result
}

type Result struct {
	Name           string
	Url            string
	Method         string
	RequestHeader  map[string]string
	RequestBody    string
	SentBytes      int
	ResponseCode   int
	ResponseHeader map[string]string
	ResponseBody   string
	ReceivedBytes  int
	FailureMessage string
	Success        bool
	BeginTime      int64
	EndTime        int64
	SubResults     []interface{}
	SubIndex       int
}

func (r *Result) GetName() string {
	return r.Name
}

func (r *Result) GetUrl() string {
	return r.Url
}

func (r *Result) GetMethod() string {
	return r.Method
}

func (r *Result) GetRequestHeader() map[string]string {
	return r.RequestHeader
}

func (r *Result) GetRequestBody() string {
	return r.RequestBody
}

func (r *Result) GetSentBytes() int {
	return r.SentBytes
}

func (r *Result) GetResponseCode() int {
	return r.ResponseCode
}

func (r *Result) GetResponseHeader() map[string]string {
	return r.ResponseHeader
}

func (r *Result) GetResponseBody() string {
	return r.ResponseBody
}

func (r *Result) GetReceivedBytes() int {
	return r.ReceivedBytes
}

func (r *Result) GetFailureMessage() string {
	return r.FailureMessage
}

func (r *Result) IsSuccess() bool {
	return r.Success
}

func (r *Result) GetBeginTime() int64 {
	return r.BeginTime
}

func (r *Result) GetEndTime() int64 {
	return r.EndTime
}

func (r *Result) GetSubResults() []interface{} {
	return r.SubResults
}

//begin records begin time, do not forget call this function to update
func (r *Result) begin() {
	r.BeginTime = time.Now().UnixMilli()
}

//end records end time, do not forget call this function to update
func (r *Result) end() {
	r.EndTime = time.Now().UnixMilli()
}

//addSub adds sub result to parent, call this function adding sub result always.
//if name is not empty, renaming will be disabled
func (r *Result) addSub(name string) *Result {
	if name == "" {
		name = fmt.Sprintf("%s-%d", r.Name, r.SubIndex)
		r.SubIndex++
	} else {
		name = fmt.Sprintf("%s-%s", r.Name, name)
	}
	sub := acquireResult(name)
	r.SubResults = append(r.SubResults, sub)
	return sub
}
Table 2 Structure of the IResultV1 interface

Name

Description

Remarks

Name

Name of a request

The root result must be set using the built-in parameter __name.

Url

Request URL

-

Method

Method

Used for HTTP POST and GET.

RequestHeader

Request header

Used for HTTP

RequestBody

Request data

Do not record data with a large request size, for example, uploading a file. You only need to record the abstract.

SentBytes

Number of bytes sent

-

ResponseCode

Response code

Response status, which can be used for HTTP status codes or custom status codes. It is used to report the number of response statuses for analysis.

Response code range: 100–599

ResponseHeader

Response header

Used for HTTP.

ResponseBody

Response data

Do not record data with a large response, for example, downloading a file. You only need to record the abstract.

ReceivedBytes

Bytes received

-

FailureMessage

Failure message

-

Success

Whether the request is successful

-

BeginTime

Request start time

Unit: ms

EndTime

Request end time

Unit: ms

SubResults

Sub-request

When a custom request has multiple sub-requests, this field is used to record the execution status of each sub-request.

SubIndex

Sub-request index

When the addSub method of the parent result is used to generate a sub-result, and the sub-result name is not customized, this field is used to generate an index for generating the sub-result name.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback