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

chore: remove metrics in fe #38240

Merged
merged 2 commits into from
Dec 19, 2024
Merged

chore: remove metrics in fe #38240

merged 2 commits into from
Dec 19, 2024

Conversation

dvj1988
Copy link
Contributor

@dvj1988 dvj1988 commented Dec 18, 2024

Description

  • Remove metrics from FE
  • Simplify the fn to get absolute url

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12396635756
Commit: 15b6d54
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Wed, 18 Dec 2024 16:41:22 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Streamlined telemetry implementation focusing solely on trace exporting.
    • Enhanced URL handling for trace monitoring.
  • Bug Fixes

    • Removed outdated metrics exporter and associated configurations, simplifying the setup.

@dvj1988 dvj1988 requested a review from rajatagrawal December 18, 2024 15:54
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

The pull request simplifies the telemetry setup in the auto-otel-web.ts file by removing all metrics-related functionality. This includes the elimination of the OTLPMetricExporter, MeterProvider, and associated configurations, focusing solely on trace exporting. Additionally, the URL construction for the trace exporter has been updated to use a new method, getAbsoluteUrl, enhancing clarity in URL handling.

Changes

File Change Summary
app/client/src/UITelemetry/auto-otel-web.ts - Removed OTLPMetricExporter, MeterProvider, and metrics-related configurations
- Replaced addPathToCurrentUrl with getAbsoluteUrl
- Updated trace exporter URL construction
- Removed metrics-related instrumentation

Possibly related PRs

Suggested labels

Task, ok-to-test

Suggested reviewers

  • nidhi-nair

Poem

Metrics fade, traces remain bright,
Telemetry dancing in code's pure light.
Simplicity wins the coding fight,
Clean paths, no clutter in sight,
Observability takes its flight! 🚀✨

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/UITelemetry/auto-otel-web.ts (1)

83-89: Consider adding input validation

The function implementation is clean and well-documented. However, consider adding validation for the path parameter to handle edge cases.

 function getAbsoluteUrl(path: string) {
+  if (!path.startsWith('/')) {
+    path = '/' + path;
+  }
   return new URL(path, window.location.origin).toString();
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 836b544 and 3676965.

📒 Files selected for processing (1)
  • app/client/src/UITelemetry/auto-otel-web.ts (3 hunks)
🔇 Additional comments (2)
app/client/src/UITelemetry/auto-otel-web.ts (2)

71-72: LGTM! Consistent URL handling

The ignoreResourceUrls configuration correctly uses the new getAbsoluteUrl method.


Line range hint 38-42: LGTM! Verify trace endpoint accessibility

The trace exporter configuration looks correct with proper compression and security headers.

✅ Verification successful

Let me check the actual usage context of this endpoint to ensure it's consistently configured across the codebase.


Trace endpoint configuration is properly implemented

The endpoint /monitoring/traces is correctly configured:

  • Used as the OTLP exporter URL with proper headers and compression
  • Properly excluded from PageLoadInstrumentation tracking
  • Correctly mapped in Caddy configuration to /v1/traces
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that the monitoring endpoint is consistently referenced
rg -l "/monitoring/traces"

Length of output: 122


Script:

#!/bin/bash
# Check the content of files referencing the monitoring endpoint
rg -C 5 "/monitoring/traces"

Length of output: 2389

@dvj1988 dvj1988 added the ok-to-test Required label for CI label Dec 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/UITelemetry/auto-otel-web.ts (1)

83-89: Consider adding input validation

While the URL construction is robust, consider adding validation for the path parameter to handle edge cases.

 function getAbsoluteUrl(path: string) {
+  if (!path) {
+    throw new Error("Path parameter is required");
+  }
+  if (!path.startsWith("/")) {
+    path = `/${path}`;
+  }
   return new URL(path, window.location.origin).toString();
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3676965 and 15b6d54.

📒 Files selected for processing (1)
  • app/client/src/UITelemetry/auto-otel-web.ts (3 hunks)
🔇 Additional comments (3)
app/client/src/UITelemetry/auto-otel-web.ts (3)

71-72: LGTM! URL filtering properly updated

The ignore list correctly uses the new URL construction method while maintaining all necessary filtering.


Line range hint 1-89: Verify complete removal of metrics configuration

The metrics removal appears complete, but let's verify no remnants remain.

✅ Verification successful

Let me search for any remaining metrics-related imports and configurations.


Let me check for any remaining metrics-related code using a broader search pattern.


Let me try one final check with the correct package.json path.


Let me check the specific metrics usage in the PageLoadInstrumentation file.


Metrics removal is complete and verified

The remaining references to "metric" in PageLoadInstrumentation.ts are only for web vitals types (LCPMetricWithAttribution, FCPMetricWithAttribution) and don't involve OpenTelemetry metrics collection. No metrics-related imports, configurations, or instrumentation code remains in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any remaining metrics-related code
rg -i "metric|meter" --type ts

Length of output: 66911


Script:

#!/bin/bash
# Check for metrics-related imports and configurations in the telemetry file
ast-grep --pattern 'import { $_ } from "@opentelemetry/metrics"' app/client/src/UITelemetry/auto-otel-web.ts

# Check for metrics-related configurations
ast-grep --pattern 'const $_ = new MeterProvider' app/client/src/UITelemetry/auto-otel-web.ts

Length of output: 206


Script:

#!/bin/bash
# Search for metrics-related code in the telemetry file
rg -i "meter|metric|measurement" app/client/src/UITelemetry/auto-otel-web.ts

# Check for any remaining metrics packages in package.json
rg '"@opentelemetry/metrics"' package.json

Length of output: 176


Script:

#!/bin/bash
# Check for any remaining metrics packages in app package.json
rg '"@opentelemetry/metrics"' app/client/package.json

# Look for any metrics configuration or setup code
rg -l "MeterProvider|MetricReader|Metric" app/client/src/UITelemetry/

Length of output: 181


Script:

#!/bin/bash
# Check the content of PageLoadInstrumentation.ts for metrics usage
cat app/client/src/UITelemetry/PageLoadInstrumentation.ts

Length of output: 10970


Line range hint 38-42: LGTM! Verify trace endpoint accessibility

The trace exporter configuration is correct with proper security headers and compression.

✅ Verification successful

Let me check the usage of getAbsoluteUrl to ensure it's properly implemented.


Let me try a different search approach to find the implementation of getAbsoluteUrl.


URL construction is properly implemented

The getAbsoluteUrl function is correctly implemented in the same file using the standard URL constructor with window.location.origin, ensuring proper URL resolution. The function is used consistently for the trace endpoint and is properly excluded from monitoring.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify no hardcoded URLs remain in the codebase
rg -g '*.{ts,js}' '/monitoring/traces' --no-filename

Length of output: 143


Script:

#!/bin/bash
# Find the implementation of getAbsoluteUrl
ast-grep --pattern 'function getAbsoluteUrl'

# Also check for any const/let declarations
ast-grep --pattern 'const getAbsoluteUrl ='
ast-grep --pattern 'let getAbsoluteUrl ='

# Backup search with ripgrep for any other definitions
rg 'getAbsoluteUrl.*=' -A 3

Length of output: 76711


Script:

#!/bin/bash
# Search for getAbsoluteUrl function or import
rg -g '*.{ts,js}' -B 2 -A 2 'getAbsoluteUrl'

# Also check if it's imported from another module
rg -g '*.{ts,js}' 'export.*getAbsoluteUrl'

Length of output: 1182

@dvj1988 dvj1988 merged commit 620a3ad into release Dec 19, 2024
48 of 49 checks passed
@dvj1988 dvj1988 deleted the chore/remove-metrics-in-fe branch December 19, 2024 04:07
NandanAnantharamu pushed a commit that referenced this pull request Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants