openobserve-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ name: Publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "[0-9]+.[0-9]+.[0-9]+"
8
+
9
+ jobs:
10
+ publish:
11
+ name: Release to GitHub and PyPI
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write # the GitHub release
15
+ id-token: write # PyPI trusted publishing, so there is no token to store
16
+
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+
20
+ - uses: astral-sh/setup-uv@v5
21
+ with:
22
+ python-version: "3.13"
23
+
24
+ - name: Build Package
25
+ run: uv build
26
+
27
+ - name: Publish Release Notes
28
+ uses: softprops/action-gh-release@v2
29
+ with:
30
+ files: |
31
+ ./dist/*.whl
32
+ ./dist/*.tar.gz
33
+ generate_release_notes: true
34
+
35
+ - name: Publish Distribution Package to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,45 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+
11
+ lint:
12
+ name: Run pre-commit hooks
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.13"
21
+
22
+ - run: python -m pip install pre-commit
23
+
24
+ - run: pre-commit run -a --show-diff-on-failure
25
+
26
+ test:
27
+ name: Run Unit Tests
28
+ needs: [lint]
29
+ runs-on: ubuntu-latest
30
+
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ python-version: ["3.11", "3.12", "3.13"]
35
+
36
+ steps:
37
+ - uses: actions/checkout@v6
38
+
39
+ - uses: astral-sh/setup-uv@v5
40
+ with:
41
+ python-version: ${{ matrix.python-version }}
42
+
43
+ - run: uv sync
44
+
45
+ - run: uv run pytest
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
@@ -0,0 +1,39 @@
1
+ default_install_hook_types:
2
+ - pre-commit
3
+ - commit-msg
4
+
5
+ default_stages:
6
+ - pre-commit
7
+
8
+ repos:
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v6.0.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ args: ["--allow-multiple-documents"] # the deploy manifest is a bundle
16
+ - id: check-toml
17
+ - id: detect-private-key
18
+
19
+ - repo: https://github.com/astral-sh/ruff-pre-commit
20
+ rev: v0.14.3
21
+ hooks:
22
+ - id: ruff-format
23
+ - id: ruff-check
24
+ args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
25
+
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v1.18.2
28
+ hooks:
29
+ - id: mypy
30
+ args: ["--ignore-missing-imports"]
31
+ additional_dependencies:
32
+ - httpx
33
+ - pytest
34
+
35
+ - repo: https://github.com/compilerla/conventional-pre-commit
36
+ rev: v4.3.0
37
+ hooks:
38
+ - id: conventional-pre-commit
39
+ stages: [commit-msg]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Skip Pay s.r.o.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.5
2
+ Name: openobserve-cli
3
+ Version: 0.1.0
4
+ Summary: CLI for the OpenObserve HTTP API
5
+ Project-URL: Homepage, https://github.com/paveldedik/oo-cli
6
+ Project-URL: Repository, https://github.com/paveldedik/oo-cli
7
+ Project-URL: Issues, https://github.com/paveldedik/oo-cli/issues
8
+ Author-email: Pavel Dedík <dedikx@gmail.com>
9
+ Maintainer-email: Pavel Dedík <dedikx@gmail.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: cli,logs,metrics,observability,openobserve,traces
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Topic :: System :: Monitoring
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: httpx>=0.27
22
+ Description-Content-Type: text/markdown
23
+
24
+ # oo
25
+
26
+ A small CLI for the OpenObserve HTTP API. Commands are a transcription of the API rather
27
+ than a model of it: `oo get dashboards` is `GET /api/{org}/dashboards`, and anything the
28
+ CLI does not know about is still reachable with `oo api`.
29
+
30
+ ```bash
31
+ oo get dashboards
32
+ oo get alerts --folder default # GET /api/v2/{org}/alerts?folder=default
33
+ oo get streams/app_logs
34
+ oo post alerts -f alert.json
35
+ oo put dashboards/0194f0e1 -d @- < dashboard.json
36
+ oo delete alerts/7
37
+
38
+ oo search --sql "select * from default limit 10" --from -30m
39
+ oo api GET /api/default/prometheus/api/v1/query --query "up"
40
+ ```
41
+
42
+ Any `--name value` or `--name=value` the CLI does not define becomes a query parameter.
43
+ `-d` takes a literal body, `@file` or `@-` for stdin; `-f file` is shorthand for `-d @file`.
44
+ Output is pretty-printed JSON on stdout, errors on stderr, exit code 1 on HTTP >= 400 and
45
+ 2 on a bad command.
46
+
47
+ Times accept `now`, an offset (`-15m`, `-2h`, `-7d`), an epoch timestamp in seconds,
48
+ milliseconds or microseconds, or an ISO 8601 datetime (local time when it carries no zone).
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ uv tool install openobserve-cli # installs the `oo` command
54
+ uvx openobserve-cli get streams # or run it without installing anything
55
+ ```
56
+
57
+ The command is `oo`; `openobserve-cli` is the same command under the distribution's
58
+ name, which is what makes the `uvx` one-liner work. From a checkout: `uv sync` and
59
+ then `uv run oo --help`.
60
+
61
+ ## Configuration
62
+
63
+ Everything comes from the environment. Nothing is required: with no variables set the
64
+ CLI talks to `http://localhost:5080` as an anonymous user, which is what a port-forward
65
+ to a local OpenObserve looks like.
66
+
67
+ | Variable | Required | Default | Meaning |
68
+ |---------------------------|---------------------------------|-------------------------|-----------------------------------------------|
69
+ | `OO_ENDPOINT` | optional | `http://localhost:5080` | base URL |
70
+ | `OO_ORG` | optional | `default` | organization |
71
+ | `OO_TOKEN` | to reach anything but `/healthz`| — | base64 of `email:token`, sent as basic auth |
72
+ | `OO_USER` / `OO_PASSWORD` | instead of `OO_TOKEN` | — | the same credential spelled out |
73
+ | `OO_COOKIE` | when a gateway guards the host | — | `Cookie` header, sent verbatim |
74
+ | `OO_TIMEOUT` | optional | `60` | request timeout in seconds |
75
+
76
+ `--endpoint`, `--org` and `--timeout` override the corresponding variable.
77
+
78
+ ## When something authenticates in front of OpenObserve
79
+
80
+ Plenty of deployments put OpenObserve behind a gateway that authenticates users itself:
81
+ an AWS ALB with an `authenticate-oidc` action, oauth2-proxy, an identity-aware proxy.
82
+ Such a gateway takes nothing but its own session cookie, which it issues to a browser
83
+ at the end of an interactive login — no API token gets past it, and a CLI cannot run
84
+ that flow on its own.
85
+
86
+ So hand it the cookie your browser already has. In devtools, Network tab, take the
87
+ `Cookie` header off any request to that host (or Application, Cookies) and:
88
+
89
+ ```bash
90
+ export OO_COOKIE="AWSELBAuthSessionCookie-0=...; AWSELBAuthSessionCookie-1=..."
91
+ ```
92
+
93
+ It is sent verbatim, so any gateway's cookie works, whatever it calls it. A request
94
+ that hits the gateway without one says so instead of failing on a page of HTML. The
95
+ cookie expires on the gateway's schedule — an ALB session lasts 7 days by default.
96
+
97
+ The gateway is orthogonal to OpenObserve's own authentication: the cookie gets you
98
+ through the door, `OO_TOKEN` still identifies you to OpenObserve.
99
+
100
+ ## v1 and v2
101
+
102
+ Where an endpoint exists in both versions, v2 is used; there is no version switch. The CLI
103
+ reads the instance's own OpenAPI document (`/api-doc/openapi.json`) to decide, so it follows
104
+ whatever is deployed. The document is cached per endpoint under `~/.cache/oo-cli` for a week.
105
+
106
+ ```bash
107
+ oo spec paths alerts # list endpoints and their methods
108
+ oo spec refresh # refetch after an OpenObserve upgrade
109
+ ```
110
+
111
+ Without a reachable spec the CLI falls back to v1, except for `alerts`, `folders` and
112
+ `reports`, the three resources that have a v2 in OpenObserve 0.91.
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ uv sync
118
+ uv run pytest
119
+ pre-commit install # ruff, mypy and conventional commit messages
120
+ ```
@@ -0,0 +1,97 @@
1
+ # oo
2
+
3
+ A small CLI for the OpenObserve HTTP API. Commands are a transcription of the API rather
4
+ than a model of it: `oo get dashboards` is `GET /api/{org}/dashboards`, and anything the
5
+ CLI does not know about is still reachable with `oo api`.
6
+
7
+ ```bash
8
+ oo get dashboards
9
+ oo get alerts --folder default # GET /api/v2/{org}/alerts?folder=default
10
+ oo get streams/app_logs
11
+ oo post alerts -f alert.json
12
+ oo put dashboards/0194f0e1 -d @- < dashboard.json
13
+ oo delete alerts/7
14
+
15
+ oo search --sql "select * from default limit 10" --from -30m
16
+ oo api GET /api/default/prometheus/api/v1/query --query "up"
17
+ ```
18
+
19
+ Any `--name value` or `--name=value` the CLI does not define becomes a query parameter.
20
+ `-d` takes a literal body, `@file` or `@-` for stdin; `-f file` is shorthand for `-d @file`.
21
+ Output is pretty-printed JSON on stdout, errors on stderr, exit code 1 on HTTP >= 400 and
22
+ 2 on a bad command.
23
+
24
+ Times accept `now`, an offset (`-15m`, `-2h`, `-7d`), an epoch timestamp in seconds,
25
+ milliseconds or microseconds, or an ISO 8601 datetime (local time when it carries no zone).
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ uv tool install openobserve-cli # installs the `oo` command
31
+ uvx openobserve-cli get streams # or run it without installing anything
32
+ ```
33
+
34
+ The command is `oo`; `openobserve-cli` is the same command under the distribution's
35
+ name, which is what makes the `uvx` one-liner work. From a checkout: `uv sync` and
36
+ then `uv run oo --help`.
37
+
38
+ ## Configuration
39
+
40
+ Everything comes from the environment. Nothing is required: with no variables set the
41
+ CLI talks to `http://localhost:5080` as an anonymous user, which is what a port-forward
42
+ to a local OpenObserve looks like.
43
+
44
+ | Variable | Required | Default | Meaning |
45
+ |---------------------------|---------------------------------|-------------------------|-----------------------------------------------|
46
+ | `OO_ENDPOINT` | optional | `http://localhost:5080` | base URL |
47
+ | `OO_ORG` | optional | `default` | organization |
48
+ | `OO_TOKEN` | to reach anything but `/healthz`| — | base64 of `email:token`, sent as basic auth |
49
+ | `OO_USER` / `OO_PASSWORD` | instead of `OO_TOKEN` | — | the same credential spelled out |
50
+ | `OO_COOKIE` | when a gateway guards the host | — | `Cookie` header, sent verbatim |
51
+ | `OO_TIMEOUT` | optional | `60` | request timeout in seconds |
52
+
53
+ `--endpoint`, `--org` and `--timeout` override the corresponding variable.
54
+
55
+ ## When something authenticates in front of OpenObserve
56
+
57
+ Plenty of deployments put OpenObserve behind a gateway that authenticates users itself:
58
+ an AWS ALB with an `authenticate-oidc` action, oauth2-proxy, an identity-aware proxy.
59
+ Such a gateway takes nothing but its own session cookie, which it issues to a browser
60
+ at the end of an interactive login — no API token gets past it, and a CLI cannot run
61
+ that flow on its own.
62
+
63
+ So hand it the cookie your browser already has. In devtools, Network tab, take the
64
+ `Cookie` header off any request to that host (or Application, Cookies) and:
65
+
66
+ ```bash
67
+ export OO_COOKIE="AWSELBAuthSessionCookie-0=...; AWSELBAuthSessionCookie-1=..."
68
+ ```
69
+
70
+ It is sent verbatim, so any gateway's cookie works, whatever it calls it. A request
71
+ that hits the gateway without one says so instead of failing on a page of HTML. The
72
+ cookie expires on the gateway's schedule — an ALB session lasts 7 days by default.
73
+
74
+ The gateway is orthogonal to OpenObserve's own authentication: the cookie gets you
75
+ through the door, `OO_TOKEN` still identifies you to OpenObserve.
76
+
77
+ ## v1 and v2
78
+
79
+ Where an endpoint exists in both versions, v2 is used; there is no version switch. The CLI
80
+ reads the instance's own OpenAPI document (`/api-doc/openapi.json`) to decide, so it follows
81
+ whatever is deployed. The document is cached per endpoint under `~/.cache/oo-cli` for a week.
82
+
83
+ ```bash
84
+ oo spec paths alerts # list endpoints and their methods
85
+ oo spec refresh # refetch after an OpenObserve upgrade
86
+ ```
87
+
88
+ Without a reachable spec the CLI falls back to v1, except for `alerts`, `folders` and
89
+ `reports`, the three resources that have a v2 in OpenObserve 0.91.
90
+
91
+ ## Development
92
+
93
+ ```bash
94
+ uv sync
95
+ uv run pytest
96
+ pre-commit install # ruff, mypy and conventional commit messages
97
+ ```
@@ -0,0 +1,78 @@
1
+ [project]
2
+ # "oo", "oo-cli" and "openobserve" are all taken on PyPI.
3
+ name = "openobserve-cli"
4
+ version = "0.1.0"
5
+ description = "CLI for the OpenObserve HTTP API"
6
+ readme = "README.md"
7
+ keywords = ["openobserve", "observability", "logs", "metrics", "traces", "cli"]
8
+ authors = [{ name = "Pavel Dedík", email = "dedikx@gmail.com" }]
9
+ maintainers = [{ name = "Pavel Dedík", email = "dedikx@gmail.com" }]
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: System Administrators",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Topic :: System :: Monitoring",
21
+ ]
22
+ dependencies = ["httpx>=0.27"]
23
+
24
+ [project.scripts]
25
+ oo = "oo_cli.cli:main"
26
+ # The same command under the distribution's name, so `uvx openobserve-cli ...`
27
+ # works without installing anything.
28
+ openobserve-cli = "oo_cli.cli:main"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/paveldedik/oo-cli"
32
+ Repository = "https://github.com/paveldedik/oo-cli"
33
+ Issues = "https://github.com/paveldedik/oo-cli/issues"
34
+
35
+ [build-system]
36
+ requires = ["hatchling"]
37
+ build-backend = "hatchling.build"
38
+
39
+ [dependency-groups]
40
+ dev = ["pytest>=8", "mypy>=1.18", "ruff>=0.14"]
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/oo_cli"]
44
+
45
+ [tool.ruff]
46
+ line-length = 100
47
+ target-version = "py311"
48
+
49
+ [tool.ruff.lint]
50
+ select = [
51
+ "E", # flake8 rules
52
+ "F", # flake8 rules
53
+ "B", # flake8-bugbear
54
+ "C4", # flake8-comprehensions
55
+ "I", # isort
56
+ "D2", # pydocstyle
57
+ "C901", # maccabe complexity
58
+ "S", # flake8-bandit
59
+ "UP", # pyupgrade
60
+ "T10", # flake8-debugger
61
+ ]
62
+ ignore = [
63
+ "S101", # asserts are how tests are written
64
+ "D203",
65
+ "D211",
66
+ "D213",
67
+ ]
68
+ fixable = ["ALL"]
69
+
70
+ [tool.ruff.lint.isort]
71
+ known-first-party = ["oo_cli"]
72
+
73
+ [tool.mypy]
74
+ python_version = "3.11"
75
+ strict = true
76
+
77
+ [tool.pytest.ini_options]
78
+ testpaths = ["tests"]
@@ -0,0 +1,3 @@
1
+ """CLI for the OpenObserve HTTP API."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,4 @@
1
+ from oo_cli.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())