Skip to content

Commit 32672fa

Browse files
authored
feat: enable skywalking plugin for tracing (#86)
1 parent 7e7c91d commit 32672fa

File tree

15 files changed

+1176
-51
lines changed

15 files changed

+1176
-51
lines changed

.github/workflows/unit.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ jobs:
2626
- name: Install Docker for macOS
2727
uses: docker-practice/actions-setup-docker@master
2828
if: ${{ matrix.platform == 'macos-latest' }}
29+
- name: Install Docker for ubuntu
30+
uses: docker-practice/actions-setup-docker@master
31+
if: ${{ matrix.platform == 'ubuntu-latest' }}
32+
- name: Install skywalking and wait for it start
33+
run: |
34+
docker version
35+
docker pull apache/skywalking-oap-server:8.4.0-es6
36+
docker run -d --name oap -p 12800:12800 -p 11800:11800 apache/skywalking-oap-server:8.4.0-es6
37+
docker ps
38+
sleep 20s
2939
- name: Initialize Dapr
3040
run: dapr init -s --runtime-version ${{ matrix.dapr-version }}
3141
- name: Install dependencies

docs/generated/api.json

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,34 @@
20392039
"endIndex": 12
20402040
}
20412041
},
2042+
{
2043+
"kind": "PropertySignature",
2044+
"canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#tracing:member",
2045+
"docComment": "/**\n * Optional trace config\n */\n",
2046+
"excerptTokens": [
2047+
{
2048+
"kind": "Content",
2049+
"text": "tracing?: "
2050+
},
2051+
{
2052+
"kind": "Reference",
2053+
"text": "TraceConfig",
2054+
"canonicalReference": "@openfunction/functions-framework!TraceConfig:interface"
2055+
},
2056+
{
2057+
"kind": "Content",
2058+
"text": ";"
2059+
}
2060+
],
2061+
"isReadonly": false,
2062+
"isOptional": true,
2063+
"releaseTag": "Public",
2064+
"name": "tracing",
2065+
"propertyTypeTokenRange": {
2066+
"startIndex": 1,
2067+
"endIndex": 2
2068+
}
2069+
},
20422070
{
20432071
"kind": "PropertySignature",
20442072
"canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#version:member",
@@ -3168,6 +3196,213 @@
31683196
"name": "Knative"
31693197
}
31703198
]
3199+
},
3200+
{
3201+
"kind": "Interface",
3202+
"canonicalReference": "@openfunction/functions-framework!TraceConfig:interface",
3203+
"docComment": "/**\n * The config of the trace.\n *\n * @public\n */\n",
3204+
"excerptTokens": [
3205+
{
3206+
"kind": "Content",
3207+
"text": "export interface TraceConfig "
3208+
}
3209+
],
3210+
"releaseTag": "Public",
3211+
"name": "TraceConfig",
3212+
"preserveMemberOrder": false,
3213+
"members": [
3214+
{
3215+
"kind": "PropertySignature",
3216+
"canonicalReference": "@openfunction/functions-framework!TraceConfig#baggage:member",
3217+
"docComment": "/**\n * Trace baggage\n */\n",
3218+
"excerptTokens": [
3219+
{
3220+
"kind": "Content",
3221+
"text": "baggage?: "
3222+
},
3223+
{
3224+
"kind": "Reference",
3225+
"text": "Record",
3226+
"canonicalReference": "!Record:type"
3227+
},
3228+
{
3229+
"kind": "Content",
3230+
"text": "<string, string>"
3231+
},
3232+
{
3233+
"kind": "Content",
3234+
"text": ";"
3235+
}
3236+
],
3237+
"isReadonly": false,
3238+
"isOptional": true,
3239+
"releaseTag": "Public",
3240+
"name": "baggage",
3241+
"propertyTypeTokenRange": {
3242+
"startIndex": 1,
3243+
"endIndex": 3
3244+
}
3245+
},
3246+
{
3247+
"kind": "PropertySignature",
3248+
"canonicalReference": "@openfunction/functions-framework!TraceConfig#enabled:member",
3249+
"docComment": "/**\n * This is trace switch\n */\n",
3250+
"excerptTokens": [
3251+
{
3252+
"kind": "Content",
3253+
"text": "enabled: "
3254+
},
3255+
{
3256+
"kind": "Content",
3257+
"text": "boolean"
3258+
},
3259+
{
3260+
"kind": "Content",
3261+
"text": ";"
3262+
}
3263+
],
3264+
"isReadonly": false,
3265+
"isOptional": false,
3266+
"releaseTag": "Public",
3267+
"name": "enabled",
3268+
"propertyTypeTokenRange": {
3269+
"startIndex": 1,
3270+
"endIndex": 2
3271+
}
3272+
},
3273+
{
3274+
"kind": "PropertySignature",
3275+
"canonicalReference": "@openfunction/functions-framework!TraceConfig#provider:member",
3276+
"docComment": "/**\n * Trace Provider\n */\n",
3277+
"excerptTokens": [
3278+
{
3279+
"kind": "Content",
3280+
"text": "provider?: "
3281+
},
3282+
{
3283+
"kind": "Reference",
3284+
"text": "TraceProvider",
3285+
"canonicalReference": "@openfunction/functions-framework!TraceProvider:interface"
3286+
},
3287+
{
3288+
"kind": "Content",
3289+
"text": ";"
3290+
}
3291+
],
3292+
"isReadonly": false,
3293+
"isOptional": true,
3294+
"releaseTag": "Public",
3295+
"name": "provider",
3296+
"propertyTypeTokenRange": {
3297+
"startIndex": 1,
3298+
"endIndex": 2
3299+
}
3300+
},
3301+
{
3302+
"kind": "PropertySignature",
3303+
"canonicalReference": "@openfunction/functions-framework!TraceConfig#tags:member",
3304+
"docComment": "/**\n * Trace tags\n */\n",
3305+
"excerptTokens": [
3306+
{
3307+
"kind": "Content",
3308+
"text": "tags?: "
3309+
},
3310+
{
3311+
"kind": "Reference",
3312+
"text": "Record",
3313+
"canonicalReference": "!Record:type"
3314+
},
3315+
{
3316+
"kind": "Content",
3317+
"text": "<string, string>"
3318+
},
3319+
{
3320+
"kind": "Content",
3321+
"text": ";"
3322+
}
3323+
],
3324+
"isReadonly": false,
3325+
"isOptional": true,
3326+
"releaseTag": "Public",
3327+
"name": "tags",
3328+
"propertyTypeTokenRange": {
3329+
"startIndex": 1,
3330+
"endIndex": 3
3331+
}
3332+
}
3333+
],
3334+
"extendsTokenRanges": []
3335+
},
3336+
{
3337+
"kind": "Interface",
3338+
"canonicalReference": "@openfunction/functions-framework!TraceProvider:interface",
3339+
"docComment": "/**\n * The trace provider info.\n *\n * @public\n */\n",
3340+
"excerptTokens": [
3341+
{
3342+
"kind": "Content",
3343+
"text": "export interface TraceProvider "
3344+
}
3345+
],
3346+
"releaseTag": "Public",
3347+
"name": "TraceProvider",
3348+
"preserveMemberOrder": false,
3349+
"members": [
3350+
{
3351+
"kind": "PropertySignature",
3352+
"canonicalReference": "@openfunction/functions-framework!TraceProvider#name:member",
3353+
"docComment": "/**\n * Provider name Now is just support skywalking\n */\n",
3354+
"excerptTokens": [
3355+
{
3356+
"kind": "Content",
3357+
"text": "name: "
3358+
},
3359+
{
3360+
"kind": "Content",
3361+
"text": "string"
3362+
},
3363+
{
3364+
"kind": "Content",
3365+
"text": ";"
3366+
}
3367+
],
3368+
"isReadonly": false,
3369+
"isOptional": false,
3370+
"releaseTag": "Public",
3371+
"name": "name",
3372+
"propertyTypeTokenRange": {
3373+
"startIndex": 1,
3374+
"endIndex": 2
3375+
}
3376+
},
3377+
{
3378+
"kind": "PropertySignature",
3379+
"canonicalReference": "@openfunction/functions-framework!TraceProvider#oapServer:member",
3380+
"docComment": "/**\n * OapServer address example [skywalking-oap:11800]\n */\n",
3381+
"excerptTokens": [
3382+
{
3383+
"kind": "Content",
3384+
"text": "oapServer: "
3385+
},
3386+
{
3387+
"kind": "Content",
3388+
"text": "string"
3389+
},
3390+
{
3391+
"kind": "Content",
3392+
"text": ";"
3393+
}
3394+
],
3395+
"isReadonly": false,
3396+
"isOptional": false,
3397+
"releaseTag": "Public",
3398+
"name": "oapServer",
3399+
"propertyTypeTokenRange": {
3400+
"startIndex": 1,
3401+
"endIndex": 2
3402+
}
3403+
}
3404+
],
3405+
"extendsTokenRanges": []
31713406
}
31723407
]
31733408
}

docs/generated/api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export interface OpenFunctionContext {
139139
postPlugins?: string[];
140140
prePlugins?: string[];
141141
runtime: `${RuntimeType}` | `${Capitalize<RuntimeType>}` | `${Uppercase<RuntimeType>}`;
142+
tracing?: TraceConfig;
142143
version: string;
143144
}
144145

@@ -188,6 +189,20 @@ export enum RuntimeType {
188189
Knative = "knative"
189190
}
190191

192+
// @public
193+
export interface TraceConfig {
194+
baggage?: Record<string, string>;
195+
enabled: boolean;
196+
provider?: TraceProvider;
197+
tags?: Record<string, string>;
198+
}
199+
200+
// @public
201+
export interface TraceProvider {
202+
name: string;
203+
oapServer: string;
204+
}
205+
191206
// (No @packageDocumentation comment for this package)
192207

193208
```

output-file.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"some":"payload"}

0 commit comments

Comments
 (0)