metrics-endpoint-relation-created on every unit fail in cluster mode

Open
#112 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

Start with _on_metrics_endpoint_relation_created in src/charm.py and follow add_metrics_user in src/controlsocket.py, especially the APIError raised by _request_raw. Reproduce the metrics-endpoint integration in a three-node controller cluster and verify that repeated relation-created events do not leave the hook in an error state when the juju-metrics-r1 user already exists.

Written by the indexing model from the issue text.

Description

I have a juju controller 3 node cluster.

I have a alloy-vm charm which can integrate with the controller via its metrics-endpoint

When I relate it to my monitoring charm "alloy-vm" which is capable of scraping metrics the relation hook ends up in an error state.

juju switch admin/controller juju integrate controller:metrics-endpoint alloy-vm:metrics-endpoint

It ends up in this:

File "/var/lib/juju/agents/unit-controller-0/charm/venv/ops/framework.py", line 947, in _reemit custom_handler(event) File "/var/lib/juju/agents/unit-controller-0/charm/./src/charm.py", line 81, in _on_metrics_endpoint_relation_created self.control_socket.add_metrics_user(username, password) File "/var/lib/juju/agents/unit-controller-0/charm/src/controlsocket.py", line 133, in add_metrics_user resp = self._request( ^^^^^^^^^^^^^^ File "/var/lib/juju/agents/unit-controller-0/charm/src/controlsocket.py", line 80, in _request response = self._request_raw(method, path, query, headers, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/lib/juju/agents/unit-controller-0/charm/src/controlsocket.py", line 126, in _request_raw raise APIError(body, code, status, message) controlsocket.APIError: user "juju-metrics-r1" already exists unit-controller-0: 18:43:40 ERROR juju.worker.uniter.operation hook "metrics-endpoint-relation-created" (via hook dispatching script: dispatch) failed: exit status 1

Image
Dominant language
Python
Stars
3
Forks
21
Avg merge
2d 22h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from juju/juju-controller

All issues in juju/juju-controller

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.