From c8c9964b68c86b233a5c56cb3b59ccd20480a506 Mon Sep 17 00:00:00 2001 From: Sarah Haskins Date: Tue, 2 Oct 2018 14:53:41 -0400 Subject: [PATCH] Issue #12: Implement toProto and TransportHTTPProto The Proto transport should be considered beta. No performance testing has been done. Known issues: - GUIDs larger than PHP_MAX_INT will be truncted, this could lead to invalidly joined traces and/or traces that fail to join --- Makefile | 2 +- composer.json | 3 +- composer.lock | 820 ++++++++++++------ example.php | 4 +- lib/Client/Auth.php | 11 + lib/Client/ClientSpan.php | 62 +- lib/Client/ClientTracer.php | 9 +- lib/Client/KeyValue.php | 10 + lib/Client/LogRecord.php | 42 + lib/Client/ReportRequest.php | 31 + lib/Client/Runtime.php | 25 +- lib/Client/Transports/TransportHTTPPROTO.php | 59 ++ lib/Client/Util.php | 43 +- lib/LightStep.php | 14 + .../GPBMetadata/Google/Api/Annotations.php | 31 + lib/generated/GPBMetadata/Google/Api/Http.php | 42 + .../Google/Api/CustomHttpPattern.php | 101 +++ lib/generated/Google/Api/Http.php | 123 +++ lib/generated/Google/Api/HttpRule.php | 560 ++++++++++++ test/ProtoTypesTest.php | 236 +++++ test/UtilTest.php | 16 + 21 files changed, 1952 insertions(+), 292 deletions(-) create mode 100644 lib/Client/Transports/TransportHTTPPROTO.php create mode 100644 lib/generated/GPBMetadata/Google/Api/Annotations.php create mode 100644 lib/generated/GPBMetadata/Google/Api/Http.php create mode 100644 lib/generated/Google/Api/CustomHttpPattern.php create mode 100644 lib/generated/Google/Api/Http.php create mode 100644 lib/generated/Google/Api/HttpRule.php create mode 100644 test/ProtoTypesTest.php create mode 100644 test/UtilTest.php diff --git a/Makefile b/Makefile index 1e6e8923..6f9fd39c 100644 --- a/Makefile +++ b/Makefile @@ -58,4 +58,4 @@ thrift: proto: protoc --proto_path "$(PWD)/../googleapis:$(PWD)/../lightstep-tracer-common/" \ --php_out="$(PWD)/lib/generated" \ - collector.proto + collector.proto google/api/annotations.proto google/api/http.proto diff --git a/composer.json b/composer.json index 12b48b9d..89e57055 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,8 @@ "description": "LightStep instrumentation API", "license": "MIT", "require": { - "ruafozy/mersenne-twister": "^1.3" + "ruafozy/mersenne-twister": "^1.3", + "google/protobuf": ">=3.6.1" }, "require-dev": { "phpdocumentor/phpdocumentor": "^2.8.5", diff --git a/composer.lock b/composer.lock index f7c875d7..d40ff5b6 100644 --- a/composer.lock +++ b/composer.lock @@ -1,24 +1,64 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "7c7481c071d7eedf25b1fe74347ea5a4", - "content-hash": "f11fdc0b4c71b5c0a10489d92219820e", + "content-hash": "cff8a6945ceba149d4cb4caacf70736e", "packages": [ + { + "name": "google/protobuf", + "version": "v3.6.1", + "source": { + "type": "git", + "url": "https://github.com/google/protobuf.git", + "reference": "48cb18e5c419ddd23d9badcfe4e9df7bde1979b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/protobuf/zipball/48cb18e5c419ddd23d9badcfe4e9df7bde1979b2", + "reference": "48cb18e5c419ddd23d9badcfe4e9df7bde1979b2", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "php/src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "proto library for PHP", + "homepage": "https://developers.google.com/protocol-buffers/", + "keywords": [ + "proto" + ], + "time": "2018-07-27T20:30:28+00:00" + }, { "name": "ruafozy/mersenne-twister", "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/ruafozy/php-mersenne-twister.git", - "reference": "9a2486ae7f62eac4068a18d2e93e79d522430c53" + "reference": "83ca113aa1e5f924d3b5f03679b1480063cc7d94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ruafozy/php-mersenne-twister/zipball/9a2486ae7f62eac4068a18d2e93e79d522430c53", - "reference": "9a2486ae7f62eac4068a18d2e93e79d522430c53", + "url": "https://api.github.com/repos/ruafozy/php-mersenne-twister/zipball/83ca113aa1e5f924d3b5f03679b1480063cc7d94", + "reference": "83ca113aa1e5f924d3b5f03679b1480063cc7d94", "shasum": "" }, "require": { @@ -44,7 +84,7 @@ "mersenne", "random" ], - "time": "2015-02-21 10:26:45" + "time": "2015-02-21T10:26:45+00:00" } ], "packages-dev": [ @@ -105,7 +145,7 @@ "cli", "microframework" ], - "time": "2014-03-29 14:03:13" + "time": "2014-03-29T14:03:13+00:00" }, { "name": "cilex/console-service-provider", @@ -164,22 +204,25 @@ "service-provider", "silex" ], - "time": "2012-12-19 10:50:58" + "time": "2012-12-19T10:50:58+00:00" }, { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -191,7 +234,8 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" }, { "name": "doctrine/annotations", @@ -259,7 +303,7 @@ "docblock", "parser" ], - "time": "2015-08-31 12:32:49" + "time": "2015-08-31T12:32:49+00:00" }, { "name": "doctrine/instantiator", @@ -313,7 +357,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "doctrine/lexer", @@ -367,22 +411,29 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "erusev/parsedown", - "version": "1.6.0", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", "shasum": "" }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "type": "library", "autoload": { "psr-0": { @@ -406,7 +457,7 @@ "markdown", "parser" ], - "time": "2015-10-04 16:44:32" + "time": "2018-03-08T01:11:30+00:00" }, { "name": "herrera-io/json", @@ -466,7 +517,7 @@ "schema", "validate" ], - "time": "2013-10-30 16:51:34" + "time": "2013-10-30T16:51:34+00:00" }, { "name": "herrera-io/phar-update", @@ -523,27 +574,28 @@ "phar", "update" ], - "time": "2013-10-30 17:23:01" + "time": "2013-10-30T17:23:01+00:00" }, { "name": "jms/metadata", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "22b72455559a25777cfd28c4ffda81ff7639f353" + "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353", - "reference": "22b72455559a25777cfd28c4ffda81ff7639f353", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/6a06970a10e0a532fb52d3959547123b84a3b3ab", + "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "doctrine/cache": "~1.0" + "doctrine/cache": "~1.0", + "symfony/cache": "~3.1" }, "type": "library", "extra": { @@ -558,14 +610,12 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache" + "Apache-2.0" ], "authors": [ { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" } ], "description": "Class/method/property metadata management in PHP", @@ -575,7 +625,7 @@ "xml", "yaml" ], - "time": "2014-07-12 07:13:19" + "time": "2016-12-05T10:18:33+00:00" }, { "name": "jms/parser-lib", @@ -610,53 +660,60 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18 18:08:43" + "time": "2012-11-18T18:08:43+00:00" }, { "name": "jms/serializer", - "version": "1.1.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48" + "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/fe13a1f993ea3456e195b7820692f2eb2b6bbb48", - "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/00863e1d55b411cc33ad3e1de09a4c8d3aae793c", + "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c", "shasum": "" }, "require": { - "doctrine/annotations": "1.*", - "doctrine/instantiator": "~1.0.3", - "jms/metadata": "~1.1", + "doctrine/annotations": "^1.0", + "doctrine/instantiator": "^1.0.3", + "jms/metadata": "^1.3", "jms/parser-lib": "1.*", - "php": ">=5.4.0", - "phpcollection/phpcollection": "~0.1" + "php": "^5.5|^7.0", + "phpcollection/phpcollection": "~0.1", + "phpoption/phpoption": "^1.1" }, "conflict": { "twig/twig": "<1.12" }, "require-dev": { "doctrine/orm": "~2.1", - "doctrine/phpcr-odm": "~1.0.1", - "jackalope/jackalope-doctrine-dbal": "1.0.*", - "phpunit/phpunit": "~4.0", + "doctrine/phpcr-odm": "^1.3|^2.0", + "ext-pdo_sqlite": "*", + "jackalope/jackalope-doctrine-dbal": "^1.1.5", + "phpunit/phpunit": "^4.8|^5.0", "propel/propel1": "~1.7", - "symfony/filesystem": "2.*", - "symfony/form": "~2.1", - "symfony/translation": "~2.0", - "symfony/validator": "~2.0", - "symfony/yaml": "2.*", + "psr/container": "^1.0", + "symfony/dependency-injection": "^2.7|^3.3|^4.0", + "symfony/expression-language": "^2.6|^3.0", + "symfony/filesystem": "^2.1", + "symfony/form": "~2.1|^3.0", + "symfony/translation": "^2.1|^3.0", + "symfony/validator": "^2.2|^3.0", + "symfony/yaml": "^2.1|^3.0", "twig/twig": "~1.12|~2.0" }, "suggest": { + "doctrine/cache": "Required if you like to use cache functionality.", + "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", "symfony/yaml": "Required if you'd like to serialize data to YAML format." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-1.x": "1.13-dev" } }, "autoload": { @@ -666,9 +723,13 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "MIT" ], "authors": [ + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + }, { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" @@ -683,7 +744,7 @@ "serialization", "xml" ], - "time": "2015-10-27 09:24:41" + "time": "2018-07-25T13:58:54+00:00" }, { "name": "justinrainbow/json-schema", @@ -749,7 +810,7 @@ "json", "schema" ], - "time": "2016-01-25 15:43:01" + "time": "2016-01-25T15:43:01+00:00" }, { "name": "kherge/version", @@ -791,20 +852,20 @@ ], "description": "A parsing and comparison library for semantic versioning.", "homepage": "http://github.com/kherge/Version", - "time": "2012-08-16 17:13:03" + "time": "2012-08-16T17:13:03+00:00" }, { "name": "monolog/monolog", - "version": "1.19.0", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf" + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf", - "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", "shasum": "" }, "require": { @@ -815,7 +876,7 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", "jakub-onderka/php-parallel-lint": "0.9", @@ -823,9 +884,9 @@ "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3" + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -836,9 +897,9 @@ "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", "extra": { @@ -869,7 +930,7 @@ "logging", "psr-3" ], - "time": "2016-04-12 18:29:35" + "time": "2017-06-19T01:22:40+00:00" }, { "name": "nikic/php-parser", @@ -914,20 +975,20 @@ "parser", "php" ], - "time": "2015-09-19 14:15:08" + "time": "2015-09-19T14:15:08+00:00" }, { "name": "phpcollection/phpcollection", - "version": "0.4.0", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-collection.git", - "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83" + "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/b8bf55a0a929ca43b01232b36719f176f86c7e83", - "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83", + "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", + "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", "shasum": "" }, "require": { @@ -936,7 +997,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.3-dev" + "dev-master": "0.4-dev" } }, "autoload": { @@ -950,10 +1011,8 @@ ], "authors": [ { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" } ], "description": "General-Purpose Collection Library for PHP", @@ -964,7 +1023,7 @@ "sequence", "set" ], - "time": "2014-03-11 13:46:42" + "time": "2015-05-17T12:39:23+00:00" }, { "name": "phpdocumentor/fileset", @@ -1007,7 +1066,7 @@ "fileset", "phpdoc" ], - "time": "2013-08-06 21:07:42" + "time": "2013-08-06T21:07:42+00:00" }, { "name": "phpdocumentor/graphviz", @@ -1048,7 +1107,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2016-02-02 13:00:08" + "time": "2016-02-02T13:00:08+00:00" }, { "name": "phpdocumentor/phpdocumentor", @@ -1137,7 +1196,7 @@ "documentation", "phpdoc" ], - "time": "2016-05-22 09:50:56" + "time": "2016-05-22T09:50:56+00:00" }, { "name": "phpdocumentor/reflection", @@ -1191,20 +1250,20 @@ "reflection", "static analysis" ], - "time": "2016-05-21 08:42:32" + "time": "2016-05-21T08:42:32+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", "shasum": "" }, "require": { @@ -1240,7 +1299,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2016-01-25T08:17:30+00:00" }, { "name": "phpoption/phpoption", @@ -1290,36 +1349,37 @@ "php", "type" ], - "time": "2015-07-25 16:39:46" + "time": "2015-07-25T16:39:46+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.1", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -1352,7 +1412,7 @@ "spy", "stub" ], - "time": "2016-06-07 08:13:47" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1414,20 +1474,20 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -1461,7 +1521,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -1502,29 +1562,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1546,20 +1611,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -1595,20 +1660,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.26", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74", - "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -1624,7 +1689,7 @@ "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", + "sebastian/comparator": "~1.2.2", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", @@ -1667,7 +1732,7 @@ "testing", "xunit" ], - "time": "2016-05-17 03:09:28" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1723,7 +1788,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "pimple/pimple", @@ -1769,26 +1834,83 @@ "container", "dependency injection" ], - "time": "2013-11-22 08:30:29" + "time": "2013-11-22T08:30:29+00:00" }, { - "name": "psr/log", + "name": "psr/container", "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1802,31 +1924,32 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1871,27 +1994,27 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1923,27 +2046,27 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -1973,20 +2096,20 @@ "environment", "hhvm" ], - "time": "2016-05-17 03:18:57" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -1994,12 +2117,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -2039,7 +2163,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/global-state", @@ -2090,20 +2214,20 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -2143,7 +2267,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -2178,25 +2302,28 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "seld/jsonlint", - "version": "1.4.0", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "66834d3e3566bb5798db7294619388786ae99394" + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394", - "reference": "66834d3e3566bb5798db7294619388786ae99394", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", "shasum": "" }, "require": { "php": "^5.3 || ^7.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, "bin": [ "bin/jsonlint" ], @@ -2224,25 +2351,29 @@ "parser", "validator" ], - "time": "2015-11-21 02:21:41" + "time": "2018-01-24T12:46:19+00:00" }, { "name": "symfony/config", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "a2edd59c2163c65747fc3f35d132b5a39266bd05" + "reference": "fb3469266daaa67a1e6d42fc78fa6cdc254689f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/a2edd59c2163c65747fc3f35d132b5a39266bd05", - "reference": "a2edd59c2163c65747fc3f35d132b5a39266bd05", + "url": "https://api.github.com/repos/symfony/config/zipball/fb3469266daaa67a1e6d42fc78fa6cdc254689f6", + "reference": "fb3469266daaa67a1e6d42fc78fa6cdc254689f6", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" + "symfony/filesystem": "~2.3|~3.0.0", + "symfony/polyfill-ctype": "~1.8" + }, + "require-dev": { + "symfony/yaml": "~2.7|~3.0.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -2277,24 +2408,25 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" + "time": "2018-09-08T12:44:02+00:00" }, { "name": "symfony/console", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3" + "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3", - "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3", + "url": "https://api.github.com/repos/symfony/console/zipball/aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789", + "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789", "shasum": "" }, "require": { "php": ">=5.3.9", + "symfony/debug": "^2.7.2|~3.0.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -2303,7 +2435,7 @@ "symfony/process": "~2.1|~3.0.0" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/process": "" }, @@ -2337,20 +2469,77 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-06-06 15:06:25" + "time": "2018-09-30T03:33:07+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2a6b8713f8bdb582058cfda463527f195b066110" + "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2a6b8713f8bdb582058cfda463527f195b066110", - "reference": "2a6b8713f8bdb582058cfda463527f195b066110", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/84ae343f39947aa084426ed1138bb96bf94d1f12", + "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12", "shasum": "" }, "require": { @@ -2358,7 +2547,7 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/config": "^2.0.5|~3.0.0", "symfony/dependency-injection": "~2.6|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0", "symfony/stopwatch": "~2.3|~3.0.0" @@ -2397,20 +2586,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" + "time": "2018-07-26T09:03:18+00:00" }, { "name": "symfony/filesystem", - "version": "v3.0.7", + "version": "v3.0.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "74fec3511b62cb934b64bce1d96f06fffa4beafd" + "reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/74fec3511b62cb934b64bce1d96f06fffa4beafd", - "reference": "74fec3511b62cb934b64bce1d96f06fffa4beafd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2da5009d9bacbd91d83486aa1f44c793a8c380d", + "reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d", "shasum": "" }, "require": { @@ -2446,20 +2635,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-04-12 18:09:53" + "time": "2016-07-20T05:43:46+00:00" }, { "name": "symfony/finder", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3ec095fab1800222732ca522a95dce8fa124007b" + "reference": "5ebb438d1aabe9dba93099dd06e0500f97817a6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3ec095fab1800222732ca522a95dce8fa124007b", - "reference": "3ec095fab1800222732ca522a95dce8fa124007b", + "url": "https://api.github.com/repos/symfony/finder/zipball/5ebb438d1aabe9dba93099dd06e0500f97817a6e", + "reference": "5ebb438d1aabe9dba93099dd06e0500f97817a6e", "shasum": "" }, "require": { @@ -2495,20 +2684,78 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" + "time": "2018-09-21T12:46:38+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -2520,7 +2767,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2554,20 +2801,20 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/process", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c" + "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/115347d00c342198cdc52a7bd8bc15b5ab43500c", - "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c", + "url": "https://api.github.com/repos/symfony/process/zipball/f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6", + "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6", "shasum": "" }, "require": { @@ -2603,20 +2850,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" + "time": "2018-09-06T17:11:15+00:00" }, { "name": "symfony/stopwatch", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "5e628055488bcc42dbace3af65be435d094e37e4" + "reference": "12a4b0c2a1788adf16a5548ab18ab9e8801d71d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5e628055488bcc42dbace3af65be435d094e37e4", - "reference": "5e628055488bcc42dbace3af65be435d094e37e4", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/12a4b0c2a1788adf16a5548ab18ab9e8801d71d8", + "reference": "12a4b0c2a1788adf16a5548ab18ab9e8801d71d8", "shasum": "" }, "require": { @@ -2652,20 +2899,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" + "time": "2018-07-24T10:05:38+00:00" }, { "name": "symfony/translation", - "version": "v3.0.7", + "version": "v3.0.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7" + "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", - "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", + "url": "https://api.github.com/repos/symfony/translation/zipball/eee6c664853fd0576f21ae25725cfffeafe83f26", + "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26", "shasum": "" }, "require": { @@ -2716,37 +2963,38 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:33:26" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/validator", - "version": "v2.8.7", + "version": "v2.8.46", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "4c8f9fd8e2150dbc4745ef13378e690588365df0" + "reference": "d928358e4e67353784be1816d3830e7097d5cf56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/4c8f9fd8e2150dbc4745ef13378e690588365df0", - "reference": "4c8f9fd8e2150dbc4745ef13378e690588365df0", + "url": "https://api.github.com/repos/symfony/validator/zipball/d928358e4e67353784be1816d3830e7097d5cf56", + "reference": "d928358e4e67353784be1816d3830e7097d5cf56", "shasum": "" }, "require": { "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", "symfony/translation": "~2.4|~3.0.0" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.2,>=1.2.1", + "egulias/email-validator": "^1.2.1", "symfony/config": "~2.2|~3.0.0", "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.1|~3.0.0", - "symfony/intl": "~2.7.4|~2.8|~3.0.0", + "symfony/http-foundation": "~2.3|~3.0.0", + "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", "symfony/property-access": "~2.3|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + "symfony/yaml": "^2.0.5|~3.0.0" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", @@ -2789,29 +3037,35 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2016-04-14 08:48:44" + "time": "2018-09-25T08:06:01+00:00" }, { "name": "symfony/yaml", - "version": "v3.1.0", + "version": "v3.3.18", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a" + "reference": "af615970e265543a26ee712c958404eb9b7ac93d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", - "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/af615970e265543a26ee712c958404eb9b7ac93d", + "reference": "af615970e265543a26ee712c958404eb9b7ac93d", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -2838,38 +3092,43 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-05-26 21:46:24" + "time": "2018-01-20T15:04:53+00:00" }, { "name": "twig/twig", - "version": "v1.24.1", + "version": "v1.35.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512" + "reference": "7e081e98378a1e78c29cc9eba4aefa5d78a05d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/7e081e98378a1e78c29cc9eba4aefa5d78a05d2a", + "reference": "7e081e98378a1e78c29cc9eba4aefa5d78a05d2a", "shasum": "" }, "require": { - "php": ">=5.2.7" + "php": ">=5.3.3", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~2.7" + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.24-dev" + "dev-master": "1.35-dev" } }, "autoload": { "psr-0": { "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2890,29 +3149,29 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "keywords": [ "templating" ], - "time": "2016-05-30 09:11:59" + "time": "2018-07-13T07:12:17+00:00" }, { "name": "zendframework/zend-cache", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-cache.git", - "reference": "2c68def8f96ce842d2f2a9a69e2f3508c2f5312d" + "reference": "c98331b96d3b9d9b24cf32d02660602edb34d039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/2c68def8f96ce842d2f2a9a69e2f3508c2f5312d", - "reference": "2c68def8f96ce842d2f2a9a69e2f3508c2f5312d", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/c98331b96d3b9d9b24cf32d02660602edb34d039", + "reference": "c98331b96d3b9d9b24cf32d02660602edb34d039", "shasum": "" }, "require": { @@ -2922,9 +3181,9 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", "phpbench/phpbench": "^0.10.0", - "phpunit/phpunit": "^4.5", + "phpunit/phpunit": "^4.8", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-serializer": "^2.6", "zendframework/zend-session": "^2.6.2" }, @@ -2968,7 +3227,7 @@ "cache", "zf2" ], - "time": "2016-05-12 21:47:55" + "time": "2016-12-16T11:35:47+00:00" }, { "name": "zendframework/zend-config", @@ -3024,7 +3283,7 @@ "config", "zf2" ], - "time": "2016-02-04 23:01:10" + "time": "2016-02-04T23:01:10+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -3078,20 +3337,20 @@ "events", "zf2" ], - "time": "2016-02-18 20:53:00" + "time": "2016-02-18T20:53:00+00:00" }, { "name": "zendframework/zend-filter", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80" + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/84c50246428efb0a1e52868e162dab3e149d5b80", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/b8d0ff872f126631bf63a932e33aa2d22d467175", + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175", "shasum": "" }, "require": { @@ -3099,10 +3358,10 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", "pear/archive_tar": "^1.4", - "phpunit/phpunit": "~4.0", - "zendframework/zend-crypt": "^2.6", + "phpunit/phpunit": "^6.0.10 || ^5.7.17", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^2.6 || ^3.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", "zendframework/zend-uri": "^2.5" }, @@ -3138,7 +3397,7 @@ "filter", "zf2" ], - "time": "2016-04-18 18:32:43" + "time": "2017-05-17T20:56:17+00:00" }, { "name": "zendframework/zend-hydrator", @@ -3196,7 +3455,7 @@ "hydrator", "zf2" ], - "time": "2016-02-18 22:38:26" + "time": "2016-02-18T22:38:26+00:00" }, { "name": "zendframework/zend-i18n", @@ -3263,7 +3522,7 @@ "i18n", "zf2" ], - "time": "2016-06-07 21:08:30" + "time": "2016-06-07T21:08:30+00:00" }, { "name": "zendframework/zend-json", @@ -3318,7 +3577,7 @@ "json", "zf2" ], - "time": "2016-02-04 21:20:26" + "time": "2016-02-04T21:20:26+00:00" }, { "name": "zendframework/zend-serializer", @@ -3375,20 +3634,20 @@ "serializer", "zf2" ], - "time": "2016-05-11 16:05:56" + "time": "2016-05-11T16:05:56+00:00" }, { "name": "zendframework/zend-servicemanager", - "version": "2.7.6", + "version": "2.7.11", "source": { "type": "git", "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "a6db4d13b9141fccce5dcb553df0295d6ad7d477" + "reference": "99ec9ed5d0f15aed9876433c74c2709eb933d4c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/a6db4d13b9141fccce5dcb553df0295d6ad7d477", - "reference": "a6db4d13b9141fccce5dcb553df0295d6ad7d477", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/99ec9ed5d0f15aed9876433c74c2709eb933d4c7", + "reference": "99ec9ed5d0f15aed9876433c74c2709eb933d4c7", "shasum": "" }, "require": { @@ -3427,7 +3686,7 @@ "servicemanager", "zf2" ], - "time": "2016-04-27 19:07:40" + "time": "2018-06-22T14:49:54+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3486,23 +3745,24 @@ "stdlib", "zf2" ], - "time": "2016-04-12 21:17:31" + "time": "2016-04-12T21:17:31+00:00" }, { "name": "zetacomponents/base", - "version": "1.9", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/zetacomponents/Base.git", - "reference": "f20df24e8de3e48b6b69b2503f917e457281e687" + "reference": "489e20235989ddc97fdd793af31ac803972454f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687", - "reference": "f20df24e8de3e48b6b69b2503f917e457281e687", + "url": "https://api.github.com/repos/zetacomponents/Base/zipball/489e20235989ddc97fdd793af31ac803972454f1", + "reference": "489e20235989ddc97fdd793af31ac803972454f1", "shasum": "" }, "require-dev": { + "phpunit/phpunit": "~5.7", "zetacomponents/unit-test": "*" }, "type": "library", @@ -3549,7 +3809,7 @@ ], "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.", "homepage": "https://github.com/zetacomponents", - "time": "2014-09-19 03:28:34" + "time": "2017-11-28T11:30:00+00:00" }, { "name": "zetacomponents/document", @@ -3600,7 +3860,7 @@ ], "description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.", "homepage": "https://github.com/zetacomponents", - "time": "2013-12-19 11:40:00" + "time": "2013-12-19T11:40:00+00:00" } ], "aliases": [], diff --git a/example.php b/example.php index 091bad47..89bdb00c 100644 --- a/example.php +++ b/example.php @@ -2,7 +2,9 @@ require __DIR__ . '/vendor/autoload.php'; -LightStep::initGlobalTracer('examples/trivial_process', '{your_access_token}'); +LightStep::initGlobalTracer( + 'examples/trivial_process', + '{your_access_token}'); $span = LightStep::startSpan("trivial/loop"); for ($i = 0; $i < 10; $i++) { diff --git a/lib/Client/Auth.php b/lib/Client/Auth.php index cbaac8b6..1e31d529 100644 --- a/lib/Client/Auth.php +++ b/lib/Client/Auth.php @@ -1,6 +1,8 @@ strval($this->_accessToken), ]); } + + /** + * @return ProtoAuth A Proto representation of this object. + */ + public function toProto() { + $protoAuth = new ProtoAuth(); + $protoAuth->setAccessToken($this->_accessToken); + return $protoAuth; + } } \ No newline at end of file diff --git a/lib/Client/ClientSpan.php b/lib/Client/ClientSpan.php index 3f41e4be..476ee653 100644 --- a/lib/Client/ClientSpan.php +++ b/lib/Client/ClientSpan.php @@ -1,6 +1,13 @@ _tags['parent_span_guid']; + if (array_key_exists('parent_span_guid', $this->_tags)) { + return $this->_tags['parent_span_guid']; + } + return NULL; } public function logEvent($event, $payload = NULL) { @@ -260,4 +270,54 @@ public function toThrift() { ]); return $rec; } + + /** + * @return Span A Proto representation of this object. + */ + public function toProto() { + $spanContext = new SpanContext(); + $spanContext->setTraceId(Util::hexdec($this->traceGUID())); + $spanContext->setSpanId(Util::hexdec($this->guid())); + $span = new Span(); + $span->setSpanContext($spanContext); + $span->setOperationName(strval($this->_operation)); + + $ts = new Timestamp(); + + $ts->setSeconds(floor($this->_startMicros / 1000000)); + $ts->setNanos($this->_startMicros % 1000000); + $span->setStartTimestamp($ts); + + $span->setDurationMicros($this->_endMicros-$this->_startMicros); + + $tags = []; + foreach ($this->_tags as $key => $value) { + if ($key == 'parent_span_guid') { + continue; + } + $protoTag = new \Lightstep\Collector\KeyValue(); + $protoTag->setKey($key); + $protoTag->setStringValue($value); + $tags[] = $protoTag; + } + $span->setTags($tags); + + $logs = []; + foreach ($this->_logRecords as $log) { + $logs[] = $log->toProto(); + } + $span->setLogs($logs); + + if ($this->getParentGUID() != NULL) { + $spanContext = new SpanContext(); + $spanContext->setSpanId(Util::hexdec($this->getParentGUID())); + + $ref = new Reference(); + $ref->setSpanContext($spanContext); + $ref->setRelationship(Relationship::CHILD_OF); + $span->setReferences([$ref]); + } + + return $span; + } } diff --git a/lib/Client/ClientTracer.php b/lib/Client/ClientTracer.php index 27d3e2c6..3747b9d7 100644 --- a/lib/Client/ClientTracer.php +++ b/lib/Client/ClientTracer.php @@ -9,6 +9,7 @@ require_once(dirname(__FILE__) . "/Util.php"); require_once(dirname(__FILE__) . "/Transports/TransportUDP.php"); require_once(dirname(__FILE__) . "/Transports/TransportHTTPJSON.php"); +require_once(dirname(__FILE__) . "/Transports/TransportHTTPPROTO.php"); require_once(dirname(__FILE__) . "/Version.php"); require_once(dirname(__FILE__) . "/Auth.php"); require_once(dirname(__FILE__) . "/Runtime.php"); @@ -38,7 +39,6 @@ class ClientTracer implements \LightStepBase\Tracer { protected $_reportStartTime = 0; protected $_spanRecords = []; protected $_counters = [ - 'dropped_logs' => 0, 'dropped_counters' => 0, ]; @@ -91,6 +91,8 @@ public function __construct($options = []) { if ($this->_options['transport'] == 'udp') { $this->_transport = new Transports\TransportUDP(); + } if ($this->_options['transport'] == 'http_proto') { + $this->_transport = new Transports\TransportHTTPPROTO(); } else { $this->_transport = new Transports\TransportHTTPJSON(); } @@ -437,10 +439,7 @@ public function _generateStableUUID($token, $group) { * Generates a random ID (not a RFC-4122 UUID). */ public function _generateUUIDString() { - return sprintf("%08x%08x", - $this->_util->randInt32(), - $this->_util->randInt32() - ); + return $this->_util->_generateUUIDString(); } /** diff --git a/lib/Client/KeyValue.php b/lib/Client/KeyValue.php index 40ee7b6f..8b9fad51 100644 --- a/lib/Client/KeyValue.php +++ b/lib/Client/KeyValue.php @@ -46,4 +46,14 @@ public function toThrift() 'Value' => $this->_value, ]); } + + /** + * @return \Lightstep\Collector\KeyValue A Proto representation of this object. + */ + public function toProto() { + $kv = new \Lightstep\Collector\KeyValue(); + $kv->setKey($this->_key); + $kv->setStringValue($this->_value); + return $kv; + } } \ No newline at end of file diff --git a/lib/Client/LogRecord.php b/lib/Client/LogRecord.php index 7a3c040b..156230b4 100644 --- a/lib/Client/LogRecord.php +++ b/lib/Client/LogRecord.php @@ -2,6 +2,9 @@ namespace LightStepBase\Client; +use Lightstep\Collector\Log; +use Google\Protobuf\Timestamp; + /** * Class LogRecord Encapsulates the fields of a log message. @@ -10,6 +13,7 @@ class LogRecord { protected $_fields = null; + private $_util = null; /** * LogRecord constructor. @@ -17,6 +21,7 @@ class LogRecord */ public function __construct($fields) { $this->_fields = $fields; + $this->_util = new Util(); } /** @@ -41,4 +46,41 @@ public function toThrift() { 'timestamp_micros' => $ts ]); } + + /** + * @return Log A Proto representation of this object. + */ + public function toProto() { + $logTime = NULL; + if (array_key_exists('timestamp_micros', $this->_fields)) { + $logTime = $this->_fields['timestamp_micros']; + } else { + $logTime = intval($this->_util->nowMicros()); + } + + $protoTime = new Timestamp(); + $protoTime->setSeconds(floor($logTime / 1000000)); + $protoTime->setNanos($logTime % 1000000); + + $protoLog = new Log(); + $protoLog->setTimestamp($protoTime); + + $keyValues = []; + foreach ($this->_fields as $key => $value) { + if (!$key || !$value) { + continue; + } + if ($key == 'timestamp_micros') { + continue; + } + $keyValue = new \Lightstep\Collector\KeyValue(); + $keyValue->setKey($key); + $keyValue->setStringValue($value); + $keyValues[] = $keyValue; + }; + + $protoLog->setFields($keyValues); + + return $protoLog; + } } \ No newline at end of file diff --git a/lib/Client/ReportRequest.php b/lib/Client/ReportRequest.php index 1ec38bfe..2571806a 100644 --- a/lib/Client/ReportRequest.php +++ b/lib/Client/ReportRequest.php @@ -2,6 +2,9 @@ namespace LightStepBase\Client; +use Lightstep\Collector\MetricsSample; +use Lightstep\Collector\InternalMetrics; +use Lightstep\Collector\ReportRequest as ProtoReportRequest; /** * Class ReportRequest encapsulates all of the information required to make an RPC call to the LightStep satellite. @@ -58,4 +61,32 @@ public function toThrift() { 'counters' => $thriftCounters, ]); } + + /** + * @param Auth $auth + * @return ProtoReportRequest A Proto representation of this object. + */ + public function toProto($auth) { + $counts = []; + foreach ($this->_counters as $key => $value) { + $count = new MetricsSample(); + $count->setName(strval($key)); + $count->setIntValue(intval($value)); + $counts[] = $count; + } + $internalMetrics = new InternalMetrics(); + $internalMetrics->setCounts($counts); + + $spans = []; + foreach ($this->_spanRecords as $sr) { + $spans[] = $sr->toProto(); + } + $report = new ProtoReportRequest(); + $report->setAuth($auth->toProto()); + $report->setInternalMetrics($internalMetrics); + $report->setReporter($this->_runtime->toProto()); + $report->setSpans($spans); + + return $report; + } } \ No newline at end of file diff --git a/lib/Client/Runtime.php b/lib/Client/Runtime.php index 8b402159..a47a9e15 100644 --- a/lib/Client/Runtime.php +++ b/lib/Client/Runtime.php @@ -1,6 +1,9 @@ _attrs as $attr) { - $thriftAttrs[] = new \CroutonThrift\KeyValue($attr->GetKey(), $attr->GetValue()); + $thriftAttrs[] = $attr->toThrift(); } return new \CroutonThrift\Runtime([ 'guid' => $this->_guid, @@ -50,4 +53,24 @@ public function toThrift() 'attrs' => $thriftAttrs, ]); } + + /** + * @return Reporter A Proto representation of this object. + */ + public function toProto() { + $tags = []; + foreach ($this->_attrs as $attr) { + $tag = $attr->toProto(); + $tags[] = $tag; + } + $componentName = new KeyValue(); + $componentName->setKey('lightstep.component_name'); + $componentName->setStringValue($this->_group_name); + $tags[] = $componentName; + + $runtime = new Reporter(); + $runtime->setTags($tags); + $runtime->setReporterId(Util::hexdec($this->_guid)); + return $runtime; + } } \ No newline at end of file diff --git a/lib/Client/Transports/TransportHTTPPROTO.php b/lib/Client/Transports/TransportHTTPPROTO.php new file mode 100644 index 00000000..9aff63d1 --- /dev/null +++ b/lib/Client/Transports/TransportHTTPPROTO.php @@ -0,0 +1,59 @@ +_verbose = $options['verbose']; + + $this->_host = $options['collector_host']; + $this->_port = $options['collector_port']; + + // The prefixed protocol is only needed for secure connections + if ($options['collector_secure'] == True) { + $this->_host = "ssl://" . $this->_host; + } + } + + public function flushReport($auth, $report) { + if (is_null($auth) || is_null($report)) { + if ($this->_verbose > 0) { + error_log("Auth or report not set."); + } + return null; + } + + $content = $report->toProto($auth)->serializeToString(); + + if ($this->_verbose >= 3) { + var_dump($content); + } + + $header = "Host: " . $this->_host . "\r\n"; + $header .= "User-Agent: LightStep-PHP\r\n"; + $header .= "Accept: application/octet-stream\r\n"; + $header .= "Content-Type: application/octet-stream\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "Connection: keep-alive\r\n\r\n"; + + // Use a persistent connection when possible + $fp = @pfsockopen($this->_host, $this->_port, $errno, $errstr); + if (!$fp) { + if ($this->_verbose > 0) { + error_log($errstr); + } + return null; + } + + @fwrite($fp, "POST /api/v2/reports HTTP/1.1\r\n"); + @fwrite($fp, $header . $content); + @fflush($fp); + @fclose($fp); + + return null; + } +} diff --git a/lib/Client/Util.php b/lib/Client/Util.php index b6d3fba8..c7dc6d66 100644 --- a/lib/Client/Util.php +++ b/lib/Client/Util.php @@ -26,18 +26,31 @@ public function randInt32() { return $this->_rng->int32(); } + /** + * Generates a random ID (not a RFC-4122 UUID). + */ + public function _generateUUIDString() { + // must return less than 7fffffffffffffff + + return sprintf("%08x%08x", + $this->randInt32(), + $this->randInt32() + ); + } + public static function nowMicros() { // Note: microtime returns the current time *in seconds* but with // microsecond accuracy (not the current time in microseconds!). return floor(microtime(TRUE) * 1000.0 * 1000.0); } - public function pushWithMax(&$arr, $item, $max) { + public function pushWithMax(&$arr, $item, $max) + { if (!($max > 0)) { $max = 1; } - $arr[] = $item; + $arr[] = $item; // Simplistic random discard $count = count($arr); @@ -49,4 +62,30 @@ public function pushWithMax(&$arr, $item, $max) { return false; } } + + public static function hexdec($input) { + $str_high = substr($input, 0, 8); + $str_low = substr($input, 8, 8); + + $dec_high = hexdec($str_high); + $dec_low = hexdec($str_low); + + //workaround for argument 0x100000000 + $temp = bcmul($dec_high, 0xffffffff); + $temp2 = bcadd($temp, $dec_high); + + $result = bcadd($temp2, $dec_low); + + return $result; + } + + public static function dechex($dec) { + $hex = ''; + do { + $last = bcmod($dec, 16); + $hex = dechex($last).$hex; + $dec = bcdiv(bcsub($dec, $last), 16); + } while($dec>0); + return str_pad($hex, 16, "0", STR_PAD_LEFT); + } } diff --git a/lib/LightStep.php b/lib/LightStep.php index 7f427944..3f753bfd 100644 --- a/lib/LightStep.php +++ b/lib/LightStep.php @@ -4,6 +4,20 @@ require_once(__DIR__ . '/vendor/Thrift/Type/TType.php'); require_once(__DIR__ . '/Client/ClientTracer.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Auth.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/KeyValue.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Log.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/MetricsSample.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/InternalMetrics.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Reference.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Reference/Relationship.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/ReportRequest.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Reporter.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/SpanContext.php'); +require_once(__DIR__ . '/generated/Lightstep/Collector/Span.php'); +require_once(__DIR__ . '/generated/GPBMetadata/Collector.php'); +require_once(__DIR__ . '/generated/GPBMetadata/Google/Api/Annotations.php'); +require_once(__DIR__ . '/generated/GPBMetadata/Google/Api/Http.php'); class LightStep { diff --git a/lib/generated/GPBMetadata/Google/Api/Annotations.php b/lib/generated/GPBMetadata/Google/Api/Annotations.php new file mode 100644 index 00000000..47d624d8 --- /dev/null +++ b/lib/generated/GPBMetadata/Google/Api/Annotations.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile(hex2bin( + "0ac4010a1c676f6f676c652f6170692f616e6e6f746174696f6e732e7072" . + "6f746f120a676f6f676c652e6170691a20676f6f676c652f70726f746f62" . + "75662f64657363726970746f722e70726f746f426e0a0e636f6d2e676f6f" . + "676c652e6170694210416e6e6f746174696f6e7350726f746f50015a4167" . + "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . + "6c65617069732f6170692f616e6e6f746174696f6e733b616e6e6f746174" . + "696f6e73a2020447415049620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/lib/generated/GPBMetadata/Google/Api/Http.php b/lib/generated/GPBMetadata/Google/Api/Http.php new file mode 100644 index 00000000..9c3a1bcd --- /dev/null +++ b/lib/generated/GPBMetadata/Google/Api/Http.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile(hex2bin( + "0aa2040a15676f6f676c652f6170692f687474702e70726f746f120a676f" . + "6f676c652e61706922540a044874747012230a0572756c65731801200328" . + "0b32142e676f6f676c652e6170692e4874747052756c6512270a1f66756c" . + "6c795f6465636f64655f72657365727665645f657870616e73696f6e1802" . + "200128082281020a084874747052756c6512100a0873656c6563746f7218" . + "0120012809120d0a036765741802200128094800120d0a03707574180320" . + "0128094800120e0a04706f7374180420012809480012100a0664656c6574" . + "651805200128094800120f0a0570617463681806200128094800122f0a06" . + "637573746f6d18082001280b321d2e676f6f676c652e6170692e43757374" . + "6f6d487474705061747465726e4800120c0a04626f647918072001280912" . + "150a0d726573706f6e73655f626f6479180c2001280912310a1361646469" . + "74696f6e616c5f62696e64696e6773180b2003280b32142e676f6f676c65" . + "2e6170692e4874747052756c6542090a077061747465726e222f0a114375" . + "73746f6d487474705061747465726e120c0a046b696e6418012001280912" . + "0c0a0470617468180220012809426a0a0e636f6d2e676f6f676c652e6170" . + "6942094874747050726f746f50015a41676f6f676c652e676f6c616e672e" . + "6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f616e" . + "6e6f746174696f6e733b616e6e6f746174696f6e73f80101a20204474150" . + "49620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/lib/generated/Google/Api/CustomHttpPattern.php b/lib/generated/Google/Api/CustomHttpPattern.php new file mode 100644 index 00000000..269c8837 --- /dev/null +++ b/lib/generated/Google/Api/CustomHttpPattern.php @@ -0,0 +1,101 @@ +google.api.CustomHttpPattern + */ +class CustomHttpPattern extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + */ + private $kind = ''; + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + */ + private $path = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kind + * The name of this custom HTTP verb. + * @type string $path + * The path matched by this custom verb. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + * @return string + */ + public function getKind() + { + return $this->kind; + } + + /** + * The name of this custom HTTP verb. + * + * Generated from protobuf field string kind = 1; + * @param string $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkString($var, True); + $this->kind = $var; + + return $this; + } + + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * The path matched by this custom verb. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + +} + diff --git a/lib/generated/Google/Api/Http.php b/lib/generated/Google/Api/Http.php new file mode 100644 index 00000000..dd1e3fad --- /dev/null +++ b/lib/generated/Google/Api/Http.php @@ -0,0 +1,123 @@ +google.api.Http + */ +class Http extends \Google\Protobuf\Internal\Message +{ + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + */ + private $rules; + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + */ + private $fully_decode_reserved_expansion = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $rules + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * @type bool $fully_decode_reserved_expansion + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * A list of HTTP configuration rules that apply to individual API methods. + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * Generated from protobuf field repeated .google.api.HttpRule rules = 1; + * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); + $this->rules = $arr; + + return $this; + } + + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + * @return bool + */ + public function getFullyDecodeReservedExpansion() + { + return $this->fully_decode_reserved_expansion; + } + + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * Generated from protobuf field bool fully_decode_reserved_expansion = 2; + * @param bool $var + * @return $this + */ + public function setFullyDecodeReservedExpansion($var) + { + GPBUtil::checkBool($var); + $this->fully_decode_reserved_expansion = $var; + + return $this; + } + +} + diff --git a/lib/generated/Google/Api/HttpRule.php b/lib/generated/Google/Api/HttpRule.php new file mode 100644 index 00000000..bb01fb2a --- /dev/null +++ b/lib/generated/Google/Api/HttpRule.php @@ -0,0 +1,560 @@ +.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * This definition enables an automatic, bidrectional mapping of HTTP + * JSON to RPC. Example: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * In general, not only fields but also field paths can be referenced + * from a path pattern. Fields mapped to the path pattern cannot be + * repeated and must have a primitive (non-message) type. + * Any fields in the request message which are not bound by the path + * pattern automatically become (optional) HTTP query + * parameters. Assume the following definition of the request message: + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * int64 revision = 2; // becomes a parameter + * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * } + * This enables a HTTP JSON to RPC mapping as below: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * Note that fields which are mapped to HTTP parameters must have a + * primitive type or a repeated primitive type. Message types are not + * allowed. In the case of a repeated type, the parameter can be + * repeated in the URL, as in `...?param=A¶m=B`. + * For HTTP method kinds which allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * The following HTTP JSON to RPC mapping is enabled: + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice of + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * This enables the following two alternative HTTP JSON to RPC + * mappings: + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * # Rules for HTTP mapping + * The rules for mapping HTTP path, query parameters, and body fields + * to the request message are as follows: + * 1. The `body` field specifies either `*` or a field path, or is + * omitted. If omitted, it indicates there is no HTTP request body. + * 2. Leaf fields (recursive expansion of nested messages in the + * request) can be classified into three types: + * (a) Matched in the URL template. + * (b) Covered by body (if body is `*`, everything except (a) fields; + * else everything under the body field) + * (c) All other fields. + * 3. URL query parameters found in the HTTP request are mapped to (c) fields. + * 4. Any body sent with an HTTP request can contain only (b) fields. + * The syntax of the path template is as follows: + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * The syntax `*` matches a single path segment. The syntax `**` matches zero + * or more path segments, which must be the last part of the path except the + * `Verb`. The syntax `LITERAL` matches literal text in the path. + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path, all characters + * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the + * Discovery Document as `{var}`. + * If a variable contains one or more path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path, all + * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables + * show up in the Discovery Document as `{+var}`. + * NOTE: While the single segment variable matches the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 + * Simple String Expansion, the multi segment variable **does not** match + * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. + * NOTE: the field paths in variables and in the `body` must not refer to + * repeated fields or map fields. + * + * Generated from protobuf message google.api.HttpRule + */ +class HttpRule extends \Google\Protobuf\Internal\Message +{ + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + */ + private $selector = ''; + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + */ + private $body = ''; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + */ + private $response_body = ''; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + */ + private $additional_bindings; + protected $pattern; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * @type string $get + * Used for listing and getting information about resources. + * @type string $put + * Used for updating a resource. + * @type string $post + * Used for creating a resource. + * @type string $delete + * Used for deleting a resource. + * @type string $patch + * Used for updating a resource. + * @type \Google\Api\CustomHttpPattern $custom + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * @type string $body + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * @type string $response_body + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $additional_bindings + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Http::initOnce(); + parent::__construct($data); + } + + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects methods to which this rule applies. + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Used for listing and getting information about resources. + * + * Generated from protobuf field string get = 2; + * @return string + */ + public function getGet() + { + return $this->readOneof(2); + } + + /** + * Used for listing and getting information about resources. + * + * Generated from protobuf field string get = 2; + * @param string $var + * @return $this + */ + public function setGet($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string put = 3; + * @return string + */ + public function getPut() + { + return $this->readOneof(3); + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string put = 3; + * @param string $var + * @return $this + */ + public function setPut($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Used for creating a resource. + * + * Generated from protobuf field string post = 4; + * @return string + */ + public function getPost() + { + return $this->readOneof(4); + } + + /** + * Used for creating a resource. + * + * Generated from protobuf field string post = 4; + * @param string $var + * @return $this + */ + public function setPost($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Used for deleting a resource. + * + * Generated from protobuf field string delete = 5; + * @return string + */ + public function getDelete() + { + return $this->readOneof(5); + } + + /** + * Used for deleting a resource. + * + * Generated from protobuf field string delete = 5; + * @param string $var + * @return $this + */ + public function setDelete($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string patch = 6; + * @return string + */ + public function getPatch() + { + return $this->readOneof(6); + } + + /** + * Used for updating a resource. + * + * Generated from protobuf field string patch = 6; + * @param string $var + * @return $this + */ + public function setPatch($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; + * @return \Google\Api\CustomHttpPattern + */ + public function getCustom() + { + return $this->readOneof(8); + } + + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; + * @param \Google\Api\CustomHttpPattern $var + * @return $this + */ + public function setCustom($var) + { + GPBUtil::checkMessage($var, \Google\Api\CustomHttpPattern::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * Generated from protobuf field string body = 7; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + * @return string + */ + public function getResponseBody() + { + return $this->response_body; + } + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * Generated from protobuf field string response_body = 12; + * @param string $var + * @return $this + */ + public function setResponseBody($var) + { + GPBUtil::checkString($var, True); + $this->response_body = $var; + + return $this; + } + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalBindings() + { + return $this->additional_bindings; + } + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; + * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalBindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); + $this->additional_bindings = $arr; + + return $this; + } + + /** + * @return string + */ + public function getPattern() + { + return $this->whichOneof("pattern"); + } + +} + diff --git a/test/ProtoTypesTest.php b/test/ProtoTypesTest.php new file mode 100644 index 00000000..87abf01c --- /dev/null +++ b/test/ProtoTypesTest.php @@ -0,0 +1,236 @@ +toProto(); + + $this->assertTrue($protoAuth instanceof \Lightstep\Collector\Auth); + $this->assertEquals(ACCESS_TOKEN, $protoAuth->getAccessToken()); + } + + public function testClientSpanToProto() { + $tracer = new \LightStepBase\Client\ClientTracer(); + $span = new \LightStepBase\Client\ClientSpan($tracer, 5); + $span->setOperationName("my_operation"); + $span->setStartMicros(1538476581123456); + $span->setEndMicros(1538476581124456); + $span->setParentGUID("513887a3b3f460d8"); + $span->setTag("my_key", "my_value"); + $span->logEvent("something happened"); + $protoSpan = $span->toProto(); + + $this->assertTrue($protoSpan instanceof \Lightstep\Collector\Span); + + $protoSpanContext = $protoSpan->getSpanContext(); + $this->assertTrue($protoSpanContext instanceof \Lightstep\Collector\SpanContext); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->traceGUID()), $protoSpanContext->getTraceId()); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->guid()), $protoSpanContext->getSpanId()); + $this->assertEquals(0, count($protoSpanContext->getBaggage())); + + $this->assertEquals("my_operation", $protoSpan->getOperationName()); + $this->assertEquals(1538476581, $protoSpan->getStartTimestamp()->getSeconds()); + $this->assertEquals(123456, $protoSpan->getStartTimestamp()->getNanos()); + $this->assertEquals(1000, $protoSpan->getDurationMicros()); + + $references = $protoSpan->getReferences(); + $this->assertEquals(1, count($references)); + $this->assertEquals(Relationship::CHILD_OF, $references[0]->getRelationship()); + $parentContext = $references[0]->getSpanContext(); + $this->assertTrue($parentContext instanceof \Lightstep\Collector\SpanContext); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->getParentGUID()), $parentContext->getSpanId()); + $this->assertEquals(0, count($parentContext->getBaggage())); + + $protoTags = $protoSpan->getTags(); + $this->assertEquals(1, count($protoTags)); + $this->assertEquals("my_key", $protoTags[0]->getKey()); + $this->assertEquals("my_value", $protoTags[0]->getStringValue()); + + $protoLogs = $protoSpan->getLogs(); + $this->assertEquals(1, count($protoLogs)); + $protoLog = $protoLogs[0]; + $this->assertTrue($protoLog->getTimestamp()->getSeconds() > 0); + $fields = $protoLog->getFields(); + $this->assertEquals(3, count($fields)); + $this->assertEquals("span_guid", $fields[0]->getKey()); + $this->assertEquals($span->guid(), $fields[0]->getStringValue()); + $this->assertEquals("event", $fields[1]->getKey()); + $this->assertEquals("something happened", $fields[1]->getStringValue()); + $this->assertEquals("runtime_guid", $fields[2]->getKey()); + $this->assertEquals($span->guid(), $fields[2]->getStringValue()); + } + + public function testKeyValueToProto() { + $keyValue = new \LightStepBase\Client\KeyValue("aKey", "aValue"); + $protoKeyValue = $keyValue->toProto(); + + $this->assertTrue($protoKeyValue instanceof \Lightstep\Collector\KeyValue); + $this->assertEquals("aKey", $protoKeyValue->getKey()); + $this->assertEquals("aValue", $protoKeyValue->getStringValue()); + } + + public function testLogRecordToProtoNoTimestamp() { + $fields = [ + 'level' => 1, + 'message' => "a log message", + ]; + $logRecord = new \LightStepBase\Client\LogRecord($fields); + $protoLog = $logRecord->toProto(); + + $this->assertTrue($protoLog instanceof \Lightstep\Collector\Log); + $protoFields = $protoLog->getFields(); + $this->assertEquals(count($fields), count($protoFields)); + + $this->assertEquals("level", $protoFields[0]->getKey()); + $this->assertEquals("1", $protoFields[0]->getStringValue()); + $this->assertEquals("message", $protoFields[1]->getKey()); + $this->assertEquals("a log message", $protoFields[1]->getStringValue()); + + $this->assertNotNull($protoLog->getTimestamp()); + } + + public function testLogRecordToProtoWithTimestamp() { + $fields = [ + 'level' => 1, + 'message' => "a log message", + 'timestamp_micros' => 1538476581123456, + ]; + $logRecord = new \LightStepBase\Client\LogRecord($fields); + $protoLog = $logRecord->toProto(); + + $this->assertTrue($protoLog instanceof \Lightstep\Collector\Log); + $protoFields = $protoLog->getFields(); + $this->assertEquals(count($fields)-1, count($protoFields)); + + $this->assertEquals("level", $protoFields[0]->getKey()); + $this->assertEquals("1", $protoFields[0]->getStringValue()); + $this->assertEquals("message", $protoFields[1]->getKey()); + $this->assertEquals("a log message", $protoFields[1]->getStringValue()); + + $this->assertNotNull($protoLog->getTimestamp()); + $this->assertEquals(1538476581, $protoLog->getTimestamp()->getSeconds()); + $this->assertEquals(123456, $protoLog->getTimestamp()->getNanos()); + } + + public function testReporterToProto() { + $guid = "60f81da67a8ff833"; + $start = 1538476581123456; + $group = "my_component"; + $attr = new \LightStepBase\Client\KeyValue("my_key", "my_value"); + $runtime = new \LightStepBase\Client\Runtime($guid, $start, $group, [$attr]); + $protoReporter = $runtime->toProto(); + + $this->assertTrue($protoReporter instanceof \Lightstep\Collector\Reporter); + $this->assertEquals(6987367422723356723, $protoReporter->getReporterId()); + $this->assertEquals(2, count($protoReporter->getTags())); + $this->assertEquals("my_key", $protoReporter->getTags()[0]->getKey()); + $this->assertEquals("my_value", $protoReporter->getTags()[0]->getStringValue()); + $this->assertEquals("lightstep.component_name", $protoReporter->getTags()[1]->getKey()); + $this->assertEquals("my_component", $protoReporter->getTags()[1]->getStringValue()); + } + + public function testReportRequestToProto() { + $auth = new \LightStepBase\Client\Auth(ACCESS_TOKEN); + $guid = "60f81da67a8ff833"; + $start = 1538476581123456; + $group = "my_component"; + $attr = new \LightStepBase\Client\KeyValue("my_key", "my_value"); + $runtime = new \LightStepBase\Client\Runtime($guid, $start, $group, [$attr]); + + $tracer = new \LightStepBase\Client\ClientTracer(); + $span = new \LightStepBase\Client\ClientSpan($tracer, 5); + $span->setOperationName("my_operation"); + $span->setStartMicros(1538476581123456); + $span->setEndMicros(1538476581124456); + $span->setParentGUID("513887a3b3f460d8"); + $span->setTag("my_key", "my_value"); + $span->logEvent("something happened"); + + $counters = ['dropped_counters' => 22]; + + $start = 1538476581123456; + $now = Util::nowMicros(); + $reportRequest = new \LightStepBase\Client\ReportRequest($runtime, $start, $now, [$span], $counters); + + $protoReportRequest = $reportRequest->toProto($auth); + $this->assertTrue($protoReportRequest instanceof \Lightstep\Collector\ReportRequest); + + // verify reporter + $protoReporter = $protoReportRequest->getReporter(); + $this->assertTrue($protoReporter instanceof \Lightstep\Collector\Reporter); + $this->assertEquals(6987367422723356723, $protoReporter->getReporterId()); + $this->assertEquals(2, count($protoReporter->getTags())); + $this->assertEquals("my_key", $protoReporter->getTags()[0]->getKey()); + $this->assertEquals("my_value", $protoReporter->getTags()[0]->getStringValue()); + $this->assertEquals("lightstep.component_name", $protoReporter->getTags()[1]->getKey()); + $this->assertEquals("my_component", $protoReporter->getTags()[1]->getStringValue()); + + // verify timestamp offset micros + $this->assertEquals(0, $protoReportRequest->getTimestampOffsetMicros()); + + // verify auth + $protoAuth = $protoReportRequest->getAuth(); + $this->assertTrue($protoAuth instanceof \Lightstep\Collector\Auth); + $this->assertEquals(ACCESS_TOKEN, $protoAuth->getAccessToken()); + + // verify internal metrics + $protoMetrics = $protoReportRequest->getInternalMetrics(); + $this->assertTrue($protoMetrics instanceof \Lightstep\Collector\InternalMetrics); + $this->assertEquals(0, count($protoMetrics->getLogs())); + $this->assertEquals(0, $protoMetrics->getDurationMicros()); + $this->assertEquals(0, $protoMetrics->getStartTimestamp()); + $this->assertEquals(0, count($protoMetrics->getGauges())); + $this->assertEquals(1, count($protoMetrics->getCounts())); + $count = $protoMetrics->getCounts()[0]; + $this->assertEquals("dropped_counters", $count->getName()); + $this->assertEquals(22, $count->getIntValue()); + + // verify Spans + $protoSpans = $protoReportRequest->getSpans(); + $this->assertEquals(1, count($protoSpans)); + $protoSpan = $protoSpans[0]; + $this->assertTrue($protoSpan instanceof \Lightstep\Collector\Span); + + $protoSpanContext = $protoSpan->getSpanContext(); + $this->assertTrue($protoSpanContext instanceof \Lightstep\Collector\SpanContext); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->traceGUID()), $protoSpanContext->getTraceId()); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->guid()), $protoSpanContext->getSpanId()); + $this->assertEquals(0, count($protoSpanContext->getBaggage())); + + $this->assertEquals("my_operation", $protoSpan->getOperationName()); + $this->assertEquals(1538476581, $protoSpan->getStartTimestamp()->getSeconds()); + $this->assertEquals(123456, $protoSpan->getStartTimestamp()->getNanos()); + $this->assertEquals(1000, $protoSpan->getDurationMicros()); + + $references = $protoSpan->getReferences(); + $this->assertEquals(1, count($references)); + $this->assertEquals(Relationship::CHILD_OF, $references[0]->getRelationship()); + $parentContext = $references[0]->getSpanContext(); + $this->assertTrue($parentContext instanceof \Lightstep\Collector\SpanContext); + $this->assertEquals(\LightStepBase\Client\Util::hexdec($span->getParentGUID()), $parentContext->getSpanId()); + $this->assertEquals(0, count($parentContext->getBaggage())); + + $protoTags = $protoSpan->getTags(); + $this->assertEquals(1, count($protoTags)); + $this->assertEquals("my_key", $protoTags[0]->getKey()); + $this->assertEquals("my_value", $protoTags[0]->getStringValue()); + + $protoLogs = $protoSpan->getLogs(); + $this->assertEquals(1, count($protoLogs)); + $protoLog = $protoLogs[0]; + $this->assertTrue($protoLog->getTimestamp()->getSeconds() > 0); + $fields = $protoLog->getFields(); + $this->assertEquals(3, count($fields)); + $this->assertEquals("span_guid", $fields[0]->getKey()); + $this->assertEquals($span->guid(), $fields[0]->getStringValue()); + $this->assertEquals("event", $fields[1]->getKey()); + $this->assertEquals("something happened", $fields[1]->getStringValue()); + $this->assertEquals("runtime_guid", $fields[2]->getKey()); + $this->assertEquals($span->guid(), $fields[2]->getStringValue()); + } +} diff --git a/test/UtilTest.php b/test/UtilTest.php new file mode 100644 index 00000000..6abfdb70 --- /dev/null +++ b/test/UtilTest.php @@ -0,0 +1,16 @@ +_generateUUIDString(); + $uuidInt = Util::hexdec($uuidStr); + $this->assertTrue($uuidInt > 0); + $this->assertEquals($uuidStr, Util::dechex($uuidInt)); + } + } +} \ No newline at end of file