插件 〉AWS X-Ray


开发者

Grafana

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



数据源
grafana

AWS X-Ray

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

兼容性

Grafana AWS X-Ray 数据源插件 >=2.13.0 与 Grafana 版本 <10.4.x 不兼容,因为 UI 组件发生了重大更改。

X-Ray 数据源

X-Ray 数据源插件为 AWS X-Ray 提供支持。将其添加为数据源后,您就可以使用 X-Ray 构建仪表板或使用 Explore 来查看跟踪、分析或洞察。

添加数据源

  1. 在侧边菜单中的 Configuration(配置) 链接下,单击 Data Sources(数据源)
  2. 单击 Add data source(添加数据源) 按钮。
  3. Distributed tracing(分布式跟踪) 部分中,选择 X-Ray

Note(注意): 如果您在使此数据源工作时遇到问题,并且 Grafana 给您提供了描述不明确的错误,请检查您的日志文件 (/var/log/grafana/grafana.log)。

名称描述
名称数据源名称。这是您在面板和查询中引用数据源的方式。
默认默认数据源意味着它将预先为新面板选择。
默认区域在查询编辑器中使用以设置区域。(可以在每个查询的基础上更改)
身份验证提供程序指定提供程序以获取凭据。
凭据配置文件名称指定要使用的配置文件的名称(如果您使用 ~/.aws/credentials 文件),留空则为默认值。
Assume Role Arn(承担角色 Arn)指定要承担的角色的 ARN。
External ID(外部 ID)如果您要承担在另一个使用外部 ID 创建的账户中的角色,请在此处指定外部 ID。

身份验证

在本节中,我们将介绍您可以用于 AWS X-Ray 数据源的不同类型的身份验证。

IAM 角色

目前,对 X-Ray 的所有访问都由 Grafana 后端使用官方 AWS SDK 在服务器端完成。如果您的 Grafana 服务器在 AWS 上运行,则可以使用 IAM 角色,身份验证将自动处理。

请参阅 AWS 文档中的 IAM 角色

Note(注意): 目前不支持 AWS 角色切换

IAM 策略

Grafana 需要通过 IAM 授予权限才能读取 X-Ray 数据和 EC2 标签/实例/区域。您可以将这些权限附加到 IAM 角色,并利用 Grafana 的内置角色承担支持。

这是一个基本策略示例

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "xray:BatchGetTraces",
        "xray:GetTraceSummaries",
        "xray:GetTraceGraph",
        "xray:GetGroups",
        "xray:GetTimeSeriesServiceStatistics",
        "xray:GetInsightSummaries",
        "xray:GetInsight",
        "xray:GetServiceGraph",
        "ec2:DescribeRegions"
      ],
      "Resource": "*"
    }
  ]
}

AWS 凭据示例

如果身份验证提供程序是 Credentials file(凭据文件),则 Grafana 尝试按以下顺序获取凭据

  • 硬编码凭据
  • 环境变量 (AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY)
  • 现有默认配置文件
  • ~/.aws/credentials
  • Amazon EC2 的 IAM 角色

有关更多信息,请参阅 AWS 文档中的 Configuring the AWS SDK for Go(配置 AWS SDK for Go)

AWS 凭据文件

~/.aws/credentials 创建一个文件。这是运行 grafana-server 的用户的 HOME 路径。

Note(注意): 如果凭据文件位于正确的目录中,但不起作用,请尝试将您的 .aws 文件移动到 '/usr/share/grafana/'。确保您的凭据文件最多具有 0644 权限。

凭据文件示例

[default]
aws_access_key_id = <your access key>
aws_secret_access_key = <your access key>
region = us-west-2

查询编辑器

查询编辑器中最重要的字段是查询类型。有五种查询类型

  • Trace List (Traces in AWS)(跟踪列表(AWS 中的跟踪))
  • Trace Statistics(跟踪统计信息)
  • Trace Analytics (Analytics in AWS)(跟踪分析(AWS 中的分析))
  • Insights(洞察)
  • Service map(服务地图)

