插件 〉Amazon Timestream


开发者

Grafana Labs

注册以接收偶尔的产品新闻和更新



数据源
grafana

Amazon Timestream

  • 概述
  • 安装
  • 更新日志
  • 相关内容

Timestream 数据源

Timestream 数据源插件为 Amazon Timestream 提供支持。将其添加为数据源后,您就可以使用 Timestream 查询结果构建仪表盘了

添加数据源

  1. 在侧菜单的Configuration链接下,点击Data Sources
  2. 点击Add data source按钮。
  3. Time series databases部分选择Timestream

认证

有关认证选项和配置详情,请参阅 AWS authentication 主题。

IAM 策略

Grafana 需要通过 IAM 授予权限才能从 Timestream API 读取数据。您可以将这些权限附加到上一步中配置的 IAM 角色或 IAM 用户。

以下是一个策略示例

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["timestream:*"],
      "Resource": "*"
    }
  ]
}

查询编辑器

查询编辑器支持 timestream 语法,以及上面列出的宏和任何仪表盘模板变量。

query-editor

输入 ctrl+space 打开 IntelliSense 建议

为了简化语法并允许动态部分(例如日期范围过滤器),查询可以包含宏。

宏示例描述
$__database将指定选定的数据库。这可以使用数据源配置中的默认值,或查询编辑器中的显式值。
$__table将指定选定的数据库。这可以使用数据源配置中的默认值,或查询编辑器中的显式值。
$__measure将指定选定的度量。这可以使用数据源配置中的默认值,或查询编辑器中的显式值。
$__timeFilter将被替换为一个将时间限制在仪表盘范围内的表达式。
$__timeFrom将被替换为仪表盘范围开始时的毫秒数。
$__timeTo将被替换为仪表盘范围结束时的毫秒数。
$__interval_ms将被替换为一个时间格式的数字,表示图表中单个像素应涵盖的时间量。
$__interval_raw_ms将被替换为毫秒数,表示图表中单个像素应涵盖的时间量。

在查询中使用变量

您可以使用变量,而不是在 Timestream 查询中硬编码服务器、应用和传感器名称。这些变量在仪表盘顶部列为下拉选择框。这些下拉框使您可以轻松更改仪表盘中的数据显示。

有关模板和模板变量的介绍,请参阅 Templating 文档。

禁用多值变量的引号

Grafana 会自动为多值变量创建一个带引号、逗号分隔的字符串。例如:如果 server01server02 选择了,它将格式化为:'server01', 'server02'。要禁用引号,请对变量使用 csv 格式选项

${servers:csv}

Variables 文档中阅读有关变量格式选项的更多信息。

告警

告警查询应包含时间序列字段。不包含此字段的查询将返回错误:"input data must be a wide series but got type long"。要返回时间序列,您可以使用 CREATE_TIME_SERIES function。例如

SELECT
	silo, microservice_name, instance_name,
	CREATE_TIME_SERIES(time, measure_value::double) AS gc_pause
FROM $__database.$__table
WHERE $__timeFilter
	AND measure_name = '$__measure'
	AND region = 'ap-northeast-1'
	AND cell = 'ap-northeast-1-cell-5'
	AND silo = 'ap-northeast-1-cell-5-silo-2'
	AND availability_zone = 'ap-northeast-1-3'
	AND microservice_name = 'zeus'
GROUP BY region,
	cell,
	silo,
	availability_zone,
	microservice_name,
	instance_name,
	process_name,
	jdk_version
ORDER BY AVG(measure_value::double) DESC
LIMIT 3

注意:默认情况下,Timestream 查询结果会分不同的页面返回(如有必要)。为确保在评估告警之前处理所有页面,请选中所有告警查询的“Render”查询编辑器部分下方的“Wait for all queries”复选框。

使用 Provisioning 配置数据源

您可以使用配置文件和 Grafana 的 Provisioning 系统配置数据源。您可以在 Provisioning 文档页面上阅读更多关于其工作原理以及您可以为数据源设置的所有设置的信息。

