Google 数据流作业监视器

Google Dataflow job monitor

我正在编写一个应用程序来监控和查看 Google 数据流作业。

为了获取有关 google 数据流作业的元数据,我正在探索此处列出的 REST API:

https://developers.google.com/apis-explorer/#search/dataflow/dataflow/v1b3/

我想知道是否有 API 可以执行以下操作:

1) 如果我们提供工作 ID 列表,则获取工作详细信息(有一个 API 用于一个单独的工作 ID,但我想要相同的 ID 列表)

2)根据工作 name.Or 搜索或过滤工作,过滤工作状态以外的任何其他条件的工作。

3)获取与数据流作业关联的日志消息

4)获取"all"个职位的记录,从时间开始。当前的 APIs 似乎只提供最近 30 天的工作记录。

如有任何帮助,我们将不胜感激。谢谢

在我们的案例中,我们通过跟踪作业阶段并使用 schedulers/cron 作业在一个文件中报告 运行 作业的详细信息来实现此类功能。这个带有 1 个存储桶的文件由我们的工作监视,它只为我们的应用程序提供所有状态

有关 Dataflow REST API 的其他文档位于:https://cloud.google.com/dataflow/docs/reference/rest/

分别解决您的每个问题:

1) Get the job details if we provide a list of job Ids (there is an API for one individual job ID, but I wanted the same for a list of Ids)

不,作业列表没有批处理方法。您需要使用 projects.jobs.get.

单独查询它们

2)Search or filter jobs on the basis of job name.Or for that matter, filtering of jobs of any other criteria apart from the job state.

当前唯一可用的其他过滤器是位置。

3)Get log messages associated with a dataflow job

Dataflow 中有两种类型的日志消息:

"Job Logs" 由 Dataflow 服务生成,提供有关整体作业执行的高级信息。这些可以通过 projects.jobs.messages.list API 获得。

管道中还有"Worker Logs" SDK 编写和用户代码运行。这些是在与管道关联的分布式 VM 上生成的,并通过包含在您的过滤器中被摄取到 Stackdriver. They can be queried via the Stackdriver Logging entries.list API:

resource.type="dataflow_step"
resource.labels.job_id="<YOUR JOB ID>"

4)Get the records of "all" jobs, from the beginning of time. The current APIs seem to give records only of jobs in the last 30 days.

数据流作业仅由服务保留 30 天。旧作业已删除,因此在 UI 或 API 后不可用。