Skip to content

Conversation

@sparrowt
Copy link
Contributor

@sparrowt sparrowt commented Jan 2, 2024

Disclaimer: I'm not necessarily suggesting that this be merged as-is, but I didn't want my changes to be wasted if they might be useful to others.
So this is something I got working for my use case which is analysing long-term memory usage (e.g. over several hours) of a set of containers.

If there are parts of this which you think are useful then I'm happy to split them out / clean them up, or for you to pick and choose.

For comparison, there is some memory graphing in the Docker Desktop UI now, but it is only either per-container, or a total for all containers (rather than all containers on 1 graph) and also in my experience it is not always persistent or reliable (has gaps).

So anyway - if this just sits open as something potentially useful that's fine, or if you're interested in merging some/all then that's great too!

@codecov-commenter
Copy link

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (e45ee4d) 100.00% compared to head (daa1adc) 94.73%.
Report is 3 commits behind head on master.

Files Patch % Lines
src/dockerstats.py 66.66% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            master       #3      +/-   ##
===========================================
- Coverage   100.00%   94.73%   -5.27%     
===========================================
  Files            3        3              
  Lines          134      152      +18     
===========================================
+ Hits           134      144      +10     
- Misses           0        8       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@sylhare sylhare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution 👍

# Using linux date
# For mac - brew install coreutils ; echo "alias date=gdate" >> ~/.bash_profile
runtime="30 minutes"
runtime="24 hours"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to work on it, I would put some of the value like the runtime or sleep time as variables 🤔
But I don't mind as is.

self.data_path = data_path
self.load_data()

def load_data(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it's separated to be able to load the data asynchronously?

# Leave more space for the legend
plt.subplots_adjust(right=0.7)

def plot_category(self, category, size=(10, 5)):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you have an example of how you used the new methods ? (For the Readme)

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 this pull request may close these issues.

3 participants