以下是此数据源的一些 Provisioning 示例。

使用 AWS SDK(默认)

apiVersion: 1
datasources:
  - name: Timestream
    type: grafana-timestream-datasource
    jsonData:
      authType: default
      defaultRegion: eu-west-2

使用凭证配置文件名(非默认)

apiVersion: 1

datasources:

  • name: Timestream type: grafana-timestream-datasource jsonData: authType: credentials defaultRegion: us-east-1

使用 accessKeysecretKey

apiVersion: 1

datasources:

  • name: Timestream type: grafana-timestream-datasource jsonData: authType: keys defaultRegion: us-east-1 secureJsonData: accessKey: ‘<your access key>’ secretKey: ‘<your secret key>’

使用 AWS SDK 默认和要扮演的 IAM 角色的 ARN

apiVersion: 1
datasources:
  - name: Timestream
    type: grafana-timestream-datasource
    jsonData:
      authType: default
      assumeRoleArn: arn:aws:iam::123456789012:root
      defaultRegion: eu-west-2

示例仪表盘

此插件包含一个示例仪表盘。请查阅官方 Timestream 文档中的 Sample Application section 部分进行设置。

在 Grafana Cloud 上安装 Amazon Timestream

欲了解更多信息,请访问 插件安装文档。

更新日志

此项目所有重要变更将在此文件中记录。

