From 1c5a999f472871cbbda949f16d3e33514710b14d Mon Sep 17 00:00:00 2001 From: JophieQu Date: Sat, 11 Oct 2025 17:22:12 +0800 Subject: [PATCH 1/5] support pprof query api --- query/schema.go | 252 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) diff --git a/query/schema.go b/query/schema.go index a336825..d8c1c46 100644 --- a/query/schema.go +++ b/query/schema.go @@ -850,6 +850,77 @@ type ProfiledTraceSegments struct { Spans []*ProfiledSpan `json:"spans"` } +type PprofAnalyzation struct { + Tree *PprofStackTree `json:"tree,omitempty"` +} + +type PprofAnalyzationRequest struct { + TaskID string `json:"taskId"` + InstanceIds []string `json:"instanceIds"` +} + +type PprofStackElement struct { + ID string `json:"id"` + ParentID string `json:"parentId"` + CodeSignature string `json:"codeSignature"` + Total int64 `json:"total"` + Self int64 `json:"self"` +} + +type PprofStackTree struct { + Elements []*PprofStackElement `json:"elements,omitempty"` +} + +type PprofTask struct { + ID string `json:"id"` + ServiceID string `json:"serviceId"` + ServiceInstanceIds []string `json:"serviceInstanceIds"` + CreateTime int64 `json:"createTime"` + Events PprofEventType `json:"events"` + Duration *int `json:"duration,omitempty"` + DumpPeriod *int `json:"dumpPeriod,omitempty"` +} + +type PprofTaskCreationRequest struct { + ServiceID string `json:"serviceId"` + ServiceInstanceIds []string `json:"serviceInstanceIds"` + Duration *int `json:"duration,omitempty"` + Events PprofEventType `json:"events"` + DumpPeriod *int `json:"dumpPeriod,omitempty"` +} + +type PprofTaskCreationResult struct { + Code PprofTaskCreationType `json:"code"` + ErrorReason *string `json:"errorReason,omitempty"` + ID *string `json:"id,omitempty"` +} + +type PprofTaskListRequest struct { + ServiceID string `json:"serviceId"` + StartTime *int64 `json:"startTime,omitempty"` + EndTime *int64 `json:"endTime,omitempty"` + Limit *int `json:"limit,omitempty"` +} + +type PprofTaskListResult struct { + ErrorReason *string `json:"errorReason,omitempty"` + Tasks []*PprofTask `json:"tasks,omitempty"` +} + +type PprofTaskLog struct { + ID string `json:"id"` + InstanceID string `json:"instanceId"` + InstanceName string `json:"instanceName"` + OperationType PprofTaskLogOperationType `json:"operationType"` + OperationTime int64 `json:"operationTime"` +} + +type PprofTaskProgress struct { + Logs []*PprofTaskLog `json:"logs,omitempty"` + ErrorInstanceIds []*string `json:"errorInstanceIds,omitempty"` + SuccessInstanceIds []*string `json:"successInstanceIds,omitempty"` +} + type Query struct { } @@ -2211,6 +2282,187 @@ func (e ProfileTaskLogOperationType) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } +type PprofEventType string + +const ( + PprofEventTypeCPU PprofEventType = "CPU" + PprofEventTypeHeap PprofEventType = "HEAP" + PprofEventTypeBlock PprofEventType = "BLOCK" + PprofEventTypeMutex PprofEventType = "MUTEX" + PprofEventTypeGoroutine PprofEventType = "GOROUTINE" + PprofEventTypeThreadcreate PprofEventType = "THREADCREATE" + PprofEventTypeAllocs PprofEventType = "ALLOCS" +) + +var AllPprofEventType = []PprofEventType{ + PprofEventTypeCPU, + PprofEventTypeHeap, + PprofEventTypeBlock, + PprofEventTypeMutex, + PprofEventTypeGoroutine, + PprofEventTypeThreadcreate, + PprofEventTypeAllocs, +} + +func (e PprofEventType) IsValid() bool { + switch e { + case PprofEventTypeCPU, PprofEventTypeHeap, PprofEventTypeBlock, PprofEventTypeMutex, PprofEventTypeGoroutine, PprofEventTypeThreadcreate, PprofEventTypeAllocs: + return true + } + return false +} + +func (e PprofEventType) String() string { + return string(e) +} + +func (e *PprofEventType) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = PprofEventType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid PprofEventType", str) + } + return nil +} + +func (e PprofEventType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *PprofEventType) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e PprofEventType) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + +type PprofTaskCreationType string + +const ( + PprofTaskCreationTypeSuccess PprofTaskCreationType = "SUCCESS" + PprofTaskCreationTypeArgumentError PprofTaskCreationType = "ARGUMENT_ERROR" + PprofTaskCreationTypeAlreadyProfilingError PprofTaskCreationType = "ALREADY_PROFILING_ERROR" +) + +var AllPprofTaskCreationType = []PprofTaskCreationType{ + PprofTaskCreationTypeSuccess, + PprofTaskCreationTypeArgumentError, + PprofTaskCreationTypeAlreadyProfilingError, +} + +func (e PprofTaskCreationType) IsValid() bool { + switch e { + case PprofTaskCreationTypeSuccess, PprofTaskCreationTypeArgumentError, PprofTaskCreationTypeAlreadyProfilingError: + return true + } + return false +} + +func (e PprofTaskCreationType) String() string { + return string(e) +} + +func (e *PprofTaskCreationType) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = PprofTaskCreationType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid PprofTaskCreationType", str) + } + return nil +} + +func (e PprofTaskCreationType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *PprofTaskCreationType) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e PprofTaskCreationType) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + +type PprofTaskLogOperationType string + +const ( + PprofTaskLogOperationTypeNotified PprofTaskLogOperationType = "NOTIFIED" + PprofTaskLogOperationTypeExecutionFinished PprofTaskLogOperationType = "EXECUTION_FINISHED" + PprofTaskLogOperationTypePprofUploadFileTooLargeError PprofTaskLogOperationType = "PPROF_UPLOAD_FILE_TOO_LARGE_ERROR" + PprofTaskLogOperationTypeExecutionTaskError PprofTaskLogOperationType = "EXECUTION_TASK_ERROR" +) + +var AllPprofTaskLogOperationType = []PprofTaskLogOperationType{ + PprofTaskLogOperationTypeNotified, + PprofTaskLogOperationTypeExecutionFinished, + PprofTaskLogOperationTypePprofUploadFileTooLargeError, + PprofTaskLogOperationTypeExecutionTaskError, +} + +func (e PprofTaskLogOperationType) IsValid() bool { + switch e { + case PprofTaskLogOperationTypeNotified, PprofTaskLogOperationTypeExecutionFinished, PprofTaskLogOperationTypePprofUploadFileTooLargeError, PprofTaskLogOperationTypeExecutionTaskError: + return true + } + return false +} + +func (e PprofTaskLogOperationType) String() string { + return string(e) +} + +func (e *PprofTaskLogOperationType) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = PprofTaskLogOperationType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid PprofTaskLogOperationType", str) + } + return nil +} + +func (e PprofTaskLogOperationType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *PprofTaskLogOperationType) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e PprofTaskLogOperationType) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + type QueryOrder string const ( From f42854fee42a7f01f1690cf555412c0870b4a90a Mon Sep 17 00:00:00 2001 From: JophieQu Date: Sat, 11 Oct 2025 17:23:34 +0800 Subject: [PATCH 2/5] add sha --- dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.sh b/dependencies.sh index 161b3ac..aa2feb9 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -18,7 +18,7 @@ # under the License. export COLLECT_PROTOCOL_SHA=16c51358ebcf42629bf4ffdf952253971f20eb25 -export QUERY_PROTOCOL_SHA=97f9bfc9dbf9313a951a5fa3791e92186cfede05 +export QUERY_PROTOCOL_SHA=0036646769842e915e2828fde0b6c1da0179a1e5 export ENVOY_SERVICE_PROTOCOL_SHA=533b32f1b390a3a88ec2008d0561e07c926d879a export XDS_SERVICE_PROTOCOL_SHA=25de7278fc844d392d607214f36dbedf50f167ee export PROTOC_VALIDATE_SHA=v0.6.1 From 8ed763288aa9be8ff36f3357473c2d176f622516 Mon Sep 17 00:00:00 2001 From: JophieQu Date: Sat, 11 Oct 2025 17:47:17 +0800 Subject: [PATCH 3/5] fix --- go.mod | 5 + go.sum | 24 +++++ query/schema.go | 257 ++++++++++++++++++++++++------------------------ 3 files changed, 157 insertions(+), 129 deletions(-) diff --git a/go.mod b/go.mod index 07455a3..48e18d7 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,16 @@ module skywalking.apache.org/repo/goapi go 1.24 require ( + github.com/99designs/gqlgen v0.17.73 + github.com/vektah/gqlparser/v2 v2.5.26 google.golang.org/grpc v1.73.0 google.golang.org/protobuf v1.36.6 ) require ( + github.com/agnivade/levenshtein v1.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/sosodev/duration v1.3.1 // indirect golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.33.0 // indirect golang.org/x/text v0.25.0 // indirect diff --git a/go.sum b/go.sum index 4c7396c..2605549 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,15 @@ +github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg= +github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg= +github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= +github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -8,6 +20,16 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/vektah/gqlparser/v2 v2.5.26 h1:REqqFkO8+SOEgZHR/eHScjjVjGS8Nk3RMO/juiTobN4= +github.com/vektah/gqlparser/v2 v2.5.26/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= @@ -32,3 +54,5 @@ google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/query/schema.go b/query/schema.go index d8c1c46..8e4d83c 100644 --- a/query/schema.go +++ b/query/schema.go @@ -728,6 +728,76 @@ type PodContainers struct { Containers []string `json:"containers"` } +type PprofAnalyzation struct { + Tree *PprofStackTree `json:"tree,omitempty"` +} + +type PprofAnalyzationRequest struct { + TaskID string `json:"taskId"` + InstanceIds []string `json:"instanceIds"` +} + +type PprofStackElement struct { + ID string `json:"id"` + ParentID string `json:"parentId"` + CodeSignature string `json:"codeSignature"` + Total int64 `json:"total"` + Self int64 `json:"self"` +} + +type PprofStackTree struct { + Elements []*PprofStackElement `json:"elements,omitempty"` +} + +type PprofTask struct { + ID string `json:"id"` + ServiceID string `json:"serviceId"` + ServiceInstanceIds []string `json:"serviceInstanceIds"` + CreateTime int64 `json:"createTime"` + Events PprofEventType `json:"events"` + Duration *int `json:"duration,omitempty"` + DumpPeriod *int `json:"dumpPeriod,omitempty"` +} + +type PprofTaskCreationRequest struct { + ServiceID string `json:"serviceId"` + ServiceInstanceIds []string `json:"serviceInstanceIds"` + Duration *int `json:"duration,omitempty"` + Events PprofEventType `json:"events"` + DumpPeriod *int `json:"dumpPeriod,omitempty"` +} + +type PprofTaskCreationResult struct { + Code PprofTaskCreationType `json:"code"` + ErrorReason *string `json:"errorReason,omitempty"` + ID *string `json:"id,omitempty"` +} + +type PprofTaskListRequest struct { + ServiceID string `json:"serviceId"` + QueryDuration *Duration `json:"queryDuration,omitempty"` + Limit *int `json:"limit,omitempty"` +} + +type PprofTaskListResult struct { + ErrorReason *string `json:"errorReason,omitempty"` + Tasks []*PprofTask `json:"tasks,omitempty"` +} + +type PprofTaskLog struct { + ID string `json:"id"` + InstanceID string `json:"instanceId"` + InstanceName string `json:"instanceName"` + OperationType PprofTaskLogOperationType `json:"operationType"` + OperationTime int64 `json:"operationTime"` +} + +type PprofTaskProgress struct { + Logs []*PprofTaskLog `json:"logs,omitempty"` + ErrorInstanceIds []*string `json:"errorInstanceIds,omitempty"` + SuccessInstanceIds []*string `json:"successInstanceIds,omitempty"` +} + type Process struct { ID string `json:"id"` Name string `json:"name"` @@ -850,77 +920,6 @@ type ProfiledTraceSegments struct { Spans []*ProfiledSpan `json:"spans"` } -type PprofAnalyzation struct { - Tree *PprofStackTree `json:"tree,omitempty"` -} - -type PprofAnalyzationRequest struct { - TaskID string `json:"taskId"` - InstanceIds []string `json:"instanceIds"` -} - -type PprofStackElement struct { - ID string `json:"id"` - ParentID string `json:"parentId"` - CodeSignature string `json:"codeSignature"` - Total int64 `json:"total"` - Self int64 `json:"self"` -} - -type PprofStackTree struct { - Elements []*PprofStackElement `json:"elements,omitempty"` -} - -type PprofTask struct { - ID string `json:"id"` - ServiceID string `json:"serviceId"` - ServiceInstanceIds []string `json:"serviceInstanceIds"` - CreateTime int64 `json:"createTime"` - Events PprofEventType `json:"events"` - Duration *int `json:"duration,omitempty"` - DumpPeriod *int `json:"dumpPeriod,omitempty"` -} - -type PprofTaskCreationRequest struct { - ServiceID string `json:"serviceId"` - ServiceInstanceIds []string `json:"serviceInstanceIds"` - Duration *int `json:"duration,omitempty"` - Events PprofEventType `json:"events"` - DumpPeriod *int `json:"dumpPeriod,omitempty"` -} - -type PprofTaskCreationResult struct { - Code PprofTaskCreationType `json:"code"` - ErrorReason *string `json:"errorReason,omitempty"` - ID *string `json:"id,omitempty"` -} - -type PprofTaskListRequest struct { - ServiceID string `json:"serviceId"` - StartTime *int64 `json:"startTime,omitempty"` - EndTime *int64 `json:"endTime,omitempty"` - Limit *int `json:"limit,omitempty"` -} - -type PprofTaskListResult struct { - ErrorReason *string `json:"errorReason,omitempty"` - Tasks []*PprofTask `json:"tasks,omitempty"` -} - -type PprofTaskLog struct { - ID string `json:"id"` - InstanceID string `json:"instanceId"` - InstanceName string `json:"instanceName"` - OperationType PprofTaskLogOperationType `json:"operationType"` - OperationTime int64 `json:"operationTime"` -} - -type PprofTaskProgress struct { - Logs []*PprofTaskLog `json:"logs,omitempty"` - ErrorInstanceIds []*string `json:"errorInstanceIds,omitempty"` - SuccessInstanceIds []*string `json:"successInstanceIds,omitempty"` -} - type Query struct { } @@ -2227,61 +2226,6 @@ func (e Order) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } -type ProfileTaskLogOperationType string - -const ( - ProfileTaskLogOperationTypeNotified ProfileTaskLogOperationType = "NOTIFIED" - ProfileTaskLogOperationTypeExecutionFinished ProfileTaskLogOperationType = "EXECUTION_FINISHED" -) - -var AllProfileTaskLogOperationType = []ProfileTaskLogOperationType{ - ProfileTaskLogOperationTypeNotified, - ProfileTaskLogOperationTypeExecutionFinished, -} - -func (e ProfileTaskLogOperationType) IsValid() bool { - switch e { - case ProfileTaskLogOperationTypeNotified, ProfileTaskLogOperationTypeExecutionFinished: - return true - } - return false -} - -func (e ProfileTaskLogOperationType) String() string { - return string(e) -} - -func (e *ProfileTaskLogOperationType) UnmarshalGQL(v any) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = ProfileTaskLogOperationType(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid ProfileTaskLogOperationType", str) - } - return nil -} - -func (e ProfileTaskLogOperationType) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -func (e *ProfileTaskLogOperationType) UnmarshalJSON(b []byte) error { - s, err := strconv.Unquote(string(b)) - if err != nil { - return err - } - return e.UnmarshalGQL(s) -} - -func (e ProfileTaskLogOperationType) MarshalJSON() ([]byte, error) { - var buf bytes.Buffer - e.MarshalGQL(&buf) - return buf.Bytes(), nil -} - type PprofEventType string const ( @@ -2407,10 +2351,10 @@ func (e PprofTaskCreationType) MarshalJSON() ([]byte, error) { type PprofTaskLogOperationType string const ( - PprofTaskLogOperationTypeNotified PprofTaskLogOperationType = "NOTIFIED" - PprofTaskLogOperationTypeExecutionFinished PprofTaskLogOperationType = "EXECUTION_FINISHED" + PprofTaskLogOperationTypeNotified PprofTaskLogOperationType = "NOTIFIED" + PprofTaskLogOperationTypeExecutionFinished PprofTaskLogOperationType = "EXECUTION_FINISHED" PprofTaskLogOperationTypePprofUploadFileTooLargeError PprofTaskLogOperationType = "PPROF_UPLOAD_FILE_TOO_LARGE_ERROR" - PprofTaskLogOperationTypeExecutionTaskError PprofTaskLogOperationType = "EXECUTION_TASK_ERROR" + PprofTaskLogOperationTypeExecutionTaskError PprofTaskLogOperationType = "EXECUTION_TASK_ERROR" ) var AllPprofTaskLogOperationType = []PprofTaskLogOperationType{ @@ -2463,6 +2407,61 @@ func (e PprofTaskLogOperationType) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } +type ProfileTaskLogOperationType string + +const ( + ProfileTaskLogOperationTypeNotified ProfileTaskLogOperationType = "NOTIFIED" + ProfileTaskLogOperationTypeExecutionFinished ProfileTaskLogOperationType = "EXECUTION_FINISHED" +) + +var AllProfileTaskLogOperationType = []ProfileTaskLogOperationType{ + ProfileTaskLogOperationTypeNotified, + ProfileTaskLogOperationTypeExecutionFinished, +} + +func (e ProfileTaskLogOperationType) IsValid() bool { + switch e { + case ProfileTaskLogOperationTypeNotified, ProfileTaskLogOperationTypeExecutionFinished: + return true + } + return false +} + +func (e ProfileTaskLogOperationType) String() string { + return string(e) +} + +func (e *ProfileTaskLogOperationType) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ProfileTaskLogOperationType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ProfileTaskLogOperationType", str) + } + return nil +} + +func (e ProfileTaskLogOperationType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *ProfileTaskLogOperationType) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e ProfileTaskLogOperationType) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + type QueryOrder string const ( From 56c85324de652bd5b8c5db2dc8c3cba6f3f64291 Mon Sep 17 00:00:00 2001 From: JophieQu Date: Sat, 11 Oct 2025 17:56:29 +0800 Subject: [PATCH 4/5] fix --- go.mod | 7 +------ go.sum | 26 +------------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index 48e18d7..db4cea1 100644 --- a/go.mod +++ b/go.mod @@ -3,19 +3,14 @@ module skywalking.apache.org/repo/goapi go 1.24 require ( - github.com/99designs/gqlgen v0.17.73 - github.com/vektah/gqlparser/v2 v2.5.26 google.golang.org/grpc v1.73.0 google.golang.org/protobuf v1.36.6 ) require ( - github.com/agnivade/levenshtein v1.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/sosodev/duration v1.3.1 // indirect golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.33.0 // indirect golang.org/x/text v0.25.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect -) +) \ No newline at end of file diff --git a/go.sum b/go.sum index 2605549..c7eb629 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,3 @@ -github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg= -github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg= -github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= -github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= -github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= -github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -20,16 +8,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= -github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/vektah/gqlparser/v2 v2.5.26 h1:REqqFkO8+SOEgZHR/eHScjjVjGS8Nk3RMO/juiTobN4= -github.com/vektah/gqlparser/v2 v2.5.26/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= @@ -53,6 +31,4 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go. google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= \ No newline at end of file From 89efb8fc8e1b4310562fdae8f20cde151989cb2d Mon Sep 17 00:00:00 2001 From: JophieQu Date: Sat, 11 Oct 2025 17:58:32 +0800 Subject: [PATCH 5/5] fix --- go.mod | 2 +- go.sum | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index db4cea1..07455a3 100644 --- a/go.mod +++ b/go.mod @@ -13,4 +13,4 @@ require ( golang.org/x/text v0.25.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect -) \ No newline at end of file +) diff --git a/go.sum b/go.sum index c7eb629..4c7396c 100644 --- a/go.sum +++ b/go.sum @@ -31,4 +31,4 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go. google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= \ No newline at end of file +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=