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

feat: Add per net device metrics #4145

Merged
merged 13 commits into from
Oct 18, 2023
Merged

feat: Add per net device metrics #4145

merged 13 commits into from
Oct 18, 2023

Commits on Oct 17, 2023

  1. feat(metrics)(net): refactor and add per net device metrics

    Emit aggregate and per device metrics for network devices:
     - Move NetDeviceMetrics from logger to Net module.
     - Use NET_DEV_METRICS_PVT instead of adding an entry of
       NetDeviceMetrics in Net so that metrics can be flushed
       even from signal handlers.
    
    Note: this is part 1 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    4aabb7a View commit details
    Browse the repository at this point in the history
  2. feat(metrics)(net): per device net metrics for report_net_event_fail

    Use individual instance of metrics instead of the METRICS.net.
    Since we do not use METRIC.net, modify report_net_event_fail to
    use self.metrics.
    
    Note: this is part 2 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    b370ce3 View commit details
    Browse the repository at this point in the history
  3. feat(metrics)(net): Add per device net metrics in CHANGELOG

    Update CHANGELOGS to notify that Firecracker now emits
    per net device metrics.
    
    Note: this is part 3 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    1e45431 View commit details
    Browse the repository at this point in the history
  4. feat(metrics)(net): Add unit test for net metrics

    Create a unit test that allocates 19 NetDeviceMetrics
    (19 because it is the max number of irqs we have for
    net devices), update and verify a metric.
    
    Note: this is part 4 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    13839e5 View commit details
    Browse the repository at this point in the history
  5. feat(metrics)(net): Use a lock to access net metrics

    Use RwLock to make accessing Metrics threadsafe.
    Use better name to allocate NetDeviceMetrics
    
    Note: this is part 5 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    24ecef2 View commit details
    Browse the repository at this point in the history
  6. feat(metrics)(net): Use iface_id to emit per net device metrics

    With Vec based approach, "net0" is metrics for the 1st net device
    created. However, if devices are not created in the same order all
    the time, the first device created could either be eth0 or eth1 and
    then net0 could sometimes point to eth0 and sometimes to eth1 which
    doesn't help with analysing the metrics.
    So, use Map instead of Vec to provide more clarity on which interface
    the metrics actually belongs to.
    Also, instead of net0 name the metrics json object as net_$iface_id
    e.g. net_eth0 or net_eth1 which should help in better analysis.
    Use "net_$iface_id" for the metrics name instead of "net_$tap_name" to
    be consistent with the net endpoint "/network-interfaces/{iface_id}"
    
    Note: this is part 6 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    cce04ed View commit details
    Browse the repository at this point in the history
  7. chore(metrics)(net): better CHANGELOG & lowercase for net_metrics macro

    Use proper convention of lower case for macros.
    Make CHANHELOG less verbose.
    
    Note: this is part 7 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    6a0fb22 View commit details
    Browse the repository at this point in the history
  8. chore(metrics)(net): better name for NetMetricsSerializer

    NetMetricsSerializer naming was confusing because its not a
    Serializer in serde's sense (it implements Serialize, not Serializer).
    So give it to a better name.
    
    Note: this is part 8 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    ddc4430 View commit details
    Browse the repository at this point in the history
  9. chore(metrics)(net): remove new() for NetDeviceMetrics and proxy

    NetDeviceMetrics was moved from logger which needed the new()
    because default didn't provide the const implementation that
    FirecrackerMetrics::new() needed. But since that is not a requirement
    anymore we rely on default to provide 0 initialized NetDeviceMetrics.
    
    NetMetricsSerializeProxy doesn't have any fields and so there is no
    need to define new() for it.
    
    Note: this is part 9 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    9b48636 View commit details
    Browse the repository at this point in the history
  10. chore(metrics)(net): implement review feedback for flush_metrics

    Better implementation for flush_metrics as suggested in feedback.
    
    Note: this is part 10 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    6d47036 View commit details
    Browse the repository at this point in the history
  11. feat(metrics)(net): add ci test to validate net metrics

    Make sure there is no breaking change for NetDeviceMetrics.
    Add random number of net devices and validate that values of
    "net" are aggregate of all "net_{iface_id}".
    
    Note: this is part 11 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    c3e365b View commit details
    Browse the repository at this point in the history
  12. feat(metrics)(net): Use Arc to allow storing metris in Net

    Use Arc for NetDeviceMetrics since this allows us to store
    NetDeviceMetrics directly inside Net and get rid of the
    net_metrics! macro.
    Also, use better name for net metrics.
    
    Note: this is part 12 of 12 commits to add per net device metrics.
    
    Signed-off-by: Sudan Landge <sudanl@amazon.com>
    Sudan Landge committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    8d4b2f3 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Configuration menu
    Copy the full SHA
    42d52c0 View commit details
    Browse the repository at this point in the history