IC Canister Serve
This package provides helpful methods for serving logs and metrics via the http_request endpoint of smart contracts running in the Internet Computer (also known as canisters).
Usage
This crate builds on top of ic-canister-log and
ic-metrics-encoder to make serving metrics and logs easy from
a canister's http_request method.
use ;
use ;
use ;
use MetricsEncoder;
// Keep up to 100 last messages.
declare_log_buffer!;
declare_log_buffer!;
Example Request
To request the metrics, execute the following curl request:
$ curl https://example-canister.raw.ic0.app/metrics
To request all the logs, execute the following curl request:
$ curl https://example-canister.raw.ic0.app/logs
To request just the INFO logs, execute the following curl request:
$ curl https://example-canister.raw.ic0.app/logs?severity=Info
To request just the ERROR logs, execute the following curl request:
$ curl https://example-canister.raw.ic0.app/logs?severity=Error
To request logs before a certain timestamp, execute the following curl request:
$ curl https://example-canister.raw.ic0.app/logs?time=1683837947035