Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9df09b8
Feat: Usage library
lohanidamodar Dec 9, 2025
cb6c26e
Update and fix tests
lohanidamodar Dec 9, 2025
9c38514
Update tests
lohanidamodar Dec 9, 2025
360120e
format
lohanidamodar Dec 9, 2025
f650422
improve tests
lohanidamodar Dec 9, 2025
e03ba50
format and fix codeql analysis
lohanidamodar Dec 9, 2025
9de8878
update headers
lohanidamodar Dec 9, 2025
5303bf3
support tenant
lohanidamodar Dec 9, 2025
6b0bed7
Refactor and new return object
lohanidamodar Dec 9, 2025
364d627
namespace and tenant index
lohanidamodar Dec 9, 2025
fad62e0
support namespace
lohanidamodar Dec 9, 2025
a599c07
fix clickhouse test and column definitions
lohanidamodar Dec 9, 2025
8033532
fix database test
lohanidamodar Dec 9, 2025
1e25195
fix duplicate setup
lohanidamodar Dec 9, 2025
ddbcbe1
Refactor duplicates
lohanidamodar Dec 9, 2025
dae64ee
cleanup
lohanidamodar Dec 9, 2025
244aa00
fix codeql
lohanidamodar Dec 9, 2025
a84af65
feat: Refactor Usage class and introduce ClickHouse adapter
lohanidamodar Jan 19, 2026
5ca8ac1
feat: Enhance Adapter with find and count methods, update setup logic
lohanidamodar Jan 19, 2026
90c804b
feat: Refactor Database adapter to extend SQL and streamline setup logic
lohanidamodar Jan 19, 2026
da10c56
cleanup: Remove unused imports in ClickHouse and Database adapters
lohanidamodar Jan 19, 2026
78ea8d7
feat: Add data validation methods for metrics in ClickHouse adapter
lohanidamodar Jan 19, 2026
abf8c14
feat: Introduce Metric class for schema definition and validation in …
lohanidamodar Jan 19, 2026
86113b5
upgrade fetch
lohanidamodar Jan 26, 2026
aa60dd1
feat: Update ClickHouse and Database adapters to support incremental …
lohanidamodar Jan 26, 2026
e06f036
feat: Implement deterministic ID generation for metrics with normaliz…
lohanidamodar Jan 27, 2026
760a66e
fix codeql
lohanidamodar Jan 27, 2026
c74eea7
feat: Enhance logBatch to aggregate metrics by deterministic ID and u…
lohanidamodar Jan 27, 2026
f04d279
feat: Add support for FINAL in SELECT queries in ClickHouse adapter a…
lohanidamodar Jan 27, 2026
116880b
remove assert eventually
lohanidamodar Jan 27, 2026
5643c4d
feat: Add tenant validation and override logic in ClickHouse adapter …
lohanidamodar Jan 27, 2026
13e637b
fix: Correct tenant key usage in ClickHouse adapter and tests
lohanidamodar Jan 27, 2026
e799710
fix: Update ClickHouse and Database adapters to handle nullable times…
lohanidamodar Jan 28, 2026
3661fd1
Fix timestamp for infinity
lohanidamodar Jan 28, 2026
1689ed9
fix: Update usage of Query class in Adapter and Usage files
lohanidamodar Jan 28, 2026
3d8adb2
fix check
lohanidamodar Jan 28, 2026
a89db31
fix: Enhance Query class with lessThanEqual and greaterThanEqual meth…
lohanidamodar Jan 28, 2026
b6c260d
fix: Update Database adapter to support lessThanEqual and greaterThan…
lohanidamodar Jan 28, 2026
864d0cb
feat: add logCounter and logBatchCounter methods for usage metrics
lohanidamodar Jan 29, 2026
b14345a
refactor: consolidate ClickHouse batch tests into ClickHouseTest and …
lohanidamodar Jan 29, 2026
b5bf5f2
fix: improve type hinting and documentation for ClickHouse metrics ha…
lohanidamodar Jan 29, 2026
20c7156
fix codeql with runtime safety
lohanidamodar Jan 29, 2026
0eb17a1
format
lohanidamodar Jan 29, 2026
888ada5
feat: add methods for namespace, tenant, and shared tables support in…
lohanidamodar Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "CodeQL"

on: [ pull_request ]
jobs:
lint:
name: CodeQL
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2

- name: Run CodeQL
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer check"
20 changes: 20 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Linter"

on: [ pull_request ]
jobs:
lint:
name: Linter
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2
Comment on lines +10 to +15
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Update checkout action and remove fragile git checkout HEAD^2.

  1. actions/checkout@v3 is outdated; v4 is the current major version.
  2. The git checkout HEAD^2 command assumes a merge commit structure and will fail on regular commits (which have no second parent). Modern actions/checkout handles PR refs correctly without manual git operations.
Proposed fix
     steps:
       - name: Checkout repository
-        uses: actions/checkout@v3
-        with:
-          fetch-depth: 2
-
-      - run: git checkout HEAD^2
+        uses: actions/checkout@v4

       - name: Run Linter
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- run: git checkout HEAD^2
- name: Checkout repository
uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.10)

