fix: compiler errors under pprof and mem-prof features (#2537)

* fix: compiler errors under pprof feature

* fix: compiler errors under mem-prof feature
This commit is contained in:
Yingwen
2023-10-08 16:28:45 +08:00
committed by GitHub
parent 067917845f
commit 17b385a985
4 changed files with 17 additions and 10 deletions

View File

@@ -278,8 +278,7 @@ pub enum Error {
#[snafu(display("Failed to dump profile data"))]
DumpProfileData {
location: Location,
#[snafu(source)]
error: common_mem_prof::error::Error,
source: common_mem_prof::error::Error,
},
#[snafu(display("Invalid prepare statement: {}", err_msg))]
@@ -335,7 +334,9 @@ pub enum Error {
#[cfg(feature = "pprof")]
#[snafu(display("Failed to dump pprof data"))]
DumpPprof { source: common_pprof::Error },
DumpPprof {
source: crate::http::pprof::nix::Error,
},
#[snafu(display(""))]
Metrics { source: BoxedError },

View File

@@ -19,7 +19,7 @@ pub mod influxdb;
pub mod mem_prof;
pub mod opentsdb;
pub mod otlp;
mod pprof;
pub mod pprof;
pub mod prom_store;
pub mod prometheus;
pub mod script;

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#[cfg(feature = "pprof")]
mod nix;
pub(crate) mod nix;
#[cfg(feature = "pprof")]
pub mod handler {

View File

@@ -17,32 +17,38 @@ use std::time::Duration;
use common_error::ext::ErrorExt;
use common_error::status_code::StatusCode;
use common_macro::stack_trace_debug;
use prost::Message;
use snafu::{Location, ResultExt, Snafu};
#[derive(Debug, Snafu)]
#[derive(Snafu)]
#[stack_trace_debug]
pub enum Error {
#[snafu(display("Failed to create profiler guard"))]
CreateGuard {
source: pprof::Error,
#[snafu(source)]
error: pprof::Error,
location: Location,
},
#[snafu(display("Failed to create report"))]
CreateReport {
source: pprof::Error,
#[snafu(source)]
error: pprof::Error,
location: Location,
},
#[snafu(display("Failed to create flamegraph"))]
CreateFlamegraph {
source: pprof::Error,
#[snafu(source)]
error: pprof::Error,
location: Location,
},
#[snafu(display("Failed to create pprof report"))]
ReportPprof {
source: pprof::Error,
#[snafu(source)]
error: pprof::Error,
location: Location,
},
}