Skip to content

Conversation

@mayagbarnes
Copy link
Collaborator

@mayagbarnes mayagbarnes commented Oct 7, 2024

Describe your changes

Metrics Migration Part 1: This PR extends the host_config endpoint to add a metricsUrl, which will serve as the destination URL for metrics data.

metricsUrl for host_config endpoint will handle 4 options:

  • "off": Turns off metrics collection
  • "<url>": Sends metrics events to the passed URL
    • The logic to build/send event with necessary fields will be added in a separate PR
  • "postMessage": Sends metrics events via postMessage API
    • This logic will be added in a separate PR
  • " ": Default (OS) - telemetry destination url will be fetched

Should no url be received from the BE, the FE will attempt to fetch the telemetry url from data.streamlit.io/metrics.json, caching it in localStorage if successful. If there is no metricsUrl, no telemetry is sent.

Note: Currently using a test Fivetran Webhook

Testing Plan

  • Python Unit Tests: Updated ✅
  • JS Unit Tests: ✅
  • Manual Testing: ✅

@mayagbarnes mayagbarnes changed the title [WIP] Extend host_config endpoint with metricsUrl configuration Extend host_config endpoint with metricsUrl configuration Oct 8, 2024
@mayagbarnes mayagbarnes added security-assessment-completed Security assessment has been completed for PR impact:internal PR changes only affect internal code change:refactor PR contains code refactoring without behavior change labels Oct 8, 2024
@mayagbarnes mayagbarnes marked this pull request as ready for review October 8, 2024 18:19
@mayagbarnes mayagbarnes requested a review from a team as a code owner October 17, 2024 23:30
Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines +96 to +97
this.requestDefaultMetricsConfig()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: We could set actuallySendMetrics to False here in case that this.metricsUrl is undefined after the requestDefaultMetricsConfig to ensure that metrics gathering gets deactivated. But it depends a bit on the full implementation if this is actually required.

@mayagbarnes mayagbarnes merged commit 04d9f8c into metrics-migration Oct 21, 2024
@mayagbarnes mayagbarnes deleted the metrics/host-config branch October 21, 2024 18:15
mayagbarnes added a commit that referenced this pull request Oct 24, 2024
**Metrics Migration Part 1**: This PR extends the `host_config` endpoint
to add a `metricsUrl`, which will serve as the destination URL for
metrics data.

`metricsUrl` for `host_config` endpoint will handle 4 options:
* **`"off"`**: Turns off metrics collection
* **`"<url>"`**: Sends metrics events to the passed URL
* _The logic to build/send event with necessary fields will be added in
a separate PR_
* **`"postMessage"`**: Sends metrics events via `postMessage` API
    *  _This logic will be added in a separate PR_
* **`" "`**: Default (OS) -  telemetry destination url will be fetched

Should no url be received from the BE, the FE will attempt to fetch the
telemetry url from `data.streamlit.io/metrics.json`, caching it in
localStorage if successful. If there is no `metricsUrl`, no telemetry is
sent.
mayagbarnes added a commit that referenced this pull request Oct 24, 2024
**Metrics Migration Part 3:** As a follow up to the metrics options in hostConfig endpoint (PR #9611), this PR adds the ability to send metrics events to the host via postMessage API using our existing Host <-> Guest communication.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change impact:internal PR changes only affect internal code 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