金融与交易
查询和分析 Dynatrace DPS…
用 DQL 查询 dt.system.events 中 Dynatrace DPS 租户的实际消费事件,支持用量概览、成本驱动排序、计费量扣减、分摊/回退、成本调查与指标摄入优化归因。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
查询和分析 Dynatrace DPS 特定
解决思路
- 先做范围检查:本技能只查询/分析租户实际消费数据;若用户问计费/定价概念,不解释,仅按 Billing Concepts — STOP 重定向文档。
- 仅在用户要查询/分析自己租户数字时继续;查询使用 DQL,数据源 `dt.system.events`,过滤 `event.kind == "BILLING_USAGE_EVENT"`,按 `event.type` 区分消费类别。
- 平台 DPS 计费使用本技能;AWS 云基础设施成本经 FOCUS 摄入时改用 `dt-biz-cloud-costs`。
- 本技能仅适用于 DPS 许可环境;不要对 classic license models(host units、DDUs、DEM units、ASUs)应用单位换算或成本估算;遇到 classic 术语,说明只覆盖 DPS 并指向 `https://docs.dynatrace.com/docs/license/monitoring-consumption-classic`。
- 许可/权益问题:触发词如 'Am I allowed to use X?'、'Is X licensed?'、'Is X in my subscription?'、'Do I have entitlement for X?' 时,不执行任何 DQL 查询;billing usage events 只记录 active consumption,不记录 subscription entitlements;缺失 billing events 只表示当前未消费,不等于未授权;不要从用量模式或缺失推断权益。直接回答权益数据不能通过 DQL 获取,并指向 Account Management > Subscription > Pricing。
- 计费概念问题:触发词如 'How does billing work?'、'How are costs calculated?'、'Explain DPS billing'、'How is X billed?'、'What is the billing model?'、'How does DPS pricing work?'、'How does Dynatrace charge?'、'Explain the rate card' 时,不从技能内容回答;normalization weights、unit conversion formulas 和 lookup values 是 DQL-generation tools,不是面向用户的计费教育,也不是 contracted rates。整个响应只包含指定的两句文档重定向和单个示例提示;不要列 capabilities 或 units,不要描述 metering、included volume 或 normalization,不要添加 'How costs are calculated' 部分,不要追加 Getting Started menu 或额外示例提示。
- 对通用/开放式问题如 'how can you help'、'what can you do'、'where do I start'、'help me understand my costs'、'what can I analyze'、'show me what's possible'、'what is this skill'、'help'、'capabilities'、'getting started'、'tell me what you can do'、'what are your capabilities':展示 Getting Started menu,包含 5 个 use cases,每个建议一个 prompt;不要运行任何查询,等待用户选择方向。
- 对 'usage overview'、'usage per capability'、'what am I using'、'how much usage':执行 Cross-Capability Usage(4 Queries),做单位换算,不做成本估算;参考 `billing-capabilities.md -> Cross-Capability Usage (4 Queries)`。
- 对 'cost drivers'、'what costs most'、'top spenders'、'where is spend going':运行 Combined Query + Full Inline Lookup,在 DQL 中按 `cost_weight desc` 排序;参考 `cost-estimations.md -> Estimated Cost by Capability`。
- 对 'save money'、'reduce costs'、'billed costs'、'actual bill':先用 included volume deduction 查询用量,再做成本估算;参考 `billing-capabilities.md -> Cross-Capability Usage (4 Queries)`,然后 `cost-estimations.md`。
- 对 'cost by team'、'chargeback'、'showback':做 cost center attribution;参考 `cost-allocation.md`。
- 对 'metrics ingest by cost center'、'metrics chargeback'、'billable data points per team':计算每个 cost center 的 Metrics Ingest billable volume,并扣除 included volume;参考 `cost-allocation.md -> Metrics Ingest — Billable Volume per Cost Center`。
- 对 'how much log ingest'、'trace volume'(单类别):执行单类别用量查询;参考 `billing-event-types.md`、`billing-capabilities.md`。
- 对 'cost trend'、'spending spike'、'budget forecast':做 Daily Cost Trend;参考 `cost-estimations.md -> Daily Cost Trend`。
- 对 'compare this week to last'、'week over week'、'WoW'、'MoM'、'month over month'、'how did costs change'、'cost change vs last week'、'cost change vs last month'、'period comparison'、'what grew'、'what shrank'、'usage trend'、'notable changes in usage':使用两个显式 UTC 窗口,按 capability 比较 `capability_usage`,按最大绝对 cost-weight delta 排序;参考 `cost-estimations.md -> Period Comparison (WoW / MoM)`。
- 对 'detector costs'、'anomaly detector query cost'、'ALERTING pool costs':交叉引用 detector -> query cost;参考 `query-cost-attribution.md`。
- 对 'workflow cost'、'what does this workflow cost'、'workflow spending':计算 composite workflow cost(4 signals);参考 `workflow-total-cost.md`。
- 对 'which workflow'、'workflow name'、'workflow owner'、'how often does this workflow run'、'workflow frequency':解析 workflow name/owner 和 run frequency;参考 `workflow-total-cost.md -> Cross-Event Field Reference + Owner Identification + How Often Did the Workflow Run`。
- 对 'what's driving costs'、'cost investigation'、'cost spike':执行 step-by-step cost investigation;参考 `query-cost-attribution.md`、`workflow-total-cost.md`、`entity-cost-drilldown.md`。
- 对 'which app'、'which host'、'which monitor'、'drill down'、'break down by application/host/cluster':做 entity-based drill-down,先执行 sample-first 步骤;参考 `entity-cost-drilldown.md`。
- 对 'what's driving RUM/Full-Stack/Synthetic/K8s cost':对指定 capability 做 entity drill-down;参考 `entity-cost-drilldown.md`。
- 对 'optimize metrics ingest'、'reduce data points'、'high cardinality metrics'、'which metrics cost most'、'metrics cost optimization':运行分析 Steps 1–3,展示数据并解释优化杠杆,然后等待用户选择要优化什么;绝不推荐具体要删除/减少的 metrics;参考 `metrics-ingest-optimization.md`。
- 对 'drop metric'、'remove metric from ingestion'、'stop ingesting metric':使用 OpenPipeline 或 OTel Collector 的 Drop Metric 策略;参考 `metrics-ingest-optimization.md -> Strategy 1 — Drop Metric`。
- 对 'reduce cardinality'、'remove dimension'、'drop dimension from metric':使用 OpenPipeline 或 OTel Collector 的 Reduce Cardinality 策略;参考 `metrics-ingest-optimization.md -> Strategy 2 — Reduce Cardinality`。
- 对 'change ingest interval'、'reduce collection frequency'、'scrape interval':在源头更改 ingest interval;参考 `metrics-ingest-optimization.md -> Strategy 3 — Change Ingest Interval`。
- 对 'AI costs'、'cost of AI agents'、'what does AI cost'、'AI spending'、'AI agent costs'、'direct and indirect AI cost'、'how much is AI costing'、'AI Units cost':计算 direct AI costs(AI Units / AI Function Standard Call BUEs)+ indirect AI costs(Query BUEs with `ai_generated == true`);参考 `billing-event-types.md -> Agentic AppEngine`、`query-cost-attribution.md -> Step 2a`。
- 对 'query cost by source'、'who is scanning most'、'cost attribution by app':按 source 统计 BUE query cost;参考 `query-cost-attribution.md -> Step 1`。
- 对 'expensive dashboards'、'dashboard cost ranking'、'top dashboards by cost':做 Dashboard query cost ranking;参考 `query-cost-attribution.md -> Step 1b + Step 2`。
- 对 'included volume'、'billed vs total'、'baseline usage':做 included volume analysis;参考 `billing-capabilities.md -> Included Volume`。
- 对 'hourly billing'、'daily billing after deductions'、'time-granular billed usage':做 time-bucketed usage,并减去 included volume;参考 `billing-capabilities.md -> Query 3 (Metrics Ingest — Billable Volume) / Query 4 (Traces Ingest — Billable Volume)`。
- Usage 含义:只做单位换算,不做成本估算;用 Cost Normalization Weights 中的单位标注,或对 preview types 用 `billing-event-types.md` 中的单位标注。
- Cost 含义:做单位换算 + 在 DQL 中通过 Full Inline Lookup 计算 `cost_weight`,仅用于内部排序/聚合;绝不把 `cost_weight` 显示为美元金额;规范化表中没有的类型从排名中省略。
- Cost drivers 含义:按 DQL 中 Full Inline Lookup 计算出的 `cost_weight` 排序;输出列只保留 rank、capability name、usage in native units;展示前删除 `cost_weight`,它不出现在任何列、标签或句子中。
- Cost share / percentage 含义:用归一化权重(usage × Normalization Weight per capability)计算 share-of-total;输出百分比表;使用 Cost Ranking Rules step 3 的标准免责声明,不添加任何额外 caveat 或 note。
- User-provided rate 含义:若用户提供 contracted rate(如 `$0.15/GiB for Log Ingest`),仅对该 capability 使用该费率并显示实际 USD;其他 capabilities 只显示 usage-only(无成本);免责声明为 `⚠️ Calculated using your provided rate of $X/unit. For all capabilities without a provided rate, only usage is shown. For authoritative totals, refer to Account Management > Subscription.`;绝不推断或假设费率,只有用户明确给出时才接受。
- 仅在用户明确要求时才添加成本信息;跨类别单位不可比,成本归一化是唯一可排序或求和的方式。
- Preview types:只有 `cost-estimations.md` 中明确标记为 preview 的 capabilities 才算 preview;绝不根据零用量推断 preview 状态。
- 当任何 intent 涉及 cost ranking 或 cost drivers(cost drivers、cost trend、workflow cost、query cost attribution、cost investigation、cost spike):在 DQL 中计算 `cost_weight` — 先运行 base usage queries(Queries 1–4 from `billing-capabilities.md`)直到 `| summarize billable_usage`,然后立即追加 Full Inline Lookup for Cost Rankings。Full Inline Lookup 同时处理单位换算和 cost weighting;不要再应用 `billing-capabilities.md` 中的 Unit Conversion Lookup,它是冗余的,链式 `lookup` 会替换所有现有 `lookup.*` 字段,破坏 cost-weight 计算。查询以 `| filter isNotNull(cost_weight) | sort cost_weight desc | fields event.type, capability_usage, cost_weight` 结束。绝不要心算乘 normalization weights — 值跨多个数量级,静默算术错误无法发现。
- 展示排名而非美元金额:DQL 结果已预排序。删除 `cost_weight` 列,只展示 rank number、capability name、native units(如 GiB、GiB-hours、sessions、data points)。绝不包含 cost、weight 或 dollar 列。'top 5 cost drivers' 示例输出:1. Log Management & Analytics - Ingest & Process 62.3 TiB;2. Full-Stack Monitoring 2,366,800 GiB-hours;3. Real User Monitoring 51.5M sessions;4. Infrastructure Monitoring 847,200 host-hours;5. Metrics - Ingest & Process 18.2B data points。对 percentage questions 输出 share-of-total 表。除非用户提供自己的 contracted rate,否则绝不显示 raw USD estimates。
- 免责声明放结果前:仅适用于多 capability 结果(2+ capabilities、排名、百分比表)。逐字复制:`ℹ️ Rankings show relative spend — for actual dollar figures, see **Account Management > Subscription > Overview > Cost and usage details**.`。对单 capability 结果(恰好一个 capability,无跨 capability 比较)完全省略该免责声明;若响应处于 user-provided rate 模式,即使单 capability 结果也要包含该模式要求的警告。
- 不添加补充 rate-card 说明:上述指定免责声明是唯一可引用 normalization methodology 的地方。绝不在响应其他位置添加如 'These numbers are based on the public DPS rate card' 或 'based on public list prices'。这不抑制 user-provided rate 模式所需 warning。
- 当用户问 generic/open-ended 的成本、用量或技能能力问题时,展示下面菜单,且不运行 DQL,等待用户选择:1 Cost breakdown — 'What are my top cost drivers for the last 7 days?';2 Usage overview — 'Give me an overview of our platform usage across all capabilities.';3 Spike investigation — 'My log query cost spiked last week — which source is causing it?';4 Chargeback / showback — 'Show me a cost breakdown by cost center for the last 30 days.';5 Metrics optimization — 'Which metrics are driving our ingest cost? Help me optimize.'。
- 按需加载知识库参考:`billing-event-types.md` — billing event type catalog,含 fields、metering intervals、per-type tables。
- 按需加载知识库参考:`billing-capabilities.md` — BUE-to-capability mapping、unit conversion、cross-category usage queries、included volume deduction。
- 按需加载知识库参考:`cost-estimations.md` — cost normalization weights、unit conversion lookup、cost estimation queries、full inline lookup for dashboards。
- 按需加载知识库参考:`cost-allocation.md` — cost center/product attribution、chargeback queries。
- 按需加载知识库参考:`query-cost-attribution.md` — query scan cost attribution,含 BUE by source、per-detector breakdown(ALERTING pool)、QEE drill-down。
- 按需加载知识库参考:`workflow-total-cost.md` — workflow total cost,含四个 billing signals(query scan、AppEngine、workflow-hours、AI invocations)。
- 按需加载知识库参考:`entity-cost-drilldown.md` — entity-based cost drill-down,含 RUM/Host/Synthetic/K8s/Security/Automation by entity。
- 按需加载知识库参考:`metrics-ingest-optimization.md` — per-metric-key cost drill-down,含 cardinality analysis、timeseries verification、optimization target identification。
- 执行 Quick Start 发现查询:`fetch dt.system.events, from: -7d | filter event.kind == "BILLING_USAGE_EVENT" | summarize event_count = count(), by: {event.type} | sort event_count desc`。
- 始终先按 `event.kind` 过滤,避免扫描无关事件。
- 从 7d 时间范围开始,平台数据体量高。
- 计费总额使用显式 UTC midnight boundaries;参考 `billing-capabilities.md § Billing Timeframe Boundaries`。
- 绝不用 `~` 表示近似;使用 `≈` 或 'approximately'(裸 `~` 会创建 Markdown strikethrough)。
- 结果为空时,运行上面的 discovery query 验证可用 event types。
- `count()` 会 fan out — 计数前确认 one-row-per-thing。`QUERY_EXECUTION_EVENT`(每个 DQL statement 每个 bucket touched 一行)和 `WORKFLOW_EVENT` `WORKFLOW_EXECUTION`(≈2 rows per run:start + completion)在 `count()` 时都会 over-count。DQL-statement volume 用 `countDistinct(query_id)`;workflow run count 和 frequency 用 `countDistinct(dt.automation_engine.workflow_execution.id)` on `WORKFLOW_EXECUTION` — 绝不用裸 `count()`。绝不写 'ran N times',也绝不从任何 raw `count()` 计算 per-second/per-minute rate。参考 `query-cost-attribution.md § Step 3` 和 `workflow-total-cost.md § How Often Did the Workflow Run`。
- 绝不使用 entity-model functions — `entityName()`(以及任何接收 `dt.entity.*` 字段来解析 entity metadata 的函数)已废弃。结果中展示 raw `dt.entity.*` IDs(如 `HOST-1A2B3C`)。按 ID 分组或计数(`by: {dt.entity.host}`、`countDistinct(dt.entity.host)`)可以,因为把 ID 当作 plain value 使用。参考 `entity-cost-drilldown.md § Entity IDs in Results`。
- 处理无 universal usage field 的限制:每个 event type 使用不同 billed unit;不经过 cost normalization 不能跨类别求和。
- 处理 normalization weights 的限制:normalization weights ≠ contract rates;排名是相对的;权威数字使用 Account Management。
- 处理 included volume 的限制:Metrics/Traces Ingest 包含 host baseline(≈14 days max);参考 `billing-capabilities.md § Included Volume`。
- 处理 cost attribution 的限制:cost attribution 是 optional,只在配置后填充;Retention events 常缺 entity references。
- 处理 zero-rated queries:某些查询可能基于 execution context(user、apps、queried data)zero-rated;这些产生 QEE records 但没有对应 BUE。QEE `scanned_bytes` 与 BUE `billed_bytes` 总量之间的 gap 表示 zero-rated usage,不是 pipeline issue;参考 `query-cost-attribution.md § Investigating QEE↔BUE Mismatches`。
适用边界 · 注意事项
- 不适用于询问 DPS 计费/定价概念、rate card、单位/权重含义、licensing/entitlement 的问题;这些不应从本技能内容回答,应指向官方文档或 Account Management > Subscription > Pricing。
- 不适用于非 DPS 环境、classic license models(host units、DDUs、DEM units、ASUs),以及 AWS 云基础设施 FOCUS 成本;后者用 `dt-biz-cloud-costs`。
- 不适用于优化 DQL 查询本身更快/更省(query optimization、减少每次运行扫描数据/消费、filter-early best practices);那属于 `dt-dql-essentials`;也需有 Dynatrace DPS 环境和 `dt.system.events` 的 DQL 查询权限。