-
Notifications
You must be signed in to change notification settings - Fork 69
Support pprof profiling #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,176 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| # Request to create a pprof task | ||
| input PprofTaskCreationRequest { | ||
| # Define the service to execute the task | ||
| serviceId: ID! | ||
| # Define which instances need to execute tasks | ||
| serviceInstanceIds: [String!]! | ||
| # Define the duration of this task in minutes (required for CPU, BLOCK, MUTEX events) | ||
| duration: Int | ||
| # Define which event types this task needs to collect. | ||
| events: PprofEventType! | ||
| # Define the period of the pprof dump (required for BLOCK, MUTEX events) | ||
| # For BLOCK event, it represents an average of one blocking event per rate nanoseconds spent blocked. The default value is 0, which means sampling is turned off. When the value is 1, all block events will be sampled. | ||
| # For MUTEX event, it represents sampling an average of one mutex contention event per rate occurrences. The default value is 0, which means sampling is turned off. When the value is 1, all mutex events will be sampled. | ||
| dumpPeriod: Int | ||
| } | ||
|
|
||
| # PprofTaskCreationResult is the result of the task creation request | ||
| type PprofTaskCreationResult { | ||
| # Code defines the status of the response, i.e. success or failure. | ||
| code: PprofTaskCreationType! | ||
| # ErrorReason gives detailed reason for the exception, if the code returned represents a kind of failure. | ||
| errorReason: String | ||
| # Task id, if code is SUCCESS. | ||
| id: String | ||
| } | ||
|
|
||
| # Pprof task creation type | ||
| enum PprofTaskCreationType { | ||
| # Task created successfully | ||
| SUCCESS | ||
| # Task creation failed due to argument errors | ||
| ARGUMENT_ERROR | ||
| # The current service already has a pprof task executing | ||
| ALREADY_PROFILING_ERROR | ||
| } | ||
|
|
||
| # Request to query pprof task list | ||
| input PprofTaskListRequest { | ||
| # ServiceId associated with the task | ||
| serviceId: ID! | ||
| # Time Range | ||
| queryDuration: Duration | ||
| # Limit defines the number of the tasks to be returned. | ||
| limit: Int | ||
| } | ||
|
|
||
| # Request to query flame graph analyzation | ||
| input PprofAnalyzationRequest { | ||
| # Define which task to analyze | ||
| taskId: ID! | ||
JophieQu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # InstanceIds defines the instances to be included for analysis | ||
| instanceIds: [String!]! | ||
| } | ||
|
|
||
| # Define pprof task list result | ||
| type PprofTaskListResult { | ||
| # ErrorReason gives detailed reason for the exception, if the task list returned represents failure. | ||
| errorReason: String | ||
|
|
||
| # Tasks is a list of pprof tasks belonging to the specific service | ||
| tasks: [PprofTask!] | ||
| } | ||
|
|
||
| # Define pprof task data | ||
| # The fields definition is the same as PprofTaskCreationRequest | ||
| type PprofTask { | ||
| id: String! | ||
| serviceId: String! | ||
| serviceInstanceIds: [String!]! | ||
| createTime: Long! | ||
| events: PprofEventType! | ||
| duration: Int | ||
| dumpPeriod: Int | ||
| } | ||
|
|
||
| # Define the flame graph results produced by pprof | ||
| type PprofStackTree { | ||
| elements: [PprofStackElement!] | ||
| } | ||
|
|
||
| # Define the thread stack analyze tree element | ||
| type PprofStackElement { | ||
| # Id is the identity of the stack element | ||
| id: ID! | ||
| # ParentId is the identity of the parent stack element. Stack elements are organized as a tree. | ||
| parentId: ID! | ||
| # Method signatures in tree nodes | ||
| codeSignature: String! | ||
| # The total number of samples of the current tree node, including child nodes | ||
| total: Long! | ||
| # The sampling number of the current tree node, excluding samples of the children | ||
| self: Long! | ||
| } | ||
|
|
||
| # Define the analysis results of the task | ||
| type PprofAnalyzation { | ||
| # Displaying the tree structure data required for the flame graph | ||
| tree: PprofStackTree | ||
| } | ||
|
|
||
| # Defines task progress, including task logs, success and failure instances | ||
| type PprofTaskProgress { | ||
| # All task execution logs of the current task | ||
| logs: [PprofTaskLog!] | ||
| # ErrorInstanceIds gives instances that failed to execute the task | ||
| errorInstanceIds: [ID] | ||
| # SuccessInstanceIds gives instances that have executed the task successfully | ||
| successInstanceIds: [ID] | ||
| } | ||
|
|
||
| # Define the log of a task executed by an instance | ||
| type PprofTaskLog { | ||
| # The task id | ||
| id: String! | ||
| # InstanceId is the id of the instance which reported this task log | ||
| instanceId: ID! | ||
| instanceName: String! | ||
|
|
||
| operationType: PprofTaskLogOperationType! | ||
| operationTime: Long! | ||
| } | ||
|
|
||
| # Define the execution progress of the task | ||
| enum PprofTaskLogOperationType { | ||
| # NOTIFIED means the task has been issued to the Agent | ||
| NOTIFIED, | ||
| # EXECUTION_FINISHED means the Agent has finished the execution | ||
| EXECUTION_FINISHED | ||
| # PPROF_UPLOAD_FILE_TOO_LARGE_ERROR means the Agent has finished the task but the target file is too large to be received by the OAP server | ||
| PPROF_UPLOAD_FILE_TOO_LARGE_ERROR | ||
| # EXECUTION_TASK_ERROR means potential execution error caused by the Agent | ||
| EXECUTION_TASK_ERROR | ||
| } | ||
|
|
||
| # Defines which event types pprof needs to collect | ||
| enum PprofEventType { | ||
| CPU | ||
| HEAP | ||
| BLOCK | ||
| MUTEX | ||
| GOROUTINE | ||
| THREADCREATE | ||
| ALLOCS | ||
| } | ||
|
|
||
| extend type Mutation { | ||
| # Create a new pprof task | ||
| createPprofTask(pprofTaskCreationRequest: PprofTaskCreationRequest!): PprofTaskCreationResult! | ||
| } | ||
|
|
||
| extend type Query { | ||
| # Query all task lists and sort them in descending order by create time | ||
| queryPprofTaskList(request: PprofTaskListRequest!): PprofTaskListResult! | ||
| # Query task progress, including task logs | ||
| queryPprofTaskProgress(taskId: String!): PprofTaskProgress! | ||
| # Query the flame graph produced by pprof | ||
| queryPprofAnalyze(request: PprofAnalyzationRequest!): PprofAnalyzation! | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.