-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from utopia-php/initial-commit
feat: opentelemetry adapter
- Loading branch information
Showing
20 changed files
with
5,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
- name: Run Linter | ||
run: | | ||
docker run --rm -v $PWD:/app composer sh -c \ | ||
"composer install --profile --ignore-platform-reqs && composer lint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: "🐛 Bug Report" | ||
description: "Submit a bug report to help us improve" | ||
title: "🐛 Bug Report: " | ||
labels: [bug] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out our bug report form 🙏 | ||
- type: textarea | ||
id: steps-to-reproduce | ||
validations: | ||
required: true | ||
attributes: | ||
label: "👟 Reproduction steps" | ||
description: "How do you trigger this bug? Please walk us through it step by step." | ||
placeholder: "When I ..." | ||
- type: textarea | ||
id: expected-behavior | ||
validations: | ||
required: true | ||
attributes: | ||
label: "👍 Expected behavior" | ||
description: "What did you think would happen?" | ||
placeholder: "It should ..." | ||
- type: textarea | ||
id: actual-behavior | ||
validations: | ||
required: true | ||
attributes: | ||
label: "👎 Actual Behavior" | ||
description: "What did actually happen? Add screenshots, if applicable." | ||
placeholder: "It actually ..." | ||
- type: dropdown | ||
id: utopia-version | ||
attributes: | ||
label: "🎲 Utopia Framework version" | ||
description: "What version of Utopia are you running?" | ||
options: | ||
- Version 0.18.x | ||
- Version 0.17.x | ||
- Version 0.16.x | ||
- Version 0.15.x | ||
- Version 0.14.x | ||
- Different version (specify in environment) | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: php-version | ||
attributes: | ||
label: "🐘 PHP Version" | ||
description: "What version of PHP are you running?" | ||
options: | ||
- PHP 8.0 | ||
- Different version (specify in environment) | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: operating-system | ||
attributes: | ||
label: "💻 Operating system" | ||
description: "What OS is your server / device running on?" | ||
options: | ||
- Linux | ||
- MacOS | ||
- Windows | ||
- Something else | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: environment | ||
validations: | ||
required: false | ||
attributes: | ||
label: "🧱 Your Environment" | ||
description: "Is your environment customized in any way?" | ||
placeholder: "I use Cloudflare for ..." | ||
- type: checkboxes | ||
id: no-duplicate-issues | ||
attributes: | ||
label: "👀 Have you spent some time to check if this issue has been raised before?" | ||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?" | ||
options: | ||
- label: "I checked and didn't find similar issue" | ||
required: true | ||
- type: checkboxes | ||
id: read-code-of-conduct | ||
attributes: | ||
label: "🏢 Have you read the Code of Conduct?" | ||
options: | ||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "📚 Documentation" | ||
description: "Report an issue related to documentation" | ||
title: "📚 Documentation: " | ||
labels: [documentation] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to make our documentation better 🙏 | ||
- type: textarea | ||
id: issue-description | ||
validations: | ||
required: true | ||
attributes: | ||
label: "💭 Description" | ||
description: "A clear and concise description of what the issue is." | ||
placeholder: "Documentation should not ..." | ||
- type: checkboxes | ||
id: no-duplicate-issues | ||
attributes: | ||
label: "👀 Have you spent some time to check if this issue has been raised before?" | ||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?" | ||
options: | ||
- label: "I checked and didn't find similar issue" | ||
required: true | ||
- type: checkboxes | ||
id: read-code-of-conduct | ||
attributes: | ||
label: "🏢 Have you read the Code of Conduct?" | ||
options: | ||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "🚀 Feature" | ||
description: "Submit a proposal for a new feature" | ||
title: "🚀 Feature: " | ||
labels: [feature] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out our feature request form 🙏 | ||
- type: textarea | ||
id: feature-description | ||
validations: | ||
required: true | ||
attributes: | ||
label: "🔖 Feature description" | ||
description: "A clear and concise description of what the feature is." | ||
placeholder: "You should add ..." | ||
- type: textarea | ||
id: pitch | ||
validations: | ||
required: true | ||
attributes: | ||
label: "🎤 Pitch" | ||
description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable." | ||
placeholder: "In my use-case, ..." | ||
- type: checkboxes | ||
id: no-duplicate-issues | ||
attributes: | ||
label: "👀 Have you spent some time to check if this issue has been raised before?" | ||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?" | ||
options: | ||
- label: "I checked and didn't find similar issue" | ||
required: true | ||
- type: checkboxes | ||
id: read-code-of-conduct | ||
attributes: | ||
label: "🏢 Have you read the Code of Conduct?" | ||
options: | ||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "CodeQL" | ||
|
||
on: [pull_request] | ||
jobs: | ||
lint: | ||
name: CodeQL | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run CodeQL | ||
run: | | ||
docker run --rm -v $PWD:/app composer sh -c \ | ||
"composer install --profile --ignore-platform-reqs && composer check" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "Linter" | ||
|
||
on: [pull_request] | ||
jobs: | ||
lint: | ||
name: Linter | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Linter | ||
run: | | ||
docker run --rm -v $PWD:/app composer sh -c \ | ||
"composer install --profile --ignore-platform-reqs && composer lint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/vendor/ | ||
/.idea/ | ||
*.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Utopia Telemetry | ||
|
||
![Total Downloads](https://img.shields.io/packagist/dt/utopia-php/telemetry.svg) | ||
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://appwrite.io/discord) | ||
|
||
Utopia Telemetry is a powerful Telemtry library. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io). | ||
|
||
Although this library is part of the [Utopia System](https://github.com/utopia-php) project it is dependency free and can be used as standalone with any other PHP project or framework. | ||
|
||
## Getting Started | ||
|
||
Install using composer: | ||
|
||
```bash | ||
composer require utopia-php/telemetry | ||
``` | ||
|
||
Init in your application: | ||
|
||
```php | ||
<?php | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
// Create a Telemetry instance using OpenTelemetry adapter. | ||
use Utopia\Telemetry\Adapter\OpenTelemetry; | ||
|
||
$telemetry = new OpenTelemetry('http://localhost:4138', 'namespace', 'app', 'unique-instance-name'); | ||
$counter = $telemetry->createUpDownCounter('http.server.active_requests', '{request}'); | ||
|
||
$counter->add(1); | ||
$counter->add(2); | ||
|
||
// Periodically collect metrics and send them to the configured OpenTelemetry endpoint. | ||
$telemetry->collect(); | ||
|
||
// Example using Swoole | ||
\Swoole\Timer::tick(60_000, fn () => $telemetry->collect()); | ||
``` | ||
|
||
## System Requirements | ||
|
||
Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible. | ||
|
||
## Copyright and license | ||
|
||
The MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "utopia-php/telemetry", | ||
"type": "library", | ||
"keywords": [ | ||
"php", | ||
"framework", | ||
"upf" | ||
], | ||
"license": "MIT", | ||
"minimum-stability": "stable", | ||
"autoload": { | ||
"psr-4": { | ||
"Utopia\\": "src/" | ||
} | ||
}, | ||
"scripts": { | ||
"lint": "vendor/bin/pint --test", | ||
"format": "vendor/bin/pint", | ||
"check": "vendor/bin/phpstan analyse -c phpstan.neon", | ||
"test": "vendor/bin/phpunit --configuration phpunit.xml", | ||
"bench": "vendor/bin/phpbench run --report=benchmark" | ||
}, | ||
"require": { | ||
"ext-protobuf": "*", | ||
"ext-opentelemetry": "*", | ||
"php": ">=8.0", | ||
"open-telemetry/sdk": "^1.1", | ||
"symfony/http-client": "^7.1", | ||
"nyholm/psr7": "^1.8", | ||
"open-telemetry/exporter-otlp": "^1.1" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5.25", | ||
"laravel/pint": "^1.2", | ||
"phpstan/phpstan": "^1.10", | ||
"phpbench/phpbench": "^1.2" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"php-http/discovery": true, | ||
"tbachert/spi": true | ||
} | ||
} | ||
} |
Oops, something went wrong.