x-ray-query-editor

Trace List(跟踪列表)

Trace List(跟踪列表)类型允许您搜索在表格中显示的跟踪。单击第一列中的 trace id(跟踪 ID) 将在右侧打开跟踪。请注意编辑器中的查询字段。您可以编写查询、过滤器表达式,或插入将在跟踪视图中显示的单个跟踪 ID。您可以在 AWS X-Ray documentation(AWS X-Ray 文档) 中找到有关过滤器表达式的更多详细信息。

x-ray-trace-list

Note(注意): Trace List(跟踪列表)将仅显示前 1000 个跟踪。

Trace Statistics(跟踪统计信息)

在 Trace Statistics(跟踪统计信息)中,您可以看到图表和表格,其中显示有关错误、故障、限制、成功和总计数的信息。您可以使用查询编辑器中的 columns(列) 字段仅查看指定的列。

x-ray-trace-statistics

Trace Analytics(跟踪分析)

在 Trace Analytics(跟踪分析)中,您可以可视化以下表格

  • Root Cause(根本原因)
    • Response Time(响应时间)
      • Root Cause Service (Last service in path)(根本原因服务(路径中的最后一个服务))
      • Path (multiple paths)(路径(多个路径))
    • Error(错误)
      • Root Cause Service (Last service in path)(根本原因服务(路径中的最后一个服务))
      • 路径
      • Error Message(错误消息)
    • Fault(故障)
      • Root Cause Service (Last service in path)(根本原因服务(路径中的最后一个服务))
      • 路径
      • Error Message(错误消息)
  • End user Impact(最终用户影响)
  • URL
  • HTTP Status Code(HTTP 状态代码)

Insights(洞察)

在 Insights(洞察)中,您可以看到 Insights(洞察)的摘要表。单击 InsightId 将转到 AWS 控制台。

Service map(服务地图)

Grafana 中的 Service map(服务地图)使客户能够查看使用微服务架构构建的应用程序地图。地图上的每个节点代表一个服务,例如 AWS Lambda 函数或在 API Gateway 或 DynamoDB 表上运行的 API。借助此地图,客户可以轻松检测任何服务中的性能问题或错误、故障或限制率的增加,并深入研究相应的跟踪和根本原因。

Service map

Service Map(服务地图)查询类型显示与 X-ray 控制台内的服务地图相同的数据。

要显示服务地图

  • 在 Grafana 7.4 及更高版本中使用 Node graph panel(节点图面板) 可视化。
  • 在 Grafana 7.4 及更高版本中使用 Explore
  • 在简单表格中显示数据。如果 Node graph panel(节点图面板)不可用,这是唯一选项。

您可以使用按钮或鼠标平移和缩放视图。有关可视化的详细信息,请参阅 Node graph panel(节点图面板)

Service map navigation

与 X-ray 根节点类似,服务地图中代表客户端应用程序的节点位于地图的左侧。

地图中的每个服务都表示为一个圆圈。内部的数字显示每次事务的平均时间和每分钟的事务数。

服务周围的彩色圆圈也与 X-ray 控制台的颜色和含义相匹配,表示请求的百分比。

  • 绿色 = 成功
  • 红色 = 故障
  • 黄色 = 错误
  • 紫色 = 限制响应

单击服务或边缘以查看上下文菜单,其中包含指向 X-ray 中其他相关信息的快速导航的其他链接。您可以使用这些链接快速导航到特定服务的所有错误跟踪列表,然后继续到特定跟踪。

有关 Service map(服务地图)的更多信息,请参阅官方 AWS X-ray documentation(AWS X-ray 文档)

警报

由于 X-Ray 查询可以返回数值数据,因此支持警报。有关 Grafana 警报的更多信息,请参阅 Alerting(警报) 文档。

定价

使用 AWS X-Ray,无需预付费用或承诺。您只需根据使用的量付费,具体取决于记录、检索和扫描的跟踪数量。每月检索或扫描的前 1,000,000 个跟踪是免费的。超过免费层级后,扫描的跟踪费用为每 100 万个扫描的跟踪 0.50 美元(每个跟踪 0.0000005 美元)。有关更多详细信息,请参阅 X-Ray pricing page(X-Ray 定价页面)

使用配置配置数据源

您可以使用带有 Grafana 配置系统的配置文件来配置数据源。有关其工作原理和所有可用设置的更多信息,请参阅 Provision Grafana(配置 Grafana)

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

使用凭据文件

如果您使用的是 Credentials file(凭据文件)身份验证类型,请使用类似于此的配置

apiVersion: 1

datasources:

  • name: X-Ray type: grafana-x-ray-datasource jsonData: authType: credentials defaultRegion: eu-west-2

使用 accessKeysecretKey

apiVersion: 1

datasources:

  • name: X-Ray type: grafana-x-ray-datasource jsonData: authType: keys defaultRegion: eu-west-2 secureJsonData: accessKey: ‘<your access key>’ secretKey: ‘<your secret key>’

跨账户可观测性

X-Ray 插件允许您使用跨账户可观测性功能跨区域内的多个 AWS 账户监控跟踪。使用跨账户可观测性,您可以无缝搜索、可视化和分析 AWS 跟踪,而无需担心账户边界。

入门

要启用跨账户可观测性,请首先使用官方 CloudWatch docs(CloudWatch 文档) 在 AWS 中启用该功能,然后将 两个 API 操作 添加到附加到运行插件的角色/用户的 IAM 策略。

此功能目前位于 cloudWatchCrossAccountQuerying 功能开关后面。

您可以通过配置文件或环境变量启用功能开关。有关详细信息,请参阅配置 [文档]({{< relref "../setup-grafana/configure-grafana/#feature_toggles" >}})。Grafana Cloud 用户可以通过 在 Cloud Portal(云门户)中打开支持票证 来访问此功能。

按账户 ID 筛选跟踪

启用该功能后,您将能够跨多个账户显示跟踪,并按账户 ID 筛选这些跟踪。当您在 Grafana 中选择 Service Map(服务地图) 查询类型时,将显示一个账户下拉列表,并填充在选定时间范围内返回的跟踪中显示的账户 ID。

您还可以将账户 ID 添加为 Trace List(跟踪列表)查询类型中查询筛选器表达式的一部分。

在 Grafana Cloud 上安装 AWS X-Ray

有关更多信息,请访问有关 plugin installation(插件安装) 的文档。

变更日志

此项目的所有重大更改都将记录在此文件中。

2.13.2

  • #313 中将 github.com/grafana/grafana-plugin-sdk-go 更新到 v0.265.0
  • #307 中通过 3 个更新在 1 个目录中跳过 all-go-dependencies 组
  • Chore(杂项):在 #303 中更新 e2e 测试工作流程
  • #288 中的 go_modules 组中将 golang.org/x/crypto 从 0.30.0 跳到 0.31.0

2.13.1

  • #301 中更新自述文件以包含有关兼容性的信息

2.13.0

  • #282 中添加 PDC 支持
  • #292 中将 @grafana/experimental 替换为 @grafana/plugin-ui

2.12.0

  • #289 中通过 19 个更新跳过 all-node-dependencies 组
  • #283 中通过 4 个更新在 1 个目录中跳过 all-go-dependencies 组
  • #286 中将开始时间添加到响应中

2.11.0

  • #275 中通过 31 个更新在 1 个目录中跳过 all-node-dependencies 组
  • #274 中的 npm_and_yarn 组中将 nanoid 从 3.3.7 跳到 3.3.8
  • #269 中通过 4 个更新在 1 个目录中跳过 all-go-dependencies 组
  • #271 中的 npm_and_yarn 组中将 cross-spawn 从 7.0.3 跳到 7.0.6
  • #260 中的 npm_and_yarn 组中将 path-to-regexp 从 1.8.0 跳到 1.9.0
  • #262 中通过 3 个更新在 1 个目录中跳过 all-go-dependencies 组
  • #259 中的 npm_and_yarn 组中将 micromatch 从 4.0.7 跳到 4.0.8
  • #255 中通过 2 个更新跳过 all-github-action-dependencies 组
  • #258 中的 npm_and_yarn 组中将 webpack 从 5.93.0 跳到 5.94.0
  • 升级 grafana-plugin-sdk-go (deps):在 #252 中将 github.com/grafana/grafana-plugin-sdk-go 从 0.252.0 跳到 0.255.0
  • Chore(杂项):在 #251 中跳过依赖项
  • Chore(杂项):在 #250 中更新 plugin.json 关键字
  • #247 中更新插件名称以匹配 Amazon 惯例

2.10.1

  • chore(杂项):在 #245 中添加 errorsource
  • Chore(杂项):在 #243 中重命名数据源文件
  • 添加带有 lint 和拼写检查的预提交钩子 #242
  • 将 yarn 而不是 cspell 用于预提交钩子 #246

2.10.0

  • Chore(杂项):在 #240 中更新依赖项

2.9.1

  • #235 中通过 @idastambuk 迁移到配置和查询编辑器中的新表单样式

2.9.0

  • Fix(修复):通过 @kevinwcyu 在 #228 中将空数组传递给查询所有列
  • 通过 @katebrenner 在 #226 中为问题添加 stalebot
  • #232 中更新为使用 datasource.Manage 和 sessions.GetSessionWithAuthSettings(使用身份验证设置获取会话)
  • Fix(修复):在 #236 中使用 ReadAuthSettings(读取身份验证设置)获取 authSettings

2.8.3

2.8.2

  • 在 https://github.com/grafana/x-ray-datasource/pull/220 中将 grafana/aws-sdk-go 更新到 0.20.0

2.8.1

  • 通过 @dependabot 在 https://github.com/grafana/x-ray-datasource/pull/208 中将 go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace 从 0.37.0 跳到 0.44.0
  • 通过 @dependabot 在 https://github.com/grafana/x-ray-datasource/pull/212 中将 google.golang.org/grpc 从 1.58.2 跳到 1.58.3
  • 通过 @dependabot 在 https://github.com/grafana/x-ray-datasource/pull/218 中将 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc 从 0.45.0 跳到 0.46.0
  • 通过 @fridgepoet 在 https://github.com/grafana/x-ray-datasource/pull/217 中升级 underscore、d3-color、debug、cosmiconfig、yaml 依赖项

Full Changelog(完整变更日志): https://github.com/grafana/x-ray-datasource/compare/v2.8.0...v2.8.1

2.8.0

  • 将 ConfigEditor 和 QueryEditor 迁移到新表单样式 #211

  • #210 中将 google.golang.org/grpc 从 1.54.0 跳到 1.56.3

  • 201 中支持 Node 18

2.7.2

  • 通过 jamesrwhite 在 https://github.com/grafana/x-ray-datasource/pull/203 中修复 X-Ray Service Map(X-Ray 服务地图)过滤器跟踪列表查询

2.7.1

  • 更新 @grafana/aws-sdk 以修复临时凭据中的错误

2.7.0

  • 更新 grafana-aws-sdk 到 v0.19.1 以将 il-central-1 添加到选择加入区域列表

2.6.2

  • 跳过 grafana/aws-sdk-react 依赖项 #191
  • 移除代码覆盖率工作流程 #188

2.6.1

  • 更新 grafana-aws-sdk 版本以在选择加入区域列表中包含新区域 https://github.com/grafana/grafana-aws-sdk/pull/80
  • Security(安全):在构建过程中将 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/x-ray-datasource/pull/173 中将 SQL 添加到跟踪

