MCPcopy Create free account
hub / github.com/AI45Lab/Code / emit_s3_call_event

Function emit_s3_call_event

core/src/workspace/s3.rs:1102–1118  ·  view source on GitHub ↗

Emit a structured `tracing` event for a single S3 API call. Hosts that want to meter S3 cost (call count, bytes transferred, latency) can subscribe to events from this module at `DEBUG` level and route on the `op` field. Fields emitted: | Field | Type | Meaning | |----------------|---------|--------------------------------------------

(
    op: &'static str,
    bucket: &str,
    target: &str,
    bytes: u64,
    ok: bool,
    elapsed: std::time::Duration,
)

Source from the content-addressed store, hash-verified

1100///
1101/// Emitted at `DEBUG`; zero-cost when the level is disabled.
1102fn emit_s3_call_event(
1103 op: &'static str,
1104 bucket: &str,
1105 target: &str,
1106 bytes: u64,
1107 ok: bool,
1108 elapsed: std::time::Duration,
1109) {
1110 tracing::debug!(
1111 op = op,
1112 bucket = %bucket,
1113 target = %target,
1114 bytes = bytes,
1115 outcome = if ok { "ok" } else { "error" },
1116 duration_ms = elapsed.as_millis() as u64,
1117 );
1118}
1119
1120/// Map a `PutObject` failure to either a [`WorkspaceVersionConflict`]
1121/// (HTTP 412 Precondition Failed from `If-Match`) or a generic write error.

Callers 5

get_object_textMethod · 0.85
write_textMethod · 0.85
list_dirMethod · 0.85
write_text_if_versionMethod · 0.85
list_recursive_underMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected