Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SkyAPM
SkyAPM-php-sdk
提交
f551879d
S
SkyAPM-php-sdk
项目概览
SkyAPM
/
SkyAPM-php-sdk
通知
14
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyAPM-php-sdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f551879d
编写于
3月 23, 2019
作者:
H
heyanlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gcc 4.8.x
上级
63f77eac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
381 addition
and
20 deletion
+381
-20
src/report/Makefile
src/report/Makefile
+15
-7
src/report/deps/boost/Jamroot
src/report/deps/boost/Jamroot
+342
-0
src/report/report_client.cpp
src/report/report_client.cpp
+24
-13
未找到文件。
src/report/Makefile
浏览文件 @
f551879d
...
@@ -20,26 +20,34 @@ CXX = g++
...
@@ -20,26 +20,34 @@ CXX = g++
CPPFLAGS
+=
`
pkg-config
--cflags
protobuf grpc
`
CPPFLAGS
+=
`
pkg-config
--cflags
protobuf grpc
`
CXXFLAGS
+=
-std
=
c++11
CXXFLAGS
+=
-std
=
c++11
ifeq
($(SYSTEM),Darwin)
ifeq
($(SYSTEM),Darwin)
LDFLAGS
+=
-L
/usr/local/lib
`
pkg-config
--libs
protobuf grpc++
`
\
LDFLAGS
+=
-L
deps
/boost/stage/lib
-L
/usr/local/lib
`
pkg-config
--libs
protobuf grpc++
`
\
-lgrpc
++_reflection
\
-lgrpc
++_reflection
\
-ldl
-ldl
\
-lboost_regex
else
else
LDFLAGS
+=
-L
/usr/local/lib
`
pkg-config
--libs
protobuf grpc++
`
\
LDFLAGS
+=
-L
deps
/boost/stage/lib
-L
/usr/local/lib
`
pkg-config
--libs
protobuf grpc++
`
\
-Wl
,--no-as-needed
-lgrpc
++_reflection
-Wl
,--as-needed
\
-Wl
,--no-as-needed
-lgrpc
++_reflection
-Wl
,--as-needed
\
-ldl
-ldl
\
-lboost_regex
endif
endif
PROTOC
=
protoc
PROTOC
=
protoc
GRPC_CPP_PLUGIN
=
grpc_cpp_plugin
GRPC_CPP_PLUGIN
=
grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH
?=
`
which
$(GRPC_CPP_PLUGIN)
`
GRPC_CPP_PLUGIN_PATH
?=
`
which
$(GRPC_CPP_PLUGIN)
`
all
:
system-check report_client
all
:
system-check boost report_client
boost
:
cd
deps/boost
&&
./bootstrap.sh
&&
\
./b2 stage
--with-regex
link
=
static runtime-link
=
shared
threading
=
multi
report_client
:
../grpc/.libs/ApplicationRegisterService-grpc.o ../grpc/.libs/ApplicationRegisterService.o ../grpc/.libs/Common-grpc.o ../grpc/.libs/Common.o ../grpc/.libs/DiscoveryService-grpc.o ../grpc/.libs/DiscoveryService.o ../grpc/.libs/Downstream-grpc.o ../grpc/.libs/Downstream.o ../grpc/.libs/JVMMetricsService-grpc.o ../grpc/.libs/JVMMetricsService.o ../grpc/.libs/KeyWithIntegerValue-grpc.o ../grpc/.libs/KeyWithIntegerValue.o ../grpc/.libs/KeyWithStringValue-grpc.o ../grpc/.libs/KeyWithStringValue.o ../grpc/.libs/NetworkAddressRegisterService-grpc.o ../grpc/.libs/NetworkAddressRegisterService.o ../grpc/.libs/TraceSegmentService-grpc.o ../grpc/.libs/TraceSegmentService.o
report_client
:
../grpc/.libs/ApplicationRegisterService-grpc.o ../grpc/.libs/ApplicationRegisterService.o ../grpc/.libs/Common-grpc.o ../grpc/.libs/Common.o ../grpc/.libs/DiscoveryService-grpc.o ../grpc/.libs/DiscoveryService.o ../grpc/.libs/Downstream-grpc.o ../grpc/.libs/Downstream.o ../grpc/.libs/JVMMetricsService-grpc.o ../grpc/.libs/JVMMetricsService.o ../grpc/.libs/KeyWithIntegerValue-grpc.o ../grpc/.libs/KeyWithIntegerValue.o ../grpc/.libs/KeyWithStringValue-grpc.o ../grpc/.libs/KeyWithStringValue.o ../grpc/.libs/NetworkAddressRegisterService-grpc.o ../grpc/.libs/NetworkAddressRegisterService.o ../grpc/.libs/TraceSegmentService-grpc.o ../grpc/.libs/TraceSegmentService.o
$(CXX)
report_client.cpp
$^
$(LDFLAGS)
$(CXXFLAGS)
-o
$@
$(CXX)
report_client.cpp
$^
$(LDFLAGS)
-Ideps
/boost
$(CXXFLAGS)
-o
$@
clean
:
clean
:
rm
-f
*
.o
*
.pb.cc
*
.pb.h report_client
rm
-rf
*
.o
*
.pb.cc
*
.pb.h report_client
\
deps/boost/bin.v2 deps/boost/stage deps/boost/b2 deps/boost/bjam
\
deps/boost/project-config.
*
deps/boost/bootstrap.log
# The following is to test your system and ensure a smoother experience.
# The following is to test your system and ensure a smoother experience.
...
...
src/report/deps/boost/Jamroot
0 → 100644
浏览文件 @
f551879d
# Copyright Vladimir Prus 2002-2006.
# Copyright Dave Abrahams 2005-2006.
# Copyright Rene Rivera 2005-2007.
# Copyright Douglas Gregor 2005.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Usage:
#
# b2 [options] [properties] [install|stage]
#
# Builds and installs Boost.
#
# Targets and Related Options:
#
# install Install headers and compiled library files to the
# ======= configured locations (below).
#
# --prefix=<PREFIX> Install architecture independent files here.
# Default; C:\Boost on Win32
# Default; /usr/local on Unix. Linux, etc.
#
# --exec-prefix=<EPREFIX> Install architecture dependent files here.
# Default; <PREFIX>
#
# --libdir=<DIR> Install library files here.
# Default; <EPREFIX>/lib
#
# --includedir=<HDRDIR> Install header files here.
# Default; <PREFIX>/include
#
# stage Build and install only compiled library files to the
# ===== stage directory.
#
# --stagedir=<STAGEDIR> Install library files here
# Default; ./stage
#
# Other Options:
#
# --build-type=<type> Build the specified pre-defined set of variations of
# the libraries. Note, that which variants get built
# depends on what each library supports.
#
# -- minimal -- (default) Builds a minimal set of
# variants. On Windows, these are static
# multithreaded libraries in debug and release
# modes, using shared runtime. On Linux, these are
# static and shared multithreaded libraries in
# release mode.
#
# -- complete -- Build all possible variations.
#
# --build-dir=DIR Build in this location instead of building within
# the distribution tree. Recommended!
#
# --show-libraries Display the list of Boost libraries that require
# build and installation steps, and then exit.
#
# --layout=<layout> Determine whether to choose library names and header
# locations such that multiple versions of Boost or
# multiple compilers can be used on the same system.
#
# -- versioned -- Names of boost binaries include
# the Boost version number, name and version of
# the compiler and encoded build properties. Boost
# headers are installed in a subdirectory of
# <HDRDIR> whose name contains the Boost version
# number.
#
# -- tagged -- Names of boost binaries include the
# encoded build properties such as variant and
# threading, but do not including compiler name
# and version, or Boost version. This option is
# useful if you build several variants of Boost,
# using the same compiler.
#
# -- system -- Binaries names do not include the
# Boost version number or the name and version
# number of the compiler. Boost headers are
# installed directly into <HDRDIR>. This option is
# intended for system integrators building
# distribution packages.
#
# The default value is 'versioned' on Windows, and
# 'system' on Unix.
#
# --buildid=ID Add the specified ID to the name of built libraries.
# The default is to not add anything.
#
# --python-buildid=ID Add the specified ID to the name of built libraries
# that depend on Python. The default is to not add
# anything. This ID is added in addition to --buildid.
#
# --help This message.
#
# --with-<library> Build and install the specified <library>. If this
# option is used, only libraries specified using this
# option will be built.
#
# --without-<library> Do not build, stage, or install the specified
# <library>. By default, all libraries are built.
#
# Properties:
#
# toolset=toolset Indicate the toolset to build with.
#
# variant=debug|release Select the build variant
#
# link=static|shared Whether to build static or shared libraries
#
# threading=single|multi Whether to build single or multithreaded binaries
#
# runtime-link=static|shared
# Whether to link to static or shared C and C++
# runtime.
#
# TODO:
# - handle boost version
# - handle python options such as pydebug
import boostcpp ;
import package ;
import sequence ;
import xsltproc ;
import set ;
import path ;
import link ;
import notfile ;
import virtual-target ;
import "class" : new ;
import property-set ;
import threadapi-feature ;
import option ;
path-constant BOOST_ROOT : . ;
constant BOOST_VERSION : 1.69.0 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;
boostcpp.set-version $(BOOST_VERSION) ;
use-project /boost/architecture : libs/config/checks/architecture ;
local all-headers =
[ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
for dir in $(all-headers)
{
link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
explicit $(dir)-headers ;
}
if $(all-headers)
{
constant BOOST_MODULARLAYOUT : $(all-headers) ;
}
project boost
: requirements <include>.
[ boostcpp.architecture ]
[ boostcpp.address-model ]
# Disable auto-linking for all targets here, primarily because it caused
# troubles with V2.
<define>BOOST_ALL_NO_LIB=1
# Used to encode variant in target name. See the 'tag' rule below.
<tag>@$(__name__).tag
<conditional>@handle-static-runtime
# Comeau does not support shared lib
<toolset>como:<link>static
<toolset>como-linux:<define>_GNU_SOURCE=1
# When building docs within Boost, we want the standard Boost style
<xsl:param>boost.defaults=Boost
<conditional>@threadapi-feature.detect
: usage-requirements <include>.
: default-build
<visibility>hidden
: build-dir bin.v2
;
# This rule is called by Boost.Build to determine the name of target. We use it
# to encode the build variant, compiler name and boost version in the target
# name.
#
rule tag ( name : type ? : property-set )
{
return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
}
rule python-tag ( name : type ? : property-set )
{
return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
}
rule handle-static-runtime ( properties * )
{
# Using static runtime with shared libraries is impossible on Linux, and
# dangerous on Windows. Therefore, we disallow it. This might be drastic,
# but it was disabled for a while without anybody complaining.
# For CW, static runtime is needed so that std::locale works.
if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
! ( <toolset>cw in $(properties) )
{
if ! $(.shared-static-warning-emitted)
{
ECHO "warning: skipping configuration link=shared, runtime-link=static" ;
ECHO "warning: this combination is either impossible or too dangerous" ;
ECHO "warning: to be of any use" ;
.shared-static-warning-emitted = 1 ;
}
return <build>no ;
}
}
all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
[ glob libs/*/build/Jamfile ] ] ;
all-libraries = [ sequence.unique $(all-libraries) ] ;
# The function_types library has a Jamfile, but it's used for maintenance
# purposes, there's no library to build and install.
all-libraries = [ set.difference $(all-libraries) : function_types ] ;
# Setup convenient aliases for all libraries.
local rule explicit-alias ( id : targets + )
{
alias $(id) : $(targets) ;
explicit $(id) ;
}
# First, the complicated libraries: where the target name in Jamfile is
# different from its directory name.
explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
explicit-alias serialization : libs/serialization/build//boost_serialization ;
explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
for local l in $(all-libraries)
{
if ! $(l) in test graph serialization
{
explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
}
}
# Log has an additional target
explicit-alias log_setup : libs/log/build//boost_log_setup ;
rule do-nothing { }
rule generate-alias ( project name : property-set : sources * )
{
local action-name = [ $(property-set).get <action> ] ;
local m = [ MATCH ^@(.*) : $(action-name) ] ;
property-set = [ property-set.empty ] ;
local action = [ new action $(sources) : $(m[1]) : $(property-set) ] ;
local t = [ new notfile-target $(name) : $(project) : $(action) ] ;
return [ virtual-target.register $(t) ] ;
}
generate headers : $(all-headers)-headers : <generating-rule>@generate-alias <action>@do-nothing : : <include>. ;
#alias headers : $(all-headers)-headers : : : <include>. ;
explicit headers ;
# Make project ids of all libraries known.
for local l in $(all-libraries)
{
use-project /boost/$(l) : libs/$(l)/build ;
}
if [ path.exists $(BOOST_ROOT)/tools/inspect/build ]
{
use-project /boost/tools/inspect : tools/inspect/build ;
}
if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ]
{
use-project /boost/libs/wave/tool : libs/wave/tool/build ;
}
# This rule should be called from libraries' Jamfiles and will create two
# targets, "install" and "stage", that will install or stage that library. The
# --prefix option is respected, but --with and --without options, naturally, are
# ignored.
#
# - libraries -- list of library targets to install.
#
rule boost-install ( libraries * )
{
package.install install
: <dependency>/boost//install-proper-headers $(install-requirements)
: # No binaries
: $(libraries)
: # No headers, it is handled by the dependency.
;
local stage-locate = [ option.get stagedir : $(BOOST_ROOT)/stage ] ;
install stage : $(libraries) : <location>$(stage-locate)/lib ;
module [ CALLER_MODULE ]
{
explicit stage ;
explicit install ;
}
}
# Creates a library target, adding autolink support and also creates
# stage and install targets via boost-install, above.
rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
{
name = boost_$(name) ;
autolink = <link>shared:<define>$(name:U)_DYN_LINK=1 ;
lib $(name)
: $(sources)
: $(requirements) $(autolink)
: $(default-build)
: $(usage-requirements) $(autolink)
;
boost-install $(name) ;
}
headers =
# The .SUNWCCh files are present in tr1 include directory and have to be
# installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php).
[ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
[ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
[ path.glob $(BOOST_ROOT)/boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
;
# Declare special top-level targets that build and install the desired variants
# of the libraries.
boostcpp.declare-targets $(all-libraries) : $(headers) : $(all-headers) ;
src/report/report_client.cpp
浏览文件 @
f551879d
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
* limitations under the License.
* limitations under the License.
*
*
*/
*/
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>
#include <memory>
#include <memory>
...
@@ -23,7 +22,19 @@
...
@@ -23,7 +22,19 @@
#include <sys/types.h>
#include <sys/types.h>
#include <dirent.h>
#include <dirent.h>
#include <sys/time.h>
#include <sys/time.h>
#if !_MSC_VER && !__clang__ && (__GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ <= 8)))
#include <boost/regex.hpp>
using
boost
::
regex
;
using
boost
::
regex_match
;
using
boost
::
match_results
;
using
boost
::
smatch
;
#else
#include <regex>
#include <regex>
using
std
::
regex
;
using
std
::
regex_match
;
using
std
::
match_results
;
using
std
::
smatch
;
#endif
#include <chrono>
#include <chrono>
#include <cstdio>
#include <cstdio>
#include <thread>
#include <thread>
...
@@ -148,11 +159,11 @@ int main(int argc, char **argv) {
...
@@ -148,11 +159,11 @@ int main(int argc, char **argv) {
std
::
string
fileName
=
std
::
string
(
argv
[
2
])
+
"/"
+
dir
->
d_name
;
std
::
string
fileName
=
std
::
string
(
argv
[
2
])
+
"/"
+
dir
->
d_name
;
const
std
::
regex
pattern
(
std
::
string
(
argv
[
2
])
+
"/skywalking
\\
.(
\\
d+)-
\\
d+
\\
.log"
);
const
regex
pattern
(
std
::
string
(
argv
[
2
])
+
"/skywalking
\\
.(
\\
d+)-
\\
d+
\\
.log"
);
if
(
std
::
regex_match
(
fileName
,
pattern
))
{
if
(
regex_match
(
fileName
,
pattern
))
{
std
::
match_results
<
std
::
string
::
const_iterator
>
result
;
match_results
<
std
::
string
::
const_iterator
>
result
;
bool
valid
=
std
::
regex_match
(
fileName
,
result
,
pattern
);
bool
valid
=
regex_match
(
fileName
,
result
,
pattern
);
if
(
valid
)
{
if
(
valid
)
{
...
@@ -179,10 +190,10 @@ int main(int argc, char **argv) {
...
@@ -179,10 +190,10 @@ int main(int argc, char **argv) {
UpstreamSegment
request
;
UpstreamSegment
request
;
s
td
::
s
match
traceResult
;
smatch
traceResult
;
std
::
string
tmp
(
j
[
"segment"
][
"traceSegmentId"
].
get
<
std
::
string
>
());
std
::
string
tmp
(
j
[
"segment"
][
"traceSegmentId"
].
get
<
std
::
string
>
());
bool
valid
=
std
::
regex_match
(
tmp
,
bool
valid
=
regex_match
(
tmp
,
traceResult
,
std
::
regex
(
"([
\\
-0-9]+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
traceResult
,
regex
(
"([
\\
-0-9]+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
if
(
valid
)
{
if
(
valid
)
{
// add to map
// add to map
...
@@ -196,10 +207,10 @@ int main(int argc, char **argv) {
...
@@ -196,10 +207,10 @@ int main(int argc, char **argv) {
std
::
cout
<<
"send "
<<
j
[
"globalTraceIds"
][
i
].
get
<
std
::
string
>
()
<<
" to skywalking service"
std
::
cout
<<
"send "
<<
j
[
"globalTraceIds"
][
i
].
get
<
std
::
string
>
()
<<
" to skywalking service"
<<
std
::
endl
;
<<
std
::
endl
;
s
td
::
s
match
globalTraceResult
;
smatch
globalTraceResult
;
std
::
string
tmp
(
j
[
"globalTraceIds"
][
i
].
get
<
std
::
string
>
());
std
::
string
tmp
(
j
[
"globalTraceIds"
][
i
].
get
<
std
::
string
>
());
bool
valid
=
std
::
regex_match
(
tmp
,
globalTraceResult
,
std
::
regex
(
"(
\\
-?
\\
d+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
bool
valid
=
regex_match
(
tmp
,
globalTraceResult
,
regex
(
"(
\\
-?
\\
d+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
UniqueId
*
globalTrace
=
request
.
add_globaltraceids
();
UniqueId
*
globalTrace
=
request
.
add_globaltraceids
();
long
long
idp1
=
std
::
stoll
(
globalTraceResult
[
1
]);
long
long
idp1
=
std
::
stoll
(
globalTraceResult
[
1
]);
...
@@ -259,10 +270,10 @@ int main(int argc, char **argv) {
...
@@ -259,10 +270,10 @@ int main(int argc, char **argv) {
auto
refs
=
spans
[
i
][
"refs"
];
auto
refs
=
spans
[
i
][
"refs"
];
for
(
int
k
=
0
;
k
<
refs
.
size
();
k
++
)
{
for
(
int
k
=
0
;
k
<
refs
.
size
();
k
++
)
{
s
td
::
s
match
traceResult
;
smatch
traceResult
;
std
::
string
tmp
(
refs
[
k
][
"parentTraceSegmentId"
].
get
<
std
::
string
>
());
std
::
string
tmp
(
refs
[
k
][
"parentTraceSegmentId"
].
get
<
std
::
string
>
());
bool
valid
=
std
::
regex_match
(
tmp
,
bool
valid
=
regex_match
(
tmp
,
traceResult
,
std
::
regex
(
"([
\\
-0-9]+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
traceResult
,
regex
(
"([
\\
-0-9]+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
));
UniqueId
*
uniqueIdTmp
=
new
UniqueId
;
UniqueId
*
uniqueIdTmp
=
new
UniqueId
;
long
long
idp1
=
std
::
stoll
(
traceResult
[
1
]);
long
long
idp1
=
std
::
stoll
(
traceResult
[
1
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录