Skip to content

Conversation

christian-kreuzberger-dtx
Copy link
Collaborator

@christian-kreuzberger-dtx christian-kreuzberger-dtx commented Aug 26, 2025

The goal is to alert the user when too many data are queried via execute_dql.

For now, we are logging and returning scanned bytes from the API, which the user can also find via DQL:

fetch dt.system.events
| filter event.kind == "QUERY_EXECUTION_EVENT" and contains(client.client_context, "dynatrace-mcp")
| fields timestamp, query_id, query_string, scanned_bytes, table, bucket, user.id, user.email, client.client_context
| sort timestamp desc
image

The result in the tool call:
image

@christian-kreuzberger-dtx christian-kreuzberger-dtx force-pushed the feature/added-dql-bytesscanned branch 6 times, most recently from c273fdb to 32dde77 Compare August 27, 2025 12:47
@christian-kreuzberger-dtx christian-kreuzberger-dtx marked this pull request as ready for review August 27, 2025 12:50
Copy link
Collaborator

@MrManny MrManny left a comment

Choose a reason for hiding this comment

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

Left some minor notes, but nothing dramatic.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the execute_dql tool to provide detailed metadata about query execution, particularly focusing on cost tracking through scanned bytes information. The changes aim to help users understand and monitor their Dynatrace consumption when executing DQL queries.

Key Changes:

  • Enhanced DQL execution response to include metadata like scanned bytes, records, execution time, and sampling information
  • Added user-friendly formatting with cost warnings based on data usage thresholds
  • Updated all DQL-consuming functions to work with the new response structure that includes both records and metadata

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/capabilities/execute-dql.ts Core enhancement adding metadata extraction, logging, and new return type structure
src/index.ts Updated execute_dql tool to format metadata nicely and handle new response structure; fixed list-problems tool
src/capabilities/list-vulnerabilities.ts Updated to access records from new response structure
src/capabilities/get-monitored-entity-details.ts Updated to access records from new response structure
src/capabilities/find-monitored-entity-by-name.ts Updated to access records from new response structure
integration-tests/execute-dql.integration.test.ts Updated tests to validate new response structure and metadata fields
README.md Enhanced cost documentation with query for tracking usage
CHANGELOG.md Added entry for the new metadata feature

@christian-kreuzberger-dtx christian-kreuzberger-dtx force-pushed the feature/added-dql-bytesscanned branch from 5df723d to 6829623 Compare August 29, 2025 06:16
@christian-kreuzberger-dtx christian-kreuzberger-dtx enabled auto-merge (squash) August 29, 2025 06:16
@christian-kreuzberger-dtx christian-kreuzberger-dtx merged commit a4fc7be into main Aug 29, 2025
4 checks passed
@christian-kreuzberger-dtx christian-kreuzberger-dtx deleted the feature/added-dql-bytesscanned branch August 29, 2025 06:17
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.

2 participants