Skip to content

Commit

Permalink
fix: compiler errors under pprof and mem-prof features (#2537)
Browse files Browse the repository at this point in the history
* fix: compiler errors under pprof feature

* fix: compiler errors under mem-prof feature
  • Loading branch information
evenyag authored Oct 8, 2023
1 parent 0679178 commit 17b385a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/servers/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion src/servers/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/servers/src/http/pprof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#[cfg(feature = "pprof")]
mod nix;
pub(crate) mod nix;

#[cfg(feature = "pprof")]
pub mod handler {
Expand Down
16 changes: 11 additions & 5 deletions src/servers/src/http/pprof/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down

0 comments on commit 17b385a

Please sign in to comment.