📣

TiDB Cloud Serverless 现已更名为
Starter
!此页面由 AI 自动翻译,英文原文请见
此处。

将 TiDB Cloud 集成到 New Relic(预览版)

TiDB Cloud 支持 New Relic 集成(预览版)。你可以配置 TiDB Cloud,将你的 TiDB 集群的监控指标发送到 New Relic。之后,你可以直接在 New Relic 的仪表盘中查看这些指标。

New Relic 集成版本

自 2023 年 4 月 11 日起,TiDB Cloud 支持 New Relic 集成(Beta 版)。从 2025 年 7 月 31 日起,TiDB Cloud 推出了增强的预览版集成。

  • New Relic integration (Preview):如果在 2025 年 7 月 31 日前,你的组织内没有未删除的 Datadog 或 New Relic 集成,TiDB Cloud 将提供 New Relic 集成的预览版,让你体验最新的增强功能。
  • New Relic integration (Beta):如果在 2025 年 7 月 31 日前,你的组织内至少有一个未删除的 Datadog 或 New Relic 集成,TiDB Cloud 会保留现有和新建的集成为 Beta 版,以避免影响当前的仪表盘。我们也会主动与你联系,讨论合适的迁移方案和时间表。

前提条件

  • 要将 TiDB Cloud 集成到 New Relic,你必须拥有一个 New Relic 账号,并创建一个 Ingest - License 类型的 New Relic API 密钥

    如果你还没有 New Relic 账号,请在这里注册。

  • 要为 TiDB Cloud 设置第三方监控指标集成,你必须拥有 TiDB Cloud 的 Organization OwnerProject Owner 权限。要通过提供的链接查看集成页面或访问已配置的仪表盘,你至少需要 Project Viewer 角色,以便访问 TiDB Cloud 项目下的目标集群。

限制

  • 你无法在 TiDB Cloud StarterTiDB Cloud Essential 集群中使用 New Relic 集成。

  • 当集群状态为 CREATINGRESTORINGPAUSEDRESUMING 时,New Relic 集成不可用。

  • 当带有 New Relic 集成的集群被删除时,其关联的集成服务也会被移除。

操作步骤

步骤 1. 使用你的 New Relic API Key 进行集成

