Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request for influxdb #482

Merged
8 commits merged into from
Dec 1, 2017
Merged

Pull request for influxdb #482

8 commits merged into from
Dec 1, 2017

Conversation

jd
Copy link
Member

@jd jd commented Nov 14, 2017

api: add an InfluxDB API endpoint
api: rename refresh_timeout option to operation_timeout
cli: use --http-socket rather than --http for uwsgi

@jd
Copy link
Member Author

jd commented Nov 14, 2017

Pull-request updated, HEAD is now 0d8f2b7

@jd
Copy link
Member Author

jd commented Nov 15, 2017

Pull-request updated, HEAD is now 4f5e4d7

@jd
Copy link
Member Author

jd commented Nov 16, 2017

Pull-request updated, HEAD is now ad617be

@jd
Copy link
Member Author

jd commented Nov 16, 2017

Pull-request updated, HEAD is now 790ff33

@jd
Copy link
Member Author

jd commented Nov 16, 2017

Pull-request updated, HEAD is now 1c6405f

@jd
Copy link
Member Author

jd commented Nov 16, 2017

Pull-request updated, HEAD is now 31a2b7b

@staticmethod
@tenacity.retry(retry=tenacity.retry_if_exception_type(
(indexer.NoSuchResource, indexer.NamedMetricAlreadyExists)))
def get_or_create_resource_and_metrics(resource_type, creator, rid,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can share it with the one in Prometheus

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I can try to do that now that Prometheus is merged.

@@ -49,6 +49,20 @@ def setUp(self):
self.index = indexer.get_driver(self.conf)
self.index.upgrade(nocreate=True)
self.addCleanup(self._drop_database)
# NOTE(sileht): remove tables dynamically created by other tests
Copy link
Member

Choose a reason for hiding this comment

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

That may need to be rebased, mine have been merged.

Copy link
Member Author

Choose a reason for hiding this comment

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

ack

@jd
Copy link
Member Author

jd commented Nov 23, 2017

Pull-request updated, HEAD is now 53989ae

@jd
Copy link
Member Author

jd commented Nov 23, 2017

Pull-request updated, HEAD is now 439d1d3

1 similar comment
@jd
Copy link
Member Author

jd commented Nov 23, 2017

Pull-request updated, HEAD is now 439d1d3

@jd
Copy link
Member Author

jd commented Nov 27, 2017

Pull-request updated, HEAD is now aa33aee

chungg
chungg previously requested changes Nov 27, 2017
@@ -2055,6 +2057,7 @@ def __init__(self):
"capabilities": CapabilityController(),
"status": StatusController(),
"aggregates": agg_api.AggregatesController(),
"influxdb": influxdb.InfluxDBController(),
Copy link
Member

Choose a reason for hiding this comment

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

can we enable this on demand?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably, though we don't do that for Prometheus either. So what would be the usecase?

Copy link
Member

Choose a reason for hiding this comment

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

we do, it's only enabled if the right libs are there although we can't do the same here... i just don't want to load it unless explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

If I have snappy installed on my system for whatever reason then I cannot disable Prometheus support.
This isn't a correct response. :/

That being said, we need something more than just a switch IMHO, see #499. So I'd postponed any switch until we solve #499.

except pyparsing.ParseException:
api.abort(501, {"cause": "Not implemented error",
"detail": "q",
"reason": "Querying is not implemented"})
Copy link
Member

Choose a reason for hiding this comment

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

this error is confusing... i don't see how 'querying is not implemented', this is literally what the endpoint is. is it something 'unsupported' that will throw this?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't support InfluxDB query language. I changed to "query not implemented" to be more precise about the fact that this query is not implemented.
The only supported is CREATE DATABASE that's not what I'd call a query ;)

def _write_get_lines():
encoding = pecan.request.headers.get('Transfer-Encoding', "").lower()
if encoding == "chunked":
if uwsgi is None:
Copy link
Member

Choose a reason for hiding this comment

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

how usable is this without chunked? if it isn't, i don't think we should support this especially since we're checking this constantly.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's completely usable without chunked encoding. That's what the tests do.

But real InfluxDB client sends chunked encoding.

Copy link
Member

Choose a reason for hiding this comment

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

so unchunked is only for tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

In real life, really likely, until someone starts to talk InfluxDB to Gnocchi in regular encoding (but I don't think InfluxDB does that?)

# If this function raises ResourceAlreadyExists it means
# the resource might already exist as another type, we
# can't continue.
LOG.error("Unable to get resource `%s' for InfluxDB, "
Copy link
Member

Choose a reason for hiding this comment

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

s/get/create/

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

$.creator: admin

- name: check metric created
GET: /v1/resource/influxdbtest/foobar/metric/mymetric.field@mytag=myvalue
Copy link
Member

Choose a reason for hiding this comment

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

this should assert something.

Copy link
Member Author

Choose a reason for hiding this comment

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

it does, it asserts there's no error being returned (i.e. no 404).

it does not check any content since it's not the purpose of this test. It's not testing the format, it's testing the metric creation.

Copy link
Member

Choose a reason for hiding this comment

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

word. didn't realise gabbi would auto fail for these cases. i'd prefer it be explicit and we validate more than just 'it didn't explode' but your call.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah it's always a trade-off: asserting 200 for example would break if we ever change the code to be 202 for example, whereas here we don't really care.

Though I agree in this case there's 0% chance we ever change from 200 :)

$.creator: admin

- name: check metric created different tag resource id
GET: /v1/resource/influxdbtest/myvalue/metric/mymetric.field@host=foobar
Copy link
Member

Choose a reason for hiding this comment

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

assert something

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

GET: /v1/resource/influxdbtest/myvalue/metric/mymetric.field@host=foobar

- name: check metric created different tag resource id and slash replaced
GET: /v1/resource/influxdbtest/myvalue/metric/cpu.field@path=_foobar
Copy link
Member

Choose a reason for hiding this comment

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

assert something

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

@jd
Copy link
Member Author

jd commented Nov 27, 2017

Pull-request updated, HEAD is now 8b0b52f

chungg
chungg previously approved these changes Nov 27, 2017
@jd
Copy link
Member Author

jd commented Nov 27, 2017

Fix test after 'Query' word change

Using --http enables the HTTP router – which is not used here. That router
prevents the chunked tranfer encoding to work.
…lass

This is going to be used by other code.
This timeout is going to be used as a more general timeout for operations that
the API needs to do and that block for a long time.
This provides a new InfluxDB-compatible endpoint to write data to Gnocchi at
`/v1/influxdb'.
@jd
Copy link
Member Author

jd commented Nov 27, 2017

Pull-request updated, HEAD is now b4264ae

Copy link
Member

@sileht sileht left a comment

Choose a reason for hiding this comment

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

You finally not sharing get_or_create_resource_and_metrics() with prometheus ?

@jd
Copy link
Member Author

jd commented Dec 1, 2017

You finally not sharing get_or_create_resource_and_metrics() with prometheus ?

@sileht of course it is shared. did I miss something?

@ghost ghost merged commit 3a51b86 into gnocchixyz:master Dec 1, 2017
@sileht
Copy link
Member

sileht commented Dec 1, 2017

@jd, no it's OK I have misread

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants