Skip to content

Prometheus_client can be used on OS windows and python version higher 3.5? #228

Closed

Description

@drno-reg

Hello,

try to wrote prometheus_client
took simple code,

#!/usr/local/bin/python
# coding: utf-8

from prometheus_client import start_http_server, Summary
import random
import time

# Create a metric to track time spent and requests made.
REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')

# Decorate function with metric.
@REQUEST_TIME.time()
def process_request(t):
    """A dummy function that takes some time."""
    time.sleep(t)

if __name__ == '__main__':
    # Start up the server to expose the metrics.
    start_http_server(8000)
    # Generate some requests.
    while True:
        process_request(random.random())

tried to exceute on Windows Server 2008, with python 3.7 and returned error

Traceback (most recent call last):
  File "c:/Reposiroties/projects/um_open/templates/Test/Prometheus_Client.py", line 4, in <module>
    from prometheus_client import start_http_server, Summary
  File "C:\Software\Python37\lib\site-packages\prometheus_client\__init__.py", line 4, in <module>
    from . import exposition
  File "C:\Software\Python37\lib\site-packages\prometheus_client\exposition.py", line 31, in <module>
    PYTHON26_OR_OLDER = tuple(int(val) for val in sys.version.split()[0].split('.')) < (2, 7, 0)
  File "C:\Software\Python37\lib\site-packages\prometheus_client\exposition.py", line 31, in <genexpr>
    PYTHON26_OR_OLDER = tuple(int(val) for val in sys.version.split()[0].split('.')) < (2, 7, 0)
ValueError: invalid literal for int() with base 10: '0a2'

Prometheus_client can be used on OS windows and python version higher 3.5?

Activity

  1. brian-brazil commented on Dec 20, 2017

    @brian-brazil
    Contributor

    What exact version of Python are you using?

  2. drno-reg commented on Dec 20, 2017

    @drno-reg
    Author

    Python 3.7.0a2

  3. brian-brazil commented on Dec 20, 2017

    @brian-brazil
    Contributor

    That's #227 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions