LCOV - code coverage report
Current view: top level - pageserver/src - span.rs (source / functions) Coverage Total Hit
Test: 53437f7e869ac68c86c7d3e4c20964c0156f158c.info Lines: 53.8 % 26 14
Test Date: 2024-09-20 16:14:12 Functions: 66.7 % 3 2

            Line data    Source code
       1              : use utils::tracing_span_assert::check_fields_present;
       2              : 
       3              : mod extractors {
       4              :     use utils::tracing_span_assert::ConstExtractor;
       5              : 
       6              :     pub(super) const TENANT_ID: ConstExtractor = ConstExtractor::new("tenant_id");
       7              :     pub(super) const SHARD_ID: ConstExtractor = ConstExtractor::new("shard_id");
       8              :     pub(super) const TIMELINE_ID: ConstExtractor = ConstExtractor::new("timeline_id");
       9              : }
      10              : 
      11              : #[track_caller]
      12         1224 : pub(crate) fn debug_assert_current_span_has_tenant_id() {
      13         1224 :     if cfg!(debug_assertions) {
      14         1224 :         if let Err(missing) = check_fields_present!([&extractors::TENANT_ID, &extractors::SHARD_ID])
      15              :         {
      16            0 :             panic!("missing extractors: {missing:?}")
      17         1224 :         }
      18            0 :     }
      19         1224 : }
      20              : 
      21              : #[track_caller]
      22         3612 : pub(crate) fn debug_assert_current_span_has_tenant_and_timeline_id() {
      23         3612 :     if cfg!(debug_assertions) {
      24         3612 :         if let Err(missing) = check_fields_present!([
      25         3612 :             &extractors::TENANT_ID,
      26         3612 :             &extractors::SHARD_ID,
      27         3612 :             &extractors::TIMELINE_ID,
      28         3612 :         ]) {
      29            0 :             panic!("missing extractors: {missing:?}")
      30         3612 :         }
      31            0 :     }
      32         3612 : }
      33              : 
      34              : #[track_caller]
      35            0 : pub(crate) fn debug_assert_current_span_has_tenant_and_timeline_id_no_shard_id() {
      36            0 :     if cfg!(debug_assertions) {
      37            0 :         if let Err(missing) =
      38            0 :             check_fields_present!([&extractors::TENANT_ID, &extractors::TIMELINE_ID,])
      39              :         {
      40            0 :             panic!("missing extractors: {missing:?}")
      41            0 :         }
      42            0 :     }
      43            0 : }
        

Generated by: LCOV version 2.1-beta