2.11.0

  • 将 github.com/grafana/grafana-plugin-sdk-go 从 0.268.1 升级到 0.269.1 (all-go-dependencies 组,1 个目录) (#384)
  • 将 golang.org/x/net 从 0.35.0 升级到 0.36.0 (go_modules 组) (#385)
  • all-node-dependencies 组更新 18 个依赖项 (1 个目录) (#387)
  • 将 @babel/runtime 从 7.26.9 升级到 7.26.10 (npm_and_yarn 组) (#386)
  • 在 #374 中添加 PDC 支持

2.10.1

  • 更新 plugin.json 中支持的最低 Grafana 版本

2.10.0

  • 在 #375 中将表单迁移到新样式
  • 在 #366 中将外部 PR 添加到项目看板
  • 杂项:在 #362 中为外部贡献添加标签
  • 在 #358 中将 E2E 测试迁移到 Playwright
  • Dependabot
    • all-node-dependencies 组更新 7 个依赖项 (1 个目录) (#377)
    • all-go-dependencies 组更新 3 个依赖项 (1 个目录) (#376)
    • 将 github.com/grafana/grafana-plugin-sdk-go 从 0.265.0 升级到 0.266.0 (all-go-dependencies 组) (#372)
    • all-node-dependencies 组更新 22 个依赖项 (1 个目录) (#370)
    • 将 github.com/grafana/grafana-plugin-sdk-go 从 0.262.0 升级到 0.265.0 (all-go-dependencies 组,1 个目录) (#368)

2.9.13

  • all-node-dependencies 组更新 21 个依赖项 (1 个目录) (#352)
  • all-go-dependencies 组更新 3 个依赖项 (1 个目录) (#351)

2.9.12

  • 将 cross-spawn 从 7.0.3 升级到 7.0.6 (npm_and_yarn 组) (#330)
  • all-go-dependencies 组更新 2 个依赖项 (1 个目录) (#334)
  • 在 #331 中将 ap-south-1 添加到区域列表
  • all-node-dependencies 组更新 30 个依赖项 (1 个目录) (#337)

2.9.11

  • Bug 修复:在后端插值 interval #327

2.9.10

  • Bug 修复:考虑模板变量为数字的情况
  • 杂项:更新 dependabot 配置 (#317)
  • 依赖项更新
    • github.com/grafana/grafana-plugin-sdk-go 从 0.251.0 升级到 0.258.0 (#314,#315, #319)
    • github.com/aws/aws-sdk-go 从 1.51.31 升级到 1.55.5 (#319)
    • github.com/grafana/grafana-aws-sdk 从 0.31.2 升级到 0.31.4 (#319)
    • actions/checkout 从 2 升级到 4 (#318)
    • tibdex/github-app-token 从 1.8.0 升级到 2.1.0 (#318)
    • github.com/grafana/sqlds/v4 从 v4.1.0 升级到 v4.1.2 (#322)

2.9.9

  • 修复 #313 中的“Wait for All Queries”开关
  • 修复 #311 中 LongToWide 转换中的错误
  • 杂项:更新 plugin.json 关键词 (#310)
  • 更新 #309 中的 grafana-plugin-sdk-go 和 grafana-aws-sdk
  • 修复:#308 中的 linter 警告
  • 将 path-to-regexp 从 1.8.0 升级到 1.9.0 (#303)
  • 文档:#302 中的更新和改进
  • 在 #307 中为 grafana/plugin-sdk-go 添加 dependabot

2.9.8

  • 将 webpack 从 5.92.1 升级到 5.94.0 (#301)
  • 将 micromatch 从 4.0.7 升级到 4.0.8 (#299)
  • 将 fast-loops 从 1.1.3 升级到 1.1.4 (#298)

2.9.7

  • 功能:添加 errorsource #296
  • 杂项:重构宏以避免宏长度 bug (#295)

2.9.6

  • Bug 修复:修复 #291 中的 $interval 变量插值

2.9.5

  • 杂项:更新 #290 中的依赖项

2.9.4

  • 修复:在 #289 中使用 ReadAuthSettings 获取 authSettings

2.9.3

  • 升级 grafana-aws-sdk 和其他包 #285

2.9.2

  • 由 @kevinwcyu 在 https://github.com/grafana/timestream-datasource/pull/278 中添加关键词
  • 引入 go 1.21.8 中的安全修复

2.9.1

  • 将 grafana/aws-sdk 更新到 0.20.0,以便在 #274 中添加一个新的支持区域
  • 查询编辑器:修复 #272 中的表和数据库映射

2.9.0

  • 在 #270 中升级 jest-dom
  • 查询编辑器:在 #269 中,当所有宏都选中时停止自动运行查询
  • 将 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc 从 0.45.0 升级到 0.46.0 (#267)

2.8.0

  • 由 @kevinwcyu 在 https://github.com/grafana/timestream-datasource/pull/245 中添加 Node 18 支持
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/246 中将 word-wrap 从 1.2.3 升级到 1.2.5
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/235 中将 semver 从 5.7.1 升级到 5.7.2
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/250 中将 golang.org/x/net 从 0.9.0 升级到 0.17.0
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/249 中将 postcss 从 8.4.18 升级到 8.4.31
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/252 中将 @babel/traverse 从 7.18.13 升级到 7.23.2
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/253 中将 google.golang.org/grpc 从 1.54.0 升级到 1.56.3
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/251 中将 go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace 从 0.37.0 升级到 0.44.0
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/255 中将 @babel/traverse 从 7.18.13 升级到 7.23.2
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/254 中将 google.golang.org/grpc 从 1.58.2 升级到 1.58.3
  • 由 @fridgepoet 在 https://github.com/grafana/timestream-datasource/pull/263 中升级 underscore, d3-color, debug, cosmiconfig, yaml 依赖项
  • 由 @dependabot 在 https://github.com/grafana/timestream-datasource/pull/264 中将 yaml 从 2.1.3 升级到 2.3.4

完整更新日志:https://github.com/grafana/timestream-datasource/compare/v2.7.1...v2.8.0

2.7.1

  • 更新 @grafana/aws-sdk 以修复临时凭证中的 bug

2.7.0

  • 将 grafana-aws-sdk 更新至 v0.19.1,在可选区域列表中添加 il-central-1

2.6.2

  • 更新 grafana-aws-sdk-react 版本,使用 grafana/runtime 而非 grafanaBootData #237
  • 移除代码覆盖工作流 #234

2.6.1

  • 更新 grafana-aws-sdk 版本,在可选区域列表中包含新区域 https://github.com/grafana/grafana-aws-sdk/pull/80
  • 安全:构建流程中的 Go 升级至 1.20.4
  • 将 grafana-plugin-sdk-go 版本更新至 0.161.0,以避免潜在的 http 头问题。https://github.com/grafana/athena-datasource/issues/233

2.6.0

  • 更新后端依赖项

2.5.0

  • 由 @kevinwcyu 在 https://github.com/grafana/timestream-datasource/pull/216 中更新 @grafana/aws-sdk
  • 由 @chinu-anand 在 https://github.com/grafana/timestream-datasource/pull/217 中增加标签宽度以修复溢出。
  • 由 @iwysiu 在 https://github.com/grafana/timestream-datasource/pull/199 中迁移到 create-plugin
  • 由 @fridgepoet 在 https://github.com/grafana/timestream-datasource/pull/223 中升级 grafana-aws-sdk

完整更新日志:https://github.com/grafana/timestream-datasource/compare/v2.4.0...v2.5.0

2.4.0

  • 修复:SQLEditor:使用 queryRef 调用 onChange #209
  • 杂项:更新 code-coverage 版本 #211
  • 功能:Timestream 现已在 us-gov-west-1 区域可用 #207

2.3.2

  • 安全:构建流程中的 Go 升级至 1.19.3

2.3.1

  • 安全:构建流程中的 Go 升级至 1.19.2

v2.3.0

  • 由 @nekketsuuu 在 https://github.com/grafana/timestream-datasource/pull/184 中将 timestamp fieldType 更改为可为空
  • 由 @fridgepoet 在 https://github.com/grafana/timestream-datasource/pull/195 中升级至 grafana-aws-sdk v0.11.0

v2.2.0

  • 由 @sunker 在 https://github.com/grafana/timestream-datasource/pull/188 中添加对上下文感知自动补全的支持

v2.1.0

  • 添加 'ap-southeast-2' 和 'ap-northeast-1' 区域 #178

v2.0.1

  • 修复使用不正确密钥登录的问题:https://github.com/grafana/timestream-datasource/pull/176
  • 代码覆盖率检查更新

v2.0.0

  • 破坏性变更:Timestream 数据源现在需要 Grafana 8.0+ 才能运行。
  • 修复:允许时间序列的空数据点 #170

v1.5.2

  • 修复解析空时间戳时的 Panic (#165)

v1.5.1

  • 始终对数据库和表名应用双引号 (#155)

v1.5.0

  • 重做查询编辑器。
  • 添加开关以避免流式响应。
  • 添加 $__interval 变量。
  • 修改请求的 User-Agent。现在将遵循此格式:"aws-sdk-go/$aws-sdk-version ($go-version; $OS;) Timestream/$timestream-version-$git-hash Grafana/$grafana-version"。
  • 修复 Endpoint 和 Assume Role 设置的 bug。

v1.4.0

  • 添加 interval, from, to 原始值的宏 #98
  • 引用并连接多个变量 #118
  • 添加计量字节和扫描字节的统计信息 #110

v1.3.3

  • 支持多时间序列列
  • 改进的自定义端点支持

v1.3.2

  • 添加 eu-central-1 区域
  • 将“master”分支重命名为“main”
  • 使用 Golang 1.6 构建

v1.3.1

  • 在自己的请求中执行每个查询,这将支持需要多页才能完成的多个查询
  • 升级共享认证库
  • 将最低 Grafana 运行时版本提升至 7.5

v1.3.0

  • 修复支持多页时间序列结果的 bug
  • 使用共享认证库和 UI 组件
  • 将最低 Grafana 运行时版本提升至 7.4

v1.2.0

  • 在 armhf 上支持 $__timefilter (#52, @mg-arne)
  • 添加 $__now_ms 宏 (#49, @squalou)
  • 修复区域选择器的默认值

v1.1.2

  • 修复模板变量查询
  • 只显示有效区域

v1.1.1

  • 避免双重转义
  • 在查询中支持模板变量

v1.1.0

  • 更新认证以匹配内置 cloudwatch 认证
  • 在元数据中包含查询状态
  • 示例和查询建议现在引用所有名称

v1.0.0

  • 初始版本发布