2019-08-14 11:03:02 -04:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-08-24 16:20:48 -04:00
|
|
|
use super::dispatch_flatbuffers::serialize_response;
|
|
|
|
use super::utils::*;
|
|
|
|
use crate::msg;
|
2019-08-14 11:03:02 -04:00
|
|
|
use crate::state::ThreadSafeState;
|
|
|
|
use deno::*;
|
2019-08-24 16:20:48 -04:00
|
|
|
use flatbuffers::FlatBufferBuilder;
|
2019-08-14 11:03:02 -04:00
|
|
|
|
|
|
|
pub fn op_metrics(
|
|
|
|
state: &ThreadSafeState,
|
2019-08-24 16:20:48 -04:00
|
|
|
base: &msg::Base<'_>,
|
|
|
|
data: Option<PinnedBuf>,
|
|
|
|
) -> CliOpResult {
|
|
|
|
assert!(data.is_none());
|
|
|
|
let cmd_id = base.cmd_id();
|
2019-08-14 11:03:02 -04:00
|
|
|
|
2019-08-24 16:20:48 -04:00
|
|
|
let builder = &mut FlatBufferBuilder::new();
|
|
|
|
let inner = msg::MetricsRes::create(
|
|
|
|
builder,
|
|
|
|
&msg::MetricsResArgs::from(&state.metrics),
|
|
|
|
);
|
|
|
|
ok_buf(serialize_response(
|
|
|
|
cmd_id,
|
|
|
|
builder,
|
|
|
|
msg::BaseArgs {
|
|
|
|
inner: Some(inner.as_union_value()),
|
|
|
|
inner_type: msg::Any::MetricsRes,
|
|
|
|
..Default::default()
|
|
|
|
},
|
|
|
|
))
|
2019-08-14 11:03:02 -04:00
|
|
|
}
|