2.4.0

  • 通过 sunker 在 https://github.com/grafana/x-ray-datasource/pull/158 中添加拼写检查并修复拼写错误
  • 通过 iwysiu 在 https://github.com/grafana/x-ray-datasource/pull/148 中迁移到 create-plugin
  • 通过 idastambuk 在 https://github.com/grafana/x-ray-datasource/pull/162 中更新代码覆盖率工作流程
  • 通过 kevinwcyu 在 https://github.com/grafana/x-ray-datasource/pull/164 中更新 @grafana/aws-sdk
  • Dependencies(依赖项):通过 idastambuk 在 https://github.com/grafana/x-ray-datasource/pull/167 中将 @grafana 依赖项更新到 9.3.2
  • Small Refactor(小型重构):如果不在服务地图页面上,则不获取账户 ID,通过 sarahzinger 在 https://github.com/grafana/x-ray-datasource/pull/169
  • 通过 @fridgepoet 在 https://github.com/grafana/x-ray-datasource/pull/171 中将 grafana-aws-sdk 升级到 v0.12.0

Full Changelog(完整变更日志): https://github.com/grafana/x-ray-datasource/compare/v2.2.0...v2.4.0****

2.3.0

  • Feature(功能):使在 https://github.com/grafana/x-ray-datasource/pull/157 中可以按账户 ID 筛选

2.2.0

  • 使 SummaryStatistics 的属性成为可选

2.1.2

  • Security(安全):在构建过程中将 Go 升级到 1.19.3

2.1.1

  • Security(安全):在构建过程中将 Go 升级到 1.19.2

2.1.0

  • 通过 @dependabot 在 https://github.com/grafana/x-ray-datasource/pull/130 中将 terser 从 4.8.0 跳到 4.8.1
  • 通过 iwysiu 在 https://github.com/grafana/x-ray-datasource/pull/132 中修复带有变量的 Trace List(跟踪列表)
  • 通过 @fridgepoet 在 https://github.com/grafana/x-ray-datasource/pull/139 中升级到 grafana-aws-sdk v0.11.0

Full Changelog(完整变更日志): https://github.com/grafana/x-ray-datasource/compare/v2.0.1...v2.1.0

v.2.0.1

  • 使用密钥进行身份验证的 Bug 修复:https://github.com/grafana/x-ray-datasource/pull/128
  • 代码覆盖率变更
  • 代码所有者变更

v2.0.0

What's Changed(已更改内容)

  • 通过 @yaelleC 在 https://github.com/grafana/x-ray-datasource/pull/122 中停止支持 8.0.0 以下的 Grafana 版本

Bug fixes(Bug 修复)

  • 通过 iwysiu 在 https://github.com/grafana/x-ray-datasource/pull/115 中更新最低 IAM 策略
  • 通过 @fridgepoet 在 https://github.com/grafana/x-ray-datasource/pull/119 中修复已弃用的 strings.Title 用法

Other(其他)

  • 通过 @andresmgot 在 https://github.com/grafana/x-ray-datasource/pull/121 中更新 grafana-aws-sdk

v1.4.0

Bug fixes(Bug 修复)

  • 使用非选择加入区域以获取承担角色的令牌
  • 修复错误的开始和结束时间 #89
  • 修复格式更改后的时间持续时间 #88
  • 避免解析标签中的 URL 时出错 #84

Other(其他)

  • 修改请求的 User-Agent。现在它将遵循此格式:"aws-sdk-go/$aws-sdk-version ($go-version; $OS;) X-ray/$X-ray-version-$git-hash Grafana/$grafana-version"

v1.3.4

Bug fixes(Bug 修复)

  • 为服务地图图例中的统计信息添加可读的名称 #82
  • 升级 grafana-aws-sdk 版本,修复承担角色的问题 #81

Other(其他)

  • 将 prismjs 从 1.23.0 跳到 1.24.0 #80

v1.3.3

