{"id":36980128,"url":"https://github.com/weiboad/fierysdk","last_synced_at":"2026-01-13T22:49:45.774Z","repository":{"id":57079608,"uuid":"92357724","full_name":"weiboad/fierysdk","owner":"weiboad","description":"ragnar fiery php sdk","archived":true,"fork":false,"pushed_at":"2018-02-06T09:37:33.000Z","size":40,"stargazers_count":42,"open_issues_count":3,"forks_count":8,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-11-10T04:25:27.598Z","etag":null,"topics":["apm","fiery","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weiboad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-25T02:44:40.000Z","updated_at":"2023-01-28T00:04:45.000Z","dependencies_parsed_at":"2022-08-24T13:10:27.258Z","dependency_job_id":null,"html_url":"https://github.com/weiboad/fierysdk","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/weiboad/fierysdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiboad%2Ffierysdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiboad%2Ffierysdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiboad%2Ffierysdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiboad%2Ffierysdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weiboad","download_url":"https://codeload.github.com/weiboad/fierysdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiboad%2Ffierysdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apm","fiery","php"],"created_at":"2026-01-13T22:49:45.689Z","updated_at":"2026-01-13T22:49:45.765Z","avatar_url":"https://github.com/weiboad.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### RagnarSDK\n\n[![Latest Stable Version](https://poser.pugx.org/weiboad/fierysdk/v/stable)](https://packagist.org/packages/weiboad/fierysdk)\n[![Latest Unstable Version](https://poser.pugx.org/weiboad/fierysdk/v/unstable)](https://packagist.org/packages/weiboad/fierysdk)\n[![License](https://poser.pugx.org/weiboad/fierysdk/license)](https://packagist.org/packages/weiboad/fierysdk)\n\nOther Laguage Introduce: [中文文档](./README_CN.md)\n\n### Introduce\n\u003e * for the complex system online tracing.\n\u003e * support online debug.level log.exception and error collect.performance monitor and depend reloation picture\n\u003e * for the https://github.com/weiboad/fiery\n\n### Requirement\n\u003e * PHP5.3+ with bcmath\n\u003e * charset utf-8 project\n\n#### Step 1 Container Variable\n\n##### Nginx\ncopy the nginx/fiery_fastcgi_pararms -\u003e nginx/conf and edit the vhost config\n\n```\nserver{\n    listen 80;\n    charset utf-8;\n    root /path/xxx/xxx/src/public;\n    server_name xxx.com;\n    \n    location /{\n        index index.php index.html index.htm;\n        if (-f $request_filename) {\n            break;\n        }\n        if (-d $request_filename) {\n            break;\n        }\n        if ($request_filename !~ (\\.css|images|index\\.php.*) ) {\n            rewrite ^/(.*)$ /index.php/$1 last;\n            break;\n        }\n    }\n\n    location ~ /index.php/ {\n        fastcgi_index index.php;\n        fastcgi_pass 127.0.0.1:9000;\n        include fastcgi_params;\n        include fiery_fastcgi_params; # here is the point\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_read_timeout 600;\n    }\n\n    location ~ \\.php$ {\n        fastcgi_index index.php;\n        fastcgi_pass 127.0.0.1:9000;\n        include fastcgi_params;\n        include fiery_fastcgi_params; # here is the point\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_read_timeout 600;\n    }\n}\n```\n\n```\n# reload the nginx config\nnginx -s reload\n\n```\n\n###### Apache\n```\n\u003cVirtualHost *:80\u003e\n    ServerAdmin webmaster@demo.com\n    DocumentRoot \"e:\\wwwroot\\demo\"\n    ServerName my.demo.com\n    ErrorLog \"logs/my.demo.com-error.log\"\n    CustomLog \"logs/my.demo.com-access.log\" common\n    \n    # start config the variable for fierysdk\n    SetEnv RAGNAR_LOGPATH /data1/ragnar/  # here is the point\n    SetEnv RAGNAR_IDC 0  # here is the point\n    SetEnv RAGNAR_IP 192.168.1.123  # here is the point\n\n    \u003cDirectory \"e:\\wwwroot\\demo\"\u003e\n        Options Indexes FollowSymLinks\n        AllowOverride All\n        Require all granted\n    \u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n```\n\n#### Fierysdk Install\n\nRun command to get this composer\n```\ncomposer require weiboad/fierysdk\n\n```\ninsert code on the bootstrap of php project\n\n\n```\n    require_once(\"vendor/autoload.php\");\n    \n    \n    use \\Adinf\\RagnarSDK\\RagnarSDK as RagnarSDK;\n    use \\Adinf\\RagnarSDK\\RagnarConst as RagnarConst;\n    \n    //for the Temporary disable this sdk\n    //RagnarSDK::disable();\n    \n    //default log level is info you can Temporary open the debug level by send header\n    RagnarSDK::setLogLevel(RagnarConst::LOG_TYPE_INFO); \n    \n    //filter url\n    //when the url contained parameter on path such as \n    //http://wwwei.com/usr/$uid(an var alway change)/fetch \n    //you must write an rule on this callback filted to http://wwwei.com/usr/releaced/fetch\n    \n    RagnarSDK::setUrlFilterCallback(function ($url, $hashquery) {\n        if (trim($url) == \"\") {\n            return \"\";\n        }\n        if (stripos($url, 'http') !== 0) {\n            $url = \"http://\" . $url;\n        }\n\n        $urlinfo = parse_url($url);\n\n        if(!$urlinfo){\n            return $url.\"#PARSERERROR\";\n        }\n\n        if (!isset($urlinfo[\"scheme\"])) {\n            $urlinfo[\"scheme\"] = \"http\";\n        }\n\n        if (!isset($urlinfo[\"path\"])) {\n            $urlinfo[\"path\"] = \"/\";\n        }\n\n        if (!isset($urlinfo[\"query\"])) {\n            $urlinfo[\"query\"] = \"\";\n        }\n\n        if ($hashquery) {\n            return $urlinfo[\"scheme\"] . \"://\" . $urlinfo[\"host\"] . $urlinfo[\"path\"] . \"?\" . $urlinfo[\"query\"];\n        } else {\n            return $urlinfo[\"scheme\"] . \"://\" . $urlinfo[\"host\"] . $urlinfo[\"path\"];\n        }\n     });\n         \n    //this must run at latest\n    //ragnar_projectname is you project name will use on log folder name\n    RagnarSDK::init(\"ragnar_projectname\");\n    \n    //Ragnar level log example\n    // this is info log you can see this on tracing page on fiery \n    RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_INFO, __FILE__, __LINE__, \"module1_msg\", array(\"msg\"=\u003e\"i wish i can fly!\"));\n    \n    // this is debug log \n    RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_DEBUG, __FILE__, __LINE__, \"module2_msg\",array(\"msg\"=\u003e\"i wish im rich!\");\n    \n    //customize performance dig point example will display on tracing page on fiery\n    //dig start\n    $digpooint = RagnarSDK::digLogStart(__FILE__,__LINE__,\"ragnar_test\");\n    \n        //run something.....\n    //dig end\n    RagnarSDK::digLogEnd($digpooint,array(\"happy\"=\u003e1));\n    \n\n```\n\n### Ragnar level log\n\u003e * level log：set the log level to decide the customize log to dump\n\u003e * log search：all the log in the level will be show on the tracing page.\n\u003e * exception and error：will be show on the error statistic page \n\u003e * performance：a easy way the record the function cost time and make an statistics on curl mysql api\n\n#### log level\n\u003e * LOG_TYPE_TRACE trace log for the low level debug\n\u003e * LOG_TYPE_DEBUG Debug log\n\u003e * LOG_TYPE_NOTICE notice log on the system\n\u003e * LOG_TYPE_INFO  info for the tips the working status\n\u003e * LOG_TYPE_ERROR when the system error will record this level\n\u003e * LOG_TYPE_EMEGENCY emegency log that will send SMS or Email to admin\n\u003e * LOG_TYPE_EXCEPTION Exception log\n\u003e * LOG_TYPE_PERFORMENCE performance log all the dig point will use this\n\n\n#### Curl dig point\ncurl dig point\n\n```\n    //curl must fill\n    $digpooint = RagnarSDK::digLogStart(__FILE__, __LINE__, \"curl\");\n    \n    //curl init ....\n    \n    $nextrpcidheader = RagnarSDK::getCurlChildCallParam($digpooint);\n    curl_setopt($this-\u003ech, CURLOPT_HTTPHEADER, $nextrpcidheader);\n    \n    $result = //curl exec ...\n    \n    $ext = array(\"errorno\" =\u003e $errno, \"error\" =\u003e curl_error($this-\u003ech));\n    $info = curl_getinfo($this-\u003ech);\n    \n    //digCurlEnd($digPoint, $url, $method, $postParam, $getParam, $curlInfo, $errCode, $errMsg, $result)\n    \n    RagnarSDK::digLogEnd($digpooint, array(\n                \"url\" =\u003e $info['url'], \"method\" =\u003e self::get_method(),\n                \"param\" =\u003e array(\"post\" =\u003e $this-\u003epost_fields, \"get\" =\u003e $this-\u003equery_fields),\n                \"info\" =\u003e $info,\n                \"error\" =\u003e $ext,\n                \"result\" =\u003e json_decode($result,true),//must array\n    );\n\n```\n\n#### Mysql\nMysql dig point\n```\n    //this for record the exception when the error\n    RagnarSDK::RecordLog(\\Adinf\\RagnarSDK\\RagnarSDK::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, \"mysql\", array(\"fun\" =\u003e \"query\", \"sql\" =\u003e $sql, \"error\" =\u003e $ex-\u003egetMessage()));\n    \n    //start monitor the performance\n    $digPoint = RagnarSDK::digLogStart(__FILE__, __LINE__, \"mysql\");\n    \n    //do some sql execute\n    \n    //for the mysql performance dig point end\n    //RagnarSDK::digLogEnd($digPoint, array(\"sql\" =\u003e $sql, \"data\" =\u003e \"sql的参数\", \"op\" =\u003e \"select\\delete\\update\\...\", \"fun\" =\u003e \"execute_sql\"));\n    RagnarSDK::digMysqlEnd($digPoint, $sql, \"sql的参数\", \"select\\delete\\update\\...\", \"execute_sql\");\n    //if is error\n    if(error){\n        RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, \"mysql\", array(\"fun\" =\u003e \"execute\", \"sql\" =\u003e $sql, \"error\" =\u003e $error));\n    }\n```\n\n### Temporary change\nonline change the log level by send header\n\n```\n    X-RAGNAR-TRACEID   traceid\n    X-RAGNAR-RPCID     rpcid (spanid)\n    X-RAGNAR-LOGLEVEL  log level\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiboad%2Ffierysdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweiboad%2Ffierysdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiboad%2Ffierysdk/lists"}