Skip to content

Commit 030235e

Browse files
authored
Merge pull request #3 from canonical/DPE-6101-add-charm
[DPE-6101] Add first batch of the charm
2 parents 3f631ff + 971c92f commit 030235e

31 files changed

+3024
-30
lines changed

CONTRIBUTING.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing
2+
3+
To make contributions to this charm, you'll need a working [development setup](https://juju.is/docs/sdk/dev-setup).
4+
5+
You can create an environment for development with `tox`:
6+
7+
```shell
8+
tox devenv -e integration
9+
source venv/bin/activate
10+
```
11+
12+
## Testing
13+
14+
This project uses `tox` for managing test environments. There are some pre-configured environments
15+
that can be used for linting and formatting code when you're preparing contributions to the charm:
16+
17+
```shell
18+
tox run -e format # update your code according to linting rules
19+
tox run -e lint # code style
20+
tox run -e static # static type checking
21+
tox run -e unit # unit tests
22+
tox run -e integration # integration tests
23+
tox # runs 'format', 'lint', 'static', and 'unit' environments
24+
```
25+
26+
## Build the charm
27+
28+
Build the charm in this git repository using:
29+
30+
```shell
31+
charmcraftcache pack
32+
```
33+
34+
<!-- You may want to include any contribution/style guidelines in this document>

LICENSE

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/
@@ -186,7 +187,7 @@
186187
same "printed page" as the copyright notice for easier
187188
identification within third-party archives.
188189

189-
Copyright [yyyy] [name of copyright owner]
190+
Copyright 2024 Canonical Ltd.
190191

191192
Licensed under the Apache License, Version 2.0 (the "License");
192193
you may not use this file except in compliance with the License.

README.md

-2
This file was deleted.

actions.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
prepare:
2+
description: |
3+
Prepares the workload.
4+
5+
run:
6+
description: |
7+
Kickstarts the benchmark service in this server.
8+
9+
stop:
10+
description: |
11+
Stops the benchmark service in this server.
12+
13+
get-summary:
14+
description: |
15+
Allow for the test result to be obtained in cases when COS or Upload are not needed.
16+
The benchmark result collection happens anyways and is be stored in a folder within the unit.
17+
It reports in the output (either table or json) where the user can find the collection tarball
18+
in its own filesystem in addition to basic test results
19+
(e.g. time elapsed, queries executed, queries per second, etc).
20+
parameters:
21+
output:
22+
description: |
23+
The output format of the summary. It can be either a table or a json.
24+
type: string
25+
enum: [table, json]
26+
27+
cleanup:
28+
description: |
29+
Cleans up the workload from the application and unsets all the prepared configuration.

charmcraft.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2024 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
4+
type: charm
5+
6+
bases:
7+
- build-on:
8+
- name: "ubuntu"
9+
channel: "22.04"
10+
run-on:
11+
- name: "ubuntu"
12+
channel: "22.04"
13+
14+
parts:
15+
files:
16+
plugin: dump
17+
source: .
18+
override-build: |
19+
# Ship the charm contents
20+
curl -sSL https://code.launchpad.net/~pguimaraes/openmessaging-benchmark/+git/openmessaging-benchmark/+artifact/280249/+files/openmessaging-benchmark-0.0.1-ubuntu0-20241119152607-linux-x64.tar.gz | tar -zxvf -
21+
mv openmessaging-benchmark-0.0.1-SNAPSHOT/ openmessaging-benchmark/
22+
craftctl default
23+
prime:
24+
- openmessaging-benchmark
25+
charm:
26+
override-build: |
27+
rustup default stable
28+
29+
# Convert subset of poetry.lock to requirements.txt
30+
curl -sSL https://install.python-poetry.org | python3 -
31+
/root/.local/bin/poetry self add poetry-plugin-export
32+
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
33+
34+
craftctl default
35+
charm-strict-dependencies: true
36+
charm-requirements: [requirements.txt]
37+
build-snaps:
38+
- rustup
39+
build-packages:
40+
- libffi-dev
41+
- libssl-dev
42+
- pkg-config

config.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
options:
2+
test_name:
3+
default: ""
4+
type: string
5+
description: |
6+
Used to identify the test. MUST NOT be empty.
7+
It is the string that represents the given test (e.g. "aws_c6a.xlarge_3nodes_<WORKLOAD>").
8+
It is used by the collector to put the final data on the right place.
9+
parallel_processes:
10+
default: 2
11+
type: int
12+
description: |
13+
Number of parallel process managed by the benchmark tool. Minimum is 2.
14+
threads:
15+
default: 1
16+
type: int
17+
description: |
18+
Number of concurrent tasks within a given process.
19+
The best way to understand this concept is to imagine it
20+
as python coroutines running concurrently within the same process.
21+
duration:
22+
default: 0
23+
type: int
24+
description: |
25+
Time in seconds to run the benchmark, 0 means indefinitely.
26+
run_count:
27+
default: 0
28+
type: int
29+
description: |
30+
Number of counts to run, 0 means indefinitely.
31+
If both duration and run_count are set, duration takes precedence.
32+
workload_name:
33+
default: "default"
34+
type: string
35+
description: |
36+
The name of the workload to be prepared and used.
37+
override_access_hostname:
38+
default: ""
39+
type: string
40+
description: |
41+
Overrides the default relation endpoint shared via client relation,
42+
e.g. if we have a VIP in front of the databases and we want to test it through VIP instead of the relation's default value.
43+
report_interval:
44+
default: 1
45+
type: int
46+
description: |
47+
Int, number of seconds we should periodically report interval
48+
workload_profile:
49+
default: "default"
50+
type: string
51+
description: |
52+
The workload profile to be used.

icon.svg

+40
Loading

metadata.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2024 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
name: kafka-benchmark
4+
display-name: Charmed Kafka Benchmark
5+
6+
summary: Generates load against your workload and collect performance metrics to Prometheus.
7+
description: |
8+
Run this charm to connect with a kafka deployment and test the performance or generate a load against the cluster.
9+
10+
# TODO: Update
11+
# docs: https://discourse.charmhub.io/t/charmed-kafka-benchmark-documentation-home/13945
12+
source: https://github.com/canonical/kafka-benchmark-operator
13+
issues: https://github.com/canonical/kafka-benchmark-operator/issues
14+
website: https://charmhub.io/kafka-benchmark
15+
maintainers:
16+
- Canonical Data Platform <[email protected]>
17+
18+
peers:
19+
benchmark-peer:
20+
interface: benchmark_peers
21+
22+
provides:
23+
cos-agent:
24+
interface: cos_agent
25+
limit: 1
26+
27+
requires:
28+
kafka:
29+
interface: kafka_client
30+
limit: 1

0 commit comments

Comments
 (0)