Skip to content
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

Rust SDK is missing metrics API #4

Closed
yskopets opened this issue Apr 20, 2020 · 1 comment · Fixed by #30
Closed

Rust SDK is missing metrics API #4

yskopets opened this issue Apr 20, 2020 · 1 comment · Fixed by #30

Comments

@yskopets
Copy link
Contributor

No description provided.

PiotrSikora added a commit to PiotrSikora/proxy-wasm-rust-sdk that referenced this issue Aug 14, 2020
Fixes proxy-wasm#4.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
PiotrSikora added a commit that referenced this issue Aug 15, 2020
Fixes #4.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@czh-123-rust
Copy link

czh-123-rust commented Aug 19, 2020

  • hello @PiotrSikora , when I use metric's interface to test prometheus function, I found that the return value of get_metric() is alway 0. And prometheus can not receive the metric counter data normally. The code is shown below.

lazy_static! {
static ref SCP_REQ_METRIC_ID: Mutex =
Mutex::new(define_metric(MetricType::Counter, "http_request").unwrap());
}
pub fn get_metric_id() -> u32 {
let scp_req_metric_id = SCP_REQ_METRIC_ID.lock().unwrap();
*scp_req_metric_id
}

impl HttpContext for Limiter {
fn on_http_request_headers(&mut self, _: usize) -> Action {
info!("=====on_http_request_headers=====");
increment_metric(get_metric_id(), 1).unwrap();
info!("---new metric_id={:?}", get_metric_id());
let get_return_value = get_metric(get_metric_id()).unwrap();
info!("---get_return_value={:?}", get_return_value);
......
......

  • Out put information:
    wasm log rate-limit.default rate_limit_handle: =====on_http_request_headers=====
    wasm log rate-limit.default rate_limit_handle: ---new metric_id=4
    wasm log rate-limit.default rate_limit_handle: ---get metric ok, return_value=0
    wasm log rate-limit.default rate_limit_handle: ---get_return_value=0

unleashed pushed a commit to unleashed/proxy-wasm-rust-sdk that referenced this issue Oct 29, 2020
…86_64-unknown-linux-gnu`, only export name `malloc` in the context of target `wasm32-unknown-unknown` (proxy-wasm#4)
leonm1 pushed a commit to leonm1/proxy-wasm-rust-sdk that referenced this issue Sep 6, 2023
leonm1 pushed a commit to leonm1/proxy-wasm-rust-sdk that referenced this issue Sep 6, 2023
* docs: add region tag comments

* docs: Add region tag comments to noop_logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants