Skip to content

Commit 7fc276b

Browse files
patch: Remove get-logs-by-entity-name tool (#121)
* patch: Remove get-logs-by-entity-name tool * s/favour/favor Update CHANGELOG.md Co-authored-by: Manuel Warum <[email protected]> --------- Co-authored-by: Manuel Warum <[email protected]>
1 parent b9dd22e commit 7fc276b

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- Added cost considerations disclaimer in README about Dynatrace Grail data access.
66
- Added `dtClientContext` to `execute_dql` tool, to allow usage-monitoring for Grail access.
7+
- Removed `get_logs_for_entity` tool, in favor of `execute_dql`.
8+
- Added information about Semantic Dictionary for `execute_dql` tool description.
79

810
## 0.5.0 (Release Candidate 4)
911

src/capabilities/get-logs-for-entity.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/index.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { listVulnerabilities } from './capabilities/list-vulnerabilities';
2929
import { listProblems } from './capabilities/list-problems';
3030
import { getMonitoredEntityDetails } from './capabilities/get-monitored-entity-details';
3131
import { getOwnershipInformation } from './capabilities/get-ownership-information';
32-
import { getLogsForEntity } from './capabilities/get-logs-for-entity';
3332
import { getEventsForCluster } from './capabilities/get-events-for-cluster';
3433
import { createWorkflowForProblemNotification } from './capabilities/create-workflow-for-problem-notification';
3534
import { updateWorkflow } from './capabilities/update-workflow';
@@ -393,26 +392,6 @@ const main = async () => {
393392
},
394393
);
395394

396-
tool(
397-
'get_logs_for_entity',
398-
'Get Logs for a monitored entity based on name of the entity on Dynatrace',
399-
{
400-
entityName: z.string().optional(),
401-
},
402-
async ({ entityName }) => {
403-
const dtClient = await createDtHttpClient(
404-
dtEnvironment,
405-
scopesBase.concat('storage:logs:read'),
406-
oauthClientId,
407-
oauthClientSecret,
408-
dtPlatformToken,
409-
);
410-
const logs = await getLogsForEntity(dtClient, entityName);
411-
412-
return `Logs:\n${JSON.stringify(logs?.map((logLine) => (logLine ? logLine.content : 'Empty log')))}`;
413-
},
414-
);
415-
416395
tool(
417396
'verify_dql',
418397
'Verify a Dynatrace Query Language (DQL) statement on Dynatrace GRAIL before executing it. This step is recommended for DQL statements that have been dynamically created by non-expert tools. For statements coming from the `generate_dql_from_natural_language` tool as well as from documentation, this step can be omitted.',
@@ -450,11 +429,18 @@ const main = async () => {
450429

451430
tool(
452431
'execute_dql',
453-
'Get Logs, Metrics, Spans or Events from Dynatrace GRAIL by executing a Dynatrace Query Language (DQL) statement. It\'s recommended to use "verify_dql" tool before you execute a DQL statement. A valid statement looks like this: "fetch [logs, spans, events] | filter <some-filter> | summarize count(), by:{some-fields}. Adapt filters for certain attributes: `traceId` could be `trace_id` or `trace.id`.',
432+
'Get Logs, Metrics, Spans or Events from Dynatrace GRAIL by executing a Dynatrace Query Language (DQL) statement. ' +
433+
'You can also use "generate_dql_from_natural_language" to generate a DQL statement based on your request. ' +
434+
'Note: For more information about available fields for filters and aggregation, use the query "fetch dt.semantic_dictionary.models | filter data_object == \"logs\""',
454435
{
455-
dqlStatement: z.string(),
436+
dqlStatement: z
437+
.string()
438+
.describe(
439+
'DQL Statement (Ex: "fetch [logs, spans, events] | filter <some-filter> | summarize count(), by:{some-fields}.", "timeseries { avg(<metric-name>), value.A = avg(<metric-name>, scalar: true) }")',
440+
),
456441
},
457442
async ({ dqlStatement }) => {
443+
// Create a HTTP Client that has all storage:*:read scopes
458444
const dtClient = await createDtHttpClient(
459445
dtEnvironment,
460446
scopesBase.concat(

0 commit comments

Comments
 (0)