Skip to content

Conversation

@yongtang
Copy link
Member

@yongtang yongtang commented Jun 2, 2019

This fix adds prometheus dataset support, with prometheus library in golang.

This fix fixes #246.

Signed-off-by: Yong Tang [email protected]

@yongtang yongtang force-pushed the prometheus branch 6 times, most recently from 4e1c11a to 87f775d Compare June 3, 2019 12:53
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""PrometheusInput."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be PrometheusDataset

"""Create a Prometheus Reader.

Args:
filename: A `tf.string` tensor containing one or more filenames.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs for the other args

import tensorflow_io.prometheus as prometheus_io # pylint: disable=wrong-import-position

if sys.platform == "darwin":
pytest.skip("pubsub is not supported on macOS yet", allow_module_level=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary pubsub reference here

# License for the specific language governing permissions and limitations under
# the License.
# ==============================================================================
"""Tests for Prometheus Input."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input -> Dataset

output_types=self.output_types,
output_shapes=self.output_shapes)

@property
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we implement all future datasets based on 2.0 tf.data.Dataset?

@yongtang yongtang force-pushed the prometheus branch 3 times, most recently from e0d858e to 50a5d9e Compare June 9, 2019 20:27
@yongtang yongtang force-pushed the prometheus branch 2 times, most recently from f24c187 to d5aac20 Compare June 17, 2019 05:04
This fix adds prometheus dataset support, with prometheus
library in golang.

Signed-off-by: Yong Tang <[email protected]>
@yongtang
Copy link
Member Author

@BryanCutler @terrytangyuan The PR has been updated and now all tests passed.

There are several motivations to have a prometheus as data input.

  1. Prometheus is widely used in container/devops ecosystems and is often deployed as part of a Kubernetes cluster. Having a prometheus data input support will help tensorflow-io's integration with cloud-native/devops/kubernetes ecosystem.
  2. In this PR the golang client of prometheus is used by purpose:
    a. While there is a prometheus C++ client available, it is not officially supported.
    b. C++ language has a learning curve. Nowadays the available C++ developer community is much smaller and this is becoming a disadvantage for tensorflow-io to have more contributors.
    c. Golang is a language on the rise, especially in devops community, largely due to projects such as kubernetes/docker/etc. Hopefully embedding Golang into tensorflow-io allows more contributors to get involved.
  3. The usage of Golang is done though Bazel and no golang installation is needed. This is to reduce the requirement for overall tensorflow-io developers. While golang naturally has a build system (go build) everyone use, it will be troublesome for every tensorflow-io developers to install and go (when they may only be interested in a couple of Dataset ops in python).

The test case is wired up with CoreDNS as a example server with Prometheus scraping the metrics from CoreDNS. tensorflow-io connects to Prometheus' endpoint to get metrics and delivers as tf.data pipeline. Should be possible to work with tf.keras directly for training or inference.

Also cc @ihac in case you are interested in Prometheus+CoreDNS.

@BryanCutler BryanCutler merged commit 3c030cb into tensorflow:master Jun 17, 2019
@yongtang yongtang deleted the prometheus branch June 17, 2019 20:40
i-ony pushed a commit to i-ony/io that referenced this pull request Feb 8, 2021
This fix adds prometheus dataset support, with prometheus
library in golang.

Signed-off-by: Yong Tang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add prometheus support for tensorflow-io?

3 participants