Skip to content

Conversation

@tconkling
Copy link
Contributor

@tconkling tconkling commented Apr 24, 2023

AppNode currently depends on MetricsManager. If we release the upcoming "StreamlitLib" project as is, StreamlitLib users will have to supply their own MetricsManager implementation. With this PR, MetricsManager no longer needs to be part of StreamlitLib.

  • AppNode no longer knows about MetricsManager
  • Instead, App.handleDeltaMessage sends Deltas to MetricsManager
  • Removed several no-longer-necessary functions from the MetricsManager public API
  • Added a bunch of previously-unimplemented SegmentMetricsManager tests

@tconkling tconkling added the security-assessment-completed Security assessment has been completed for PR label Apr 24, 2023
@tconkling tconkling changed the title Remove MetricsManager dependency from AppNode Decouple MetricsManager from AppNode Apr 24, 2023
Comment on lines -514 to -516
// Update Metrics
this.metricsMgr.incrementDeltaCounter(getRootContainerName(deltaPath))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the removed logic from this function is now in SegmentMetricsManager.handleDeltaMessage

@tconkling tconkling marked this pull request as ready for review April 24, 2023 23:28
@tconkling tconkling requested a review from willhuang1997 April 24, 2023 23:29
PageInfo,
PageNotFound,
PagesChanged,
Delta,
Copy link
Contributor

Choose a reason for hiding this comment

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

supernit: Should this go to line 26 so it's alphabetical 😆

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at other files though, it doesn't seem like we retain that so I don't think it's necessary. Just something I noticed... 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - this is the sort of thing that we should enforce with linters if we care, because it's purely stylistic.

this.send(evName, evData)
}

public handleDeltaMessage(delta: Delta, metadata: ForwardMsgMetadata): void {
Copy link
Collaborator

@lukasmasuch lukasmasuch Apr 25, 2023

Choose a reason for hiding this comment

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

nit: I believe the delta stats & custom component event (which requires the delta counter) is actually unused and planned to be removed by the data team. So, maybe we can already remove it right now. Probably something to sync with @blackary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. I'm going to merge this as-is (because it unblocks the StreamlitLib project), and then work on a followup after chatting with @blackary.

Copy link
Contributor

@willhuang1997 willhuang1997 left a comment

Choose a reason for hiding this comment

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

LGTM

@tconkling tconkling merged commit 5591bc8 into streamlit:develop Apr 25, 2023
@tconkling tconkling deleted the tim/RemoveMetricsManagerFromAppNode branch April 25, 2023 17:14
tconkling added a commit to tconkling/streamlit that referenced this pull request Apr 25, 2023
* develop:
  Decouple MetricsManager from AppNode (streamlit#6557)
  Fix top padding on sidebar when embed is true (streamlit#6565)
  Add support for cell and column header tooltips in the dataframe component (streamlit#6561)
  Update dataframe column properties on frontend (streamlit#6554)
  Show warning for unsafe integer cells in `st.dataframe` (streamlit#6549)
  Add icon for editable columns in `st.data_editor` (streamlit#6550)
  Unify missing values to None in the returned datastructure by `st.data_editor`.  (streamlit#6544)
  Clean up and reorganize element tree module (streamlit#6522)
  ESLint: use `--cache` flag (30x speedup!) (streamlit#6555)
  Replace `st.connection` with `st.experimental_connection` in docstring examples (streamlit#6553)
  Improve editing on touch devices for `st.data_editor` (streamlit#6548)
  Move pandas styler logic to dedicated module (streamlit#6543)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants