All Projects → weiboad → fierysdk

weiboad / fierysdk

Licence: Apache-2.0 license
ragnar fiery php sdk

Programming Languages

PHP
23972 projects - #3 most used programming language

Labels

Projects that are alternatives of or similar to fierysdk

Pinpoint C Agent
It is an agent written by C++, PHP, python languages. And we hope to support other languages by this agent. Until now, it supports [PHP],[C/C++] and [PYTHON].
Stars: ✭ 188 (+347.62%)
Mutual labels:  apm
Androidgodeye
An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser
Stars: ✭ 2,430 (+5685.71%)
Mutual labels:  apm
Cat
CAT 作为服务端项目基础组件,提供了 Java, C/C++, Node.js, Python, Go 等多语言客户端,已经在美团点评的基础架构中间件框架(MVC框架,RPC框架,数据库框架,缓存框架等,消息队列,配置系统等)深度集成,为美团点评各业务线提供系统丰富的性能指标、健康状况、实时告警等。
Stars: ✭ 16,236 (+38557.14%)
Mutual labels:  apm
Log4net.elasticsearch
log4net appender to ElasticSearch
Stars: ✭ 202 (+380.95%)
Mutual labels:  apm
Skywalking Kubernetes
Apache SkyWalking Kubernetes Deployment Helm Chart
Stars: ✭ 207 (+392.86%)
Mutual labels:  apm
Dd Trace Js
JavaScript APM Tracer
Stars: ✭ 212 (+404.76%)
Mutual labels:  apm
Scouter Paper
scouter-paper is a web client software for scouter
Stars: ✭ 183 (+335.71%)
Mutual labels:  apm
meteor-elastic-apm
Meteor Elastic APM integration
Stars: ✭ 56 (+33.33%)
Mutual labels:  apm
Argusapm
Powerful, comprehensive (Android) application performance management platform. 360线上移动性能检测平台
Stars: ✭ 2,452 (+5738.1%)
Mutual labels:  apm
Dd Trace Go
A Go tracing package for Datadog APM
Stars: ✭ 244 (+480.95%)
Mutual labels:  apm
Oknetworkmonitor
A network monitor for OkHttp.
Stars: ✭ 204 (+385.71%)
Mutual labels:  apm
Skywalking Docker
SkyWalking Docker file archive for all official releases
Stars: ✭ 206 (+390.48%)
Mutual labels:  apm
Dd Trace Py
Datadog Python APM Client
Stars: ✭ 220 (+423.81%)
Mutual labels:  apm
Adi
ADI(Android Debug Intensive) 是通过 JVMTI 实现的 Android 应用开发调试的增强工具集,目前主要提供性能相关的监控能力。
Stars: ✭ 194 (+361.9%)
Mutual labels:  apm
tester-jest
Tester Jest is a tester provider for the Atom Tester.
Stars: ✭ 21 (-50%)
Mutual labels:  apm
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+5330.95%)
Mutual labels:  apm
Javamelody
JavaMelody : monitoring of JavaEE applications
Stars: ✭ 2,486 (+5819.05%)
Mutual labels:  apm
tutorials
Tutorials
Stars: ✭ 80 (+90.48%)
Mutual labels:  apm
elastic-stack-testing
Elastic Stack Testing Framework (ESTF) 🤖
Stars: ✭ 47 (+11.9%)
Mutual labels:  apm
Dd Trace Java
Datadog APM client for Java
Stars: ✭ 228 (+442.86%)
Mutual labels:  apm

RagnarSDK

Latest Stable Version Latest Unstable Version License

Other Laguage Introduce: 中文文档

Introduce

  • for the complex system online tracing.
  • support online debug.level log.exception and error collect.performance monitor and depend reloation picture
  • for the https://github.com/weiboad/fiery

Requirement

  • PHP5.3+ with bcmath
  • charset utf-8 project

Step 1 Container Variable

Nginx

copy the nginx/fiery_fastcgi_pararms -> nginx/conf and edit the vhost config

server{
    listen 80;
    charset utf-8;
    root /path/xxx/xxx/src/public;
    server_name xxx.com;
    
    location /{
        index index.php index.html index.htm;
        if (-f $request_filename) {
            break;
        }
        if (-d $request_filename) {
            break;
        }
        if ($request_filename !~ (\.css|images|index\.php.*) ) {
            rewrite ^/(.*)$ /index.php/$1 last;
            break;
        }
    }

    location ~ /index.php/ {
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        include fiery_fastcgi_params; # here is the point
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_read_timeout 600;
    }

    location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        include fiery_fastcgi_params; # here is the point
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_read_timeout 600;
    }
}
# reload the nginx config
nginx -s reload

Apache
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "e:\wwwroot\demo"
    ServerName my.demo.com
    ErrorLog "logs/my.demo.com-error.log"
    CustomLog "logs/my.demo.com-access.log" common
    
    # start config the variable for fierysdk
    SetEnv RAGNAR_LOGPATH /data1/ragnar/  # here is the point
    SetEnv RAGNAR_IDC 0  # here is the point
    SetEnv RAGNAR_IP 192.168.1.123  # here is the point

    <Directory "e:\wwwroot\demo">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Fierysdk Install

Run command to get this composer

composer require weiboad/fierysdk

insert code on the bootstrap of php project

    require_once("vendor/autoload.php");
    
    
    use \Adinf\RagnarSDK\RagnarSDK as RagnarSDK;
    use \Adinf\RagnarSDK\RagnarConst as RagnarConst;
    
    //for the Temporary disable this sdk
    //RagnarSDK::disable();
    
    //default log level is info you can Temporary open the debug level by send header
    RagnarSDK::setLogLevel(RagnarConst::LOG_TYPE_INFO); 
    
    //filter url
    //when the url contained parameter on path such as 
    //http://wwwei.com/usr/$uid(an var alway change)/fetch 
    //you must write an rule on this callback filted to http://wwwei.com/usr/releaced/fetch
    
    RagnarSDK::setUrlFilterCallback(function ($url, $hashquery) {
        if (trim($url) == "") {
            return "";
        }
        if (stripos($url, 'http') !== 0) {
            $url = "http://" . $url;
        }

        $urlinfo = parse_url($url);

        if(!$urlinfo){
            return $url."#PARSERERROR";
        }

        if (!isset($urlinfo["scheme"])) {
            $urlinfo["scheme"] = "http";
        }

        if (!isset($urlinfo["path"])) {
            $urlinfo["path"] = "/";
        }

        if (!isset($urlinfo["query"])) {
            $urlinfo["query"] = "";
        }

        if ($hashquery) {
            return $urlinfo["scheme"] . "://" . $urlinfo["host"] . $urlinfo["path"] . "?" . $urlinfo["query"];
        } else {
            return $urlinfo["scheme"] . "://" . $urlinfo["host"] . $urlinfo["path"];
        }
     });
         
    //this must run at latest
    //ragnar_projectname is you project name will use on log folder name
    RagnarSDK::init("ragnar_projectname");
    
    //Ragnar level log example
    // this is info log you can see this on tracing page on fiery 
    RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_INFO, __FILE__, __LINE__, "module1_msg", array("msg"=>"i wish i can fly!"));
    
    // this is debug log 
    RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_DEBUG, __FILE__, __LINE__, "module2_msg",array("msg"=>"i wish im rich!");
    
    //customize performance dig point example will display on tracing page on fiery
    //dig start
    $digpooint = RagnarSDK::digLogStart(__FILE__,__LINE__,"ragnar_test");
    
        //run something.....
    //dig end
    RagnarSDK::digLogEnd($digpooint,array("happy"=>1));
    

Ragnar level log

  • level log:set the log level to decide the customize log to dump
  • log search:all the log in the level will be show on the tracing page.
  • exception and error:will be show on the error statistic page
  • performance:a easy way the record the function cost time and make an statistics on curl mysql api

log level

  • LOG_TYPE_TRACE trace log for the low level debug
  • LOG_TYPE_DEBUG Debug log
  • LOG_TYPE_NOTICE notice log on the system
  • LOG_TYPE_INFO info for the tips the working status
  • LOG_TYPE_ERROR when the system error will record this level
  • LOG_TYPE_EMEGENCY emegency log that will send SMS or Email to admin
  • LOG_TYPE_EXCEPTION Exception log
  • LOG_TYPE_PERFORMENCE performance log all the dig point will use this

Curl dig point

curl dig point

    //curl must fill
    $digpooint = RagnarSDK::digLogStart(__FILE__, __LINE__, "curl");
    
    //curl init ....
    
    $nextrpcidheader = RagnarSDK::getCurlChildCallParam($digpooint);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER, $nextrpcidheader);
    
    $result = //curl exec ...
    
    $ext = array("errorno" => $errno, "error" => curl_error($this->ch));
    $info = curl_getinfo($this->ch);
    
    //digCurlEnd($digPoint, $url, $method, $postParam, $getParam, $curlInfo, $errCode, $errMsg, $result)
    
    RagnarSDK::digLogEnd($digpooint, array(
                "url" => $info['url'], "method" => self::get_method(),
                "param" => array("post" => $this->post_fields, "get" => $this->query_fields),
                "info" => $info,
                "error" => $ext,
                "result" => json_decode($result,true),//must array
    );

Mysql

Mysql dig point

    //this for record the exception when the error
    RagnarSDK::RecordLog(\Adinf\RagnarSDK\RagnarSDK::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, "mysql", array("fun" => "query", "sql" => $sql, "error" => $ex->getMessage()));
    
    //start monitor the performance
    $digPoint = RagnarSDK::digLogStart(__FILE__, __LINE__, "mysql");
    
    //do some sql execute
    
    //for the mysql performance dig point end
    //RagnarSDK::digLogEnd($digPoint, array("sql" => $sql, "data" => "sql的参数", "op" => "select\delete\update\...", "fun" => "execute_sql"));
    RagnarSDK::digMysqlEnd($digPoint, $sql, "sql的参数", "select\delete\update\...", "execute_sql");
    //if is error
    if(error){
        RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, "mysql", array("fun" => "execute", "sql" => $sql, "error" => $error));
    }

Temporary change

online change the log level by send header

    X-RAGNAR-TRACEID   traceid
    X-RAGNAR-RPCID     rpcid (spanid)
    X-RAGNAR-LOGLEVEL  log level
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].