Prometheus Remote写信给AWS API网关

发布于 2025-02-14 00:03:25 字数 1266 浏览 1 评论 0原文

目前,我正在尝试使用Prometheus配置远程处理,以将数据发送到AWS中的API网关。

我知道Prometheus可以直接写入许多不同的数据源,例如InfluxDB或其他数据库,但是由于特定的原因,我不会进入API网关端点。当我配置了端点以接受二进制数据类型时,例如application/x-protobuf写入请求的标题我仍然会返回以下错误 to my prometheus agent:

ts=2022-07-08T18:56:25.014Z caller=dedupe.go:112 component=remote level=error remote_name=69e124 url=https://xxxxxx.execute-api.us-east-1.amazonaws.com/ msg="non-recoverable error while sending metadata" count=291 err="server returned HTTP status 415 Unsupported Media Type: "
ts=2022-07-08T18:56:25.995Z caller=dedupe.go:112 component=remote level=error remote_name=69e124 url=https://xxxxxx.execute-api.us-east-1.amazonaws.com/ msg="non-recoverable error" count=348 exemplarCount=0 err="server returned HTTP status 415 Unsupported Media Type: "

Here is how I configured API gateway: Screen shot of API Gateway console configuration for binary datatypes

Is there something obvious I am missing?有更好的方法可以解决这个问题吗?我对如何进一步调试我有些迷失。

如果重要的话,Prometheus代理在EKS集群中,我可以发布其配置,如果有帮助

Currently I'm trying to configure remote-write with Prometheus to send data to an API gateway in AWS.

I know that prometheus can write directly to many different data sources, like influxdb or other databases, however for specific reasons I won't go into it needs to go to an API gateway endpoint. When I've configured the endpoint to accept binary datatypes like the application/x-protobuf sent in the headers of the write request I still get the following error returned to my prometheus agent:

ts=2022-07-08T18:56:25.014Z caller=dedupe.go:112 component=remote level=error remote_name=69e124 url=https://xxxxxx.execute-api.us-east-1.amazonaws.com/ msg="non-recoverable error while sending metadata" count=291 err="server returned HTTP status 415 Unsupported Media Type: "
ts=2022-07-08T18:56:25.995Z caller=dedupe.go:112 component=remote level=error remote_name=69e124 url=https://xxxxxx.execute-api.us-east-1.amazonaws.com/ msg="non-recoverable error" count=348 exemplarCount=0 err="server returned HTTP status 415 Unsupported Media Type: "

Here is how I configured API gateway:
Screen shot of API Gateway console configuration for binary datatypes

Is there something obvious I am missing? Is there a better way I can troubleshoot this? I'm a little lost on how to debug this further.

If it matters, the prometheus agent is inside of an EKS cluster, I can post its configuration if that would be helpful

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贩梦商人 2025-02-21 00:03:25

我能够确认我正在写信给终点,并与AWS支持了他们的特定问题。它不在Prometheus中,其AWS API网关及其后端集成配置问题。

我击中的终点看起来如下
前任:
https://xxxxx.execute-api.us-east-1.amazonaws .com/端点确实收到了信息。我最终问了AWS,并进一步介绍了它。显然,您需要执行以下操作:

从AWS支持中:

除了为API添加二进制媒体类型外,如果后端期望二进制数据负载,我们还需要配置内容处理设置以转换为二进制。即使内容类型标头不匹配,这也会明确将其设置为二进制。

因此,我需要将其设置在我尚未做的Lambda中。相反,我所做的工作是旋转基于Express的API在K8S群集中运行,并充当Prometheus请求的中间变压器,因此Express Application将Protobuf带入Protobuf并将其转换为JSON,然后再将其转发为API要处理。

I was able to confirm that I was writing to an endpoint and I reached out to AWS support for their specific issue. Its not in prometheus its an AWS api gateway and its backend integration configuration problem.

The endpoint I'm hitting looks like the following
EX:
https://xxxxx.execute-api.us-east-1.amazonaws.com/ and the endpoint does recieve the information. I ended up asking AWS and going a bit further into it. Apparently you need to do the following:

From AWS support:

In addition to adding Binary media type for the API, if the backend is expecting a Binary data load then we need to configure Content Handling set to Convert to Binary. This will explicitly set it to binary even if content type header doesn't match.

So I needed to set that in the lambda, which I have yet to do. What I did instead as a work around was spin up an express based API running in a k8s cluster, and act as my middle transformer for the prometheus request, so the express application takes the protobuf and converts it to JSON before forwarding it on to the API to be processed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文