[go: up one dir, main page]

Skip to content

Add observability url helpers functions

What does this MR do and why?

This adds helper functions to handle the URLs and paths used in the Vue component used to render the iframe that contains the react app. It is broken out from Log a user into the O11y service react app (!197536 - merged) to help with review complexity.

Duo generated summary

This code adds two new utility functions to help build and parse URLs for embedded content (iframes) in an observability/monitoring system.

The first function, buildIframeUrl, takes a path and a base URL and combines them into a complete web address. For example, it can combine "/dashboards" with "https://example.com" to create "https://example.com/dashboards". If something goes wrong during this process, it safely returns the original base URL instead of crashing.

The second function, extractTargetPath, does the opposite - it takes a URL and extracts just the path portion from it. So from "https://example.com/dashboards?tab=metrics", it would extract just "/dashboards", ignoring any extra parameters or fragments.

Both functions include error handling to prevent the application from breaking if invalid URLs are provided. The code also includes comprehensive tests that verify the functions work correctly in various scenarios, including edge cases like empty paths, URLs with ports, query parameters, and invalid inputs. The tests ensure the functions can handle real-world situations gracefully and work together as part of a complete URL processing workflow.

References

Update login process to use observability_group_o11y_setting table

Screenshots or screen recordings

No UI changes. See final functionality screen recording

How to set up and validate locally

See final functionality testing

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dakota Dux

Merge request reports

Loading