Skip to content

Commit

Permalink
Fix prometheus endpoint issue (tensorflow#786)
Browse files Browse the repository at this point in the history
This PR fixes prometheus endpoint issue where `%d` should be '%s'

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed Feb 13, 2020
1 parent 01c73c8 commit 609af2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tensorflow_io/core/python/ops/prometheus_dataset_ops.py
Expand Up @@ -39,7 +39,7 @@ def __init__(self,
if offset is not None:
metadata.append("offset=%d" % offset)
if endpoint is not None:
metadata.append("endpoint=%d" % endpoint)
metadata.append("endpoint=%s" % endpoint)
resource, metrics = golang_ops.io_prometheus_readable_init(
query, metadata)
# Construct spec in eager mode, and take spec from user in graph mode.
Expand Down
6 changes: 4 additions & 2 deletions tests/test_io_dataset_eager.py
Expand Up @@ -199,7 +199,8 @@ def fixture_prometheus():
offset = int(round(time.time() * 1000))
args = "coredns_dns_request_count_total"
def func(q):
v = tfio.experimental.IODataset.from_prometheus(q, 5, offset=offset)
v = tfio.experimental.IODataset.from_prometheus(
q, 5, offset=offset, endpoint="http://localhost:9090")
v = v.map(lambda timestamp, value: (
timestamp,
value['coredns']['localhost:9153']['coredns_dns_request_count_total']))
Expand Down Expand Up @@ -230,7 +231,8 @@ def func(q):
'up': tf.TensorSpec([], tf.float64),
},
},
})
},
endpoint="http://localhost:9090")
v = v.map(lambda _, value: (
value['coredns']['localhost:9153']['up'],
value['prometheus']['localhost:9090']['up']))
Expand Down

0 comments on commit 609af2f

Please sign in to comment.