11-11: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In @.github/workflows/linter.yml around lines 10 - 15, Replace the fragile
checkout step: update the GitHub Action usage from actions/checkout@v3 to
actions/checkout@v4 and remove the manual git checkout HEAD^2 run; rely on the
updated checkout action to fetch the correct PR/merge ref (adjust fetch-depth if
you need full history) so the workflow no longer assumes a merge commit parent.


- name: Run Linter
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer lint"
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Tests"

on: [ pull_request ]
jobs:
lint:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2

- name: Build
run: |
docker compose build
docker compose up -d --wait

- name: Run Tests
run: docker compose exec usage vendor/bin/phpunit --configuration phpunit.xml tests
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity, expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at team@appwrite.io. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
101 changes: 101 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Contributing

We would ❤️ for you to contribute to Utopia-php and help make it better! We want contributing to Utopia-php to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, new docs as well as updates and tweaks, blog posts, workshops, and more.

## How to Start?

If you are worried or don't know where to start, check out our next section explaining what kind of help we could use and where can you get involved. You can reach out with questions to [Eldad Fux (@eldadfux)](https://twitter.com/eldadfux) or anyone from the [Appwrite team on Discord](https://discord.gg/GSeTUeA). You can also submit an issue, and a maintainer can guide you!

## Code of Conduct

Help us keep Utopia-php open and inclusive. Please read and follow our [Code of Conduct](https://github.com/appwrite/appwrite/blob/master/CODE_OF_CONDUCT.md).

## Submit a Pull Request 🚀

Branch naming convention is as following

`TYPE-ISSUE_ID-DESCRIPTION`

example:

```
doc-548-submit-a-pull-request-section-to-contribution-guide
```

When `TYPE` can be:

- **feat** - is a new feature
- **doc** - documentation only changes
- **cicd** - changes related to CI/CD system
- **fix** - a bug fix
- **refactor** - code change that neither fixes a bug nor adds a feature

**All PRs must include a commit message with the changes description!**

For the initial start, fork the project and use git clone command to download the repository to your computer. A standard procedure for working on an issue would be to:

1. `git pull`, before creating a new branch, pull the changes from upstream. Your master needs to be up to date.

```
$ git pull
```

2. Create new branch from `master` like: `doc-548-submit-a-pull-request-section-to-contribution-guide`<br/>

```
$ git checkout -b [name_of_your_new_branch]
```

3. Work - commit - repeat ( be sure to be in your branch )

4. Push changes to GitHub

```
$ git push origin [name_of_your_new_branch]
```

5. Submit your changes for review
If you go to your repository on GitHub, you'll see a `Compare & pull request` button. Click on that button.
6. Start a Pull Request
Now submit the pull request and click on `Create pull request`.
7. Get a code review approval/reject
8. After approval, merge your PR
9. GitHub will automatically delete the branch after the merge is done. (they can still be restored).

## Introducing New Features

We would 💖 you to contribute to Utopia-php, but we would also like to make sure Utopia-php is as great as possible and loyal to its vision and mission statement 🙏.

For us to find the right balance, please open an issue explaining your ideas before introducing a new pull request.

This will allow the Utopia-php community to have sufficient discussion about the new feature value and how it fits in the product roadmap and vision.

This is also important for the Utopia-php lead developers to be able to give technical input and different emphasis regarding the feature design and architecture. Some bigger features might need to go through our [RFC process](https://github.com/appwrite/rfc).

## Other Ways to Help

Pull requests are great, but there are many other areas where you can help Utopia-php.

### Blogging & Speaking

Blogging, speaking about, or creating tutorials about one of Utopia-php's many features is great way to contribute and help our project grow.

### Presenting at Meetups

Presenting at meetups and conferences about your Utopia-php projects. Your unique challenges and successes in building things with Utopia-php can provide great speaking material. We'd love to review your talk abstract/CFP, so get in touch with us if you'd like some help!

### Sending Feedbacks & Reporting Bugs

Sending feedback is a great way for us to understand your different use cases of Utopia-php better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/GSeTUeA).

### Submitting New Ideas

If you think Utopia-php could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature.

### Improving Documentation

Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated.

### Helping Someone

Searching for Utopia-php, GitHub or StackOverflow and helping someone else who needs help. You can also help by teaching others how to contribute to Utopia-php's repo!
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM composer:2.0 as step0

WORKDIR /src/

COPY composer.lock /src/
COPY composer.json /src/

RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist

FROM php:8.3.3-cli-alpine3.19 as final

LABEL maintainer="team@appwrite.io"

RUN docker-php-ext-install pdo_mysql

WORKDIR /code

COPY --from=step0 /src/vendor /code/vendor

# Add Source Code
COPY ./tests /code/tests
COPY ./src /code/src
COPY ./phpunit.xml /code/phpunit.xml

CMD [ "tail", "-f", "/dev/null" ]
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2024 Appwrite Team

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading