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

Fresh db cannot be configured #47

Open
tilsche opened this issue May 11, 2023 · 2 comments
Open

Fresh db cannot be configured #47

tilsche opened this issue May 11, 2023 · 2 comments

Comments

@tilsche
Copy link

tilsche commented May 11, 2023

Stuff like this

[2023-05-11 11:23:45 +0000] [7] [ERROR] Error handling request
Traceback (most recent call last):
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 167, in wrapper
    return await func(endpoint, *args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/remote.py", line 363, in _put
    _, json = await self._database._remote._put(self.endpoint, data, params)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/remote.py", line 96, in _put
    return await self._request("PUT", path, json=data, params=params)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/remote.py", line 144, in _request
    resp.raise_for_status()
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 409, message='Conflict', url=URL('https://couchdb.metricq.zih.tu-dresden.de/config/db-barnard')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp_session/__init__.py", line 199, in factory
    response = await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/api/views/source.py", line 401, in save_source_raw_config
    await configurator.set_config(source_id, request_data)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/configurator.py", line 285, in set_config
    await config.save()
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/document.py", line 138, in save
    data = await self._put(self._data)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 167, in wrapper
    return await func(endpoint, *args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 167, in wrapper
    return await func(endpoint, *args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 167, in wrapper
    return await func(endpoint, *args, **kwargs)
  [Previous line repeated 1 more time]
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 170, in wrapper
    raise_for_endpoint(endpoint, message, exception, exception_type)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocouch/exception.py", line 154, in raise_for_endpoint
    raise exception_type(message.format(**message_input)) from exception
aiocouch.exception.ConflictError: 'Document with the specified ID (db-barnard) already exists or specified revision None is not latest for target document'
[2023-05-11 11:24:45 +0000] [7] [ERROR] Error handling request
Traceback (most recent call last):
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiohttp_session/__init__.py", line 199, in factory
    response = await handler(request)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/api/views/client.py", line 61, in get_clients_dependencies
    return json_response(data=await configurator.fetch_dependency_wheel())
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/configurator.py", line 63, in wrapped
    result = await func(*args)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/configurator.py", line 191, in fetch_dependency_wheel
    for consumer in await self.fetch_consumers(metric):
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/configurator.py", line 147, in fetch_consumers
    bindings = await self.rabbitmq_bindings()
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocache/decorators.py", line 103, in wrapper
    return await self.decorator(f, *args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocache/decorators.py", line 118, in decorator
    result = await f(*args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/configurator.py", line 128, in rabbitmq_bindings
    return await rabbitmq.fetch_bindings(
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/rabbitmq.py", line 101, in fetch_bindings
    await bindings._fetch()
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/rabbitmq.py", line 88, in _fetch
    consumer = await self._guess_token_from_queue_name(
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocache/decorators.py", line 103, in wrapper
    return await self.decorator(f, *args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/aiocache/decorators.py", line 118, in decorator
    result = await f(*args, **kwargs)
  File "/home/metricq/.local/lib/python3.10/site-packages/metricq_wizard_backend/metricq/rabbitmq.py", line 54, in _guess_token_from_queue_name
    assert queue.endswith("-data")
AssertionError
@bmario
Copy link
Member

bmario commented May 23, 2023

The assertion came from your self-made sink queue. Fixed that in 2fd0688

@bmario
Copy link
Member

bmario commented May 25, 2023

Please give a hint on how to reproduce.

I ended up with this error instead:

Error handling request
Traceback (most recent call last):
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiohttp_devtools/runserver/serve.py", line 76, in static_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiohttp_session/__init__.py", line 199, in factory
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/metricq_wizard_backend/api/views/metric.py", line 189, in post_metric_database
    await client.update_metric_database_config(database_configs.database_configurations)
  File "/home/mario/metricq-wizard-backend/metricq_wizard_backend/metricq/configurator.py", line 319, in update_metric_database_config
    in config["metrics"]
       ~~~~~~^^^^^^^^^^^
  File "/home/mario/metricq-wizard-backend/venv/lib/python3.11/site-packages/aiocouch/document.py", line 247, in __getitem__
    return self._data[key]
           ~~~~~~~~~~^^^^^
KeyError: 'metrics'

While doing this:

  1. I added a new client as db-hta-test.
  2. loaded a source
  3. selected a not historic metric
  4. I tried to add that to the new database

What happens is that the config is empty, but the code assumes it's not.

We can now either prevent a db with an invalid config is eligible as a target, which is confusing for users as to why it's not showing up. Or we prevent users from creating invalid db configs. Ideally, we had something that notifies users of the problem in a way unrelated to either process. I'd love to see a general dashboard able to list problems.

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

No branches or pull requests

2 participants