Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【CLS】修复SDK CLS 日志接口无法上传日志的问题 #91

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions examples/cls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### CLS Node SDK Demo
---


### 注意事项

js版本的pb文件和其他语言的不太一样, 多增加 [jstype = JS_STRING],来解决js proto int64的问题。

```
syntax = "proto2";

package cls;

message Log
{
required int64 time = 1 [jstype = JS_STRING];
message Content
{
required string key = 1;
required string value = 2;
}
repeated Content contents= 2;
}

message LogTag
{
required string key = 1;
required string value = 2;
}

message LogGroup
{
repeated Log logs= 1;
optional string contextFlow= 2;
optional string filename = 3;
optional string source = 4;
repeated LogTag logTags = 5;
}

message LogGroupList
{
repeated LogGroup logGroupList = 1;
}
```

### 运行

1、 npm install
2、 npm run start




21 changes: 21 additions & 0 deletions examples/cls/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "cls_node_demo",
"version": "1.0.0",
"description": "cls demo",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "ts-node ./src/index.ts"
},
"author": "farmerx",
"license": "MIT",
"dependencies": {
"google-protobuf": "^3.17.3",
"tencentcloud-sdk-nodejs": "^4.0.181",
"tslint": "^6.1.3",
"typescript": "^4.3.5"
},
"devDependencies": {
"ts-node": "^10.2.0"
}
}
34 changes: 34 additions & 0 deletions examples/cls/src/cls.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto2";

package cls;

message Log
{
required int64 time = 1 [jstype = JS_STRING];
message Content
{
required string key = 1;
required string value = 2;
}
repeated Content contents= 2;
}

message LogTag
{
required string key = 1;
required string value = 2;
}

message LogGroup
{
repeated Log logs= 1;
optional string contextFlow= 2;
optional string filename = 3;
optional string source = 4;
repeated LogTag logTags = 5;
}

message LogGroupList
{
repeated LogGroup logGroupList = 1;
}
Loading