Other(其他)

  • 跳过 grafana/aws-sdk 和 Grafana 依赖项版本 #77

v1.3.2

Features / Enhancements(功能/增强)

  • 使用来自 grafana-aws-sdk 的 ConnectionConfig #73
  • 将 prismjs 从 1.21.0 跳到 1.23.0 #70

v1.3.1

Bug fixes(Bug 修复)

  • 删除对非向后兼容 API 的使用,从而防止在 7.4.0 之前的 Grafana 中使用 1.3.0 版本。 #67

Other(其他)

  • 将 Grafana 依赖项锁定在最新的稳定版本上,从而防止 CI 中的编译失败。 #68

v1.3.0

Features / Enhancements(功能/增强)

  • 添加 Service Map(服务地图)查询类型,该类型允许以类似于 X-Ray 控制台的方式可视化服务地图数据。 #60

v1.2.0

Features / Enhancements(功能/增强)

  • 更新插件配置页面中的身份验证设置,以包含 SDK 默认身份验证机制,并使用我们 Grafana 特定的 AWS 身份验证 SDK。 #59

v1.1.0

Features / Enhancements(功能/增强)

  • 将区域选择器添加到查询编辑器。 #57

v1.0.1

  • CI 自动化发布所需的版本跳跃

v1.0.0

  • 初始版本
link icon
Documentation(文档)
Plugins using AngularJS(使用 AngularJS 的插件)
link icon
Documentation(文档)
Monitor the image renderer(监控图像渲染器)
link icon
Documentation(文档)
Troubleshoot image rendering(排除图像渲染故障)
blog post icon
Blog post(博客文章)
Video: How to get started with MongoDB and Grafana(视频:如何开始使用 MongoDB 和 Grafana)
blog post icon
Blog post(博客文章)
Introducing the new and improved Grafana BigQuery plugin(介绍全新改进的 Grafana BigQuery 插件)
blog post icon
Blog post(博客文章)
Monitoring COVID-19 virus levels in wastewater using Grafana, Databricks, and the Sqlyze plugin(使用 Grafana、Databricks 和 Sqlyze 插件监控废水中的 COVID-19 病毒水平)
blog post icon
Blog post(博客文章)
Video: Top 3 features of the New Relic data source plugin for Grafana Enterprise(视频:Grafana Enterprise 的 New Relic 数据源插件的 3 大功能)
blog post icon
Blog post(博客文章)
How traceroute in the Synthetic Monitoring plugin for Grafana Cloud helps network troubleshooting(Grafana Cloud 的 Synthetic Monitoring 插件中的 traceroute 如何帮助进行网络故障排除)
blog post icon
Blog post(博客文章)
Video: How to build a Prometheus query in Grafana(视频:如何在 Grafana 中构建 Prometheus 查询)
blog post icon
Blog post(博客文章)
Video: How to set up a Prometheus data source in Grafana(视频:如何在 Grafana 中设置 Prometheus 数据源)
blog post icon
Blog post(博客文章)
Don't miss our webinars on Grafana Tempo, Grafana Enterprise Traces, and the new Sentry plugin(不要错过我们关于 Grafana Tempo、Grafana Enterprise Traces 和新的 Sentry 插件的网络研讨会)
blog post icon
Blog post(博客文章)
Grafana 2021: Year in review(Grafana 2021 年回顾)
blog post icon
Blog post(博客文章)
Monitor all your Redshift clusters in Grafana with the new Amazon Redshift data source plugin(使用新的 Amazon Redshift 数据源插件在 Grafana 中监控您的所有 Redshift 集群)
blog post icon
Blog post(博客文章)
Introducing the Sentry data source plugin for Grafana(介绍 Grafana 的 Sentry 数据源插件)
blog post icon
Blog post(博客文章)
Query and analyze Amazon S3 data with the new Amazon Athena plugin for Grafana(使用新的 Amazon Athena 插件 for Grafana 查询和分析 Amazon S3 数据)