根据你的 New Relic 集成版本,访问集成页面的步骤有所不同。

    1. TiDB Cloud 控制台中,进入你的项目的 Clusters 页面,然后点击目标集群名称进入其概览页面。

    2. 在左侧导航栏,点击 Settings > Integrations

    3. Integrations 页面,点击 Integration to New Relic (Preview)

    4. 输入你的 New Relic API Key,并选择 New Relic 的站点。

    5. 点击 Test Integration

      • 如果测试成功,会显示 Confirm 按钮。
      • 如果测试失败,会显示错误信息。请根据提示进行排查并重试集成。
    6. 点击 Confirm 完成集成。

    1. TiDB Cloud 控制台中,使用左上角的下拉框切换到你的目标项目。

    2. 在左侧导航栏,点击 Project Settings > Integrations

    3. Integrations 页面,点击 Integration to New Relic (BETA)

    4. 输入你的 New Relic API Key,并选择 New Relic 的站点。

    5. 点击 Test Integration

      • 如果测试成功,会显示 Confirm 按钮。
      • 如果测试失败,会显示错误信息。请根据提示进行排查并重试集成。
    6. 点击 Confirm 完成集成。

    步骤 2. 在 New Relic 中添加 TiDB Cloud 仪表盘

    根据你的 New Relic 集成版本,操作步骤有所不同。

      在 New Relic 合并待处理的 PR 后,将会有新的 TiDB Cloud 仪表盘可用。在此之前,你可以通过以下步骤手动导入仪表盘:

      1. 准备新仪表盘的 JSON 文件。

        1. 这里下载模板 JSON 文件。

        2. 在 JSON 文件的第 4 行添加 "permissions": "PUBLIC_READ_WRITE",如下所示:

          { "name": "TiDB Cloud Dynamic Tracker", "description": null, "permissions": "PUBLIC_READ_WRITE", ... }
        3. 在 JSON 文件的所有 "accountIds": [] 字段中,添加你的 New Relic 账号 ID。

          例如:

          "accountIds": [ 1234567 ],
      2. 登录 New Relic,点击左侧导航栏的 Dashboards,然后点击右上角的 Import dashboard

      3. 在弹出的对话框中,将准备好的 JSON 文件内容全部粘贴到文本区域,然后点击 Import dashboard

      1. 登录 New Relic
      2. 点击 Add Data,搜索 TiDB Cloud,然后进入 TiDB Cloud Monitoring 页面。你也可以直接点击此链接访问该页面。
      3. 选择你的账号 ID,并在 New Relic 中创建仪表盘。

      查看预置仪表盘

      1. TiDB Cloud 控制台中,进入 Integrations 页面。

      2. New Relic 区域点击 Dashboard 链接,查看你的 TiDB 集群的预置仪表盘。

      3. 根据你的 New Relic 集成版本,执行以下操作之一:

        • 对于 New Relic integration (Preview),点击 TiDB Cloud Dynamic Tracker 查看新仪表盘。
        • 对于 New Relic integration (Beta),点击 TiDB Cloud Monitoring 查看旧版仪表盘。

      New Relic 可用指标

      New Relic 会跟踪你的 TiDB 集群的以下指标。

      指标名称指标类型标签描述
      tidb_cloud.db_database_timegaugesql_type: Select|Insert|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      每秒 TiDB 中所有 SQL 语句运行消耗的总时间,包括所有进程的 CPU 时间和非空闲等待时间。
      tidb_cloud.db_query_per_secondgaugetype: Select|Insert|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      所有 TiDB 实例每秒执行的 SQL 语句数量,按 SELECTINSERTUPDATE 等类型统计。
      tidb_cloud.db_average_query_durationgaugesql_type: Select|Insert|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      客户端网络请求发送到 TiDB 与 TiDB 执行后返回给客户端之间的耗时。
      tidb_cloud.db_failed_queriesgaugetype: executor:xxxx|parser:xxxx|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      每秒每个 TiDB 实例发生的 SQL 执行错误类型(如语法错误、主键冲突等)统计。
      tidb_cloud.db_total_connectiongaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      当前 TiDB 服务器的连接数。
      tidb_cloud.db_active_connectionsgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      活跃连接数。
      tidb_cloud.db_disconnectionsgaugeresult: ok|error|undetermined

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      断开连接的客户端数量。
      tidb_cloud.db_command_per_secondgaugetype: Query|StmtPrepare|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      TiDB 每秒处理的命令数,按命令执行结果的成功或失败分类。
      tidb_cloud.db_queries_using_plan_cache_opsgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      每秒使用 Plan Cache 的查询统计。执行计划缓存仅支持 prepared statement 命令。
      tidb_cloud.db_transaction_per_secondgaugetxn_mode: pessimistic|optimistic

      type: abort|commit|...

      cluster_name: <cluster name>

      instance: tidb-0|tidb-1…

      component: tidb
      每秒执行的事务数。
      tidb_cloud.node_storage_used_bytesgaugecluster_name: <cluster name>

      instance: tikv-0|tikv-1…|tiflash-0|tiflash-1…

      component: tikv|tiflash
      TiKV/TiFlash 节点的磁盘使用量(字节)。
      tidb_cloud.node_storage_capacity_bytesgaugecluster_name: <cluster name>

      instance: tikv-0|tikv-1…|tiflash-0|tiflash-1…

      component: tikv|tiflash
      TiKV/TiFlash 节点的磁盘容量(字节)。
      tidb_cloud.node_cpu_seconds_total (Beta only)countcluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点的 CPU 使用量。
      tidb_cloud.node_cpu_capacity_coresgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点的 CPU 核心数上限。
      tidb_cloud.node_memory_used_bytesgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点已用内存(字节)。
      tidb_cloud.node_memory_capacity_bytesgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点的内存容量(字节)。

      对于 New Relic integration (Preview),还支持以下额外指标:

      指标名称指标类型标签描述
      tidb_cloud.node_storage_available_bytesgaugeinstance: tidb-0\|tidb-1\|...

      component: tikv\|tiflash

      cluster_name: <cluster name>
      TiKV 或 TiFlash 节点可用磁盘空间(字节)。
      tidb_cloud.node_disk_read_latencygaugeinstance: tidb-0\|tidb-1\|...

      component: tikv\|tiflash

      cluster_name: <cluster name>

      device: nvme.*\|dm.*
      每个存储设备的读延迟(秒)。
      tidb_cloud.node_disk_write_latencygaugeinstance: tidb-0\|tidb-1\|...

      component: tikv\|tiflash

      cluster_name: <cluster name>

      device: nvme.*\|dm.*
      每个存储设备的写延迟(秒)。
      tidb_cloud.db_kv_request_durationgaugeinstance: tidb-0\|tidb-1\|...

      component: tikv

      cluster_name: <cluster name>

      type: BatchGet\|Commit\|Prewrite\|...
      按类型统计的 TiKV 请求耗时(秒)。
      tidb_cloud.db_component_uptimegaugeinstance: tidb-0\|tidb-1\|...

      component: tidb\|tikv\|tiflash

      cluster_name: <cluster name>
      TiDB 组件的运行时长(秒)。
      tidb_cloud.cdc_changefeed_latency (AKA cdc_changefeed_checkpoint_ts_lag)gaugechangefeed_id: <changefeed-id>

      cluster_name: <cluster name>
      changefeed owner 的 checkpoint timestamp 延迟(秒)。
      tidb_cloud.cdc_changefeed_resolved_ts_laggaugechangefeed_id: <changefeed-id>

      cluster_name: <cluster name>
      changefeed owner 的 resolved timestamp 延迟(秒)。
      tidb_cloud.cdc_changefeed_statusgaugechangefeed_id: <changefeed-id>

      cluster_name: <cluster name>
      Changefeed 状态:

      -1: Unknown

      0: Normal

      1: Warning

      2: Failed

      3: Stopped

      4: Finished

      6: Warning

      7: Other
      tidb_cloud.resource_manager_resource_unit_read_request_unitgaugecluster_name: <cluster name>

      resource_group: <group-name>
      Resource Manager 消耗的读请求单元(RU)。
      tidb_cloud.resource_manager_resource_unit_write_request_unitgaugecluster_name: <cluster name>

      resource_group: <group-name>
      Resource Manager 消耗的写请求单元(RU)。
      tidb_cloud.dm_task_stategaugeinstance: instance

      task: task

      cluster_name: <cluster name>
      数据迁移任务状态:

      0: Invalid

      1: New

      2: Running

      3: Paused

      4: Stopped

      5: Finished

      15: Error
      tidb_cloud.dm_syncer_replication_lag_bucketgaugeinstance: instance

      cluster_name: <cluster name>
      数据迁移的同步延迟(bucket)。
      tidb_cloud.dm_syncer_replication_lag_gaugegaugeinstance: instance

      task: task

      cluster_name: <cluster name>
      数据迁移的同步延迟(gauge)。
      tidb_cloud.dm_relay_read_error_countgaugeinstance: instance

      cluster_name: <cluster name>
      从主库读取 binlog 失败次数。
      tidb_cloud.node_memory_available_bytesgaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点可用内存(字节)。
      tidb_cloud.cdc_changefeed_replica_rowsgaugechangefeed_id: <changefeed-id>

      cluster_name: <cluster name>
      TiCDC 节点每秒写入下游的事件数。
      tidb_cloud.node_cpu_seconds_total_rategaugecluster_name: <cluster name>

      instance: tidb-0|tidb-1…|tikv-0…|tiflash-0…

      component: tidb|tikv|tiflash
      TiDB/TiKV/TiFlash 节点的 CPU 使用率。

      文档内容是否有帮助?