GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs
Stackdriver Trace Integration
- 主要言語
- TypeScript
- スター
- 1.4k
- フォーク
- 181
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
## Stackdriver Trace Integration
Add Stackdriver Trace support to the Functions Framework.
Library: https://github.com/googleapis/cloud-trace-nodejs
Google Issue: https://issuetracker.google.com/issues/124761993
> @stew-r Can you add details as to what this would do? Would this be a tutorial or part of the actual framework?
### Example Code
```
"@google-cloud/debug-agent": "^4.0.1",
"@google-cloud/profiler": "^2.0.2",
"@google-cloud/trace-agent": "^4.1.0",
```
```ts
import * as debugAgent from '@google-cloud/debug-agent';
import * as profiler from '@google-cloud/profiler';
import * as trace from '@google-cloud/trace-agent';
let toolsAreSetup = false;
/**
* Starts Google Cloud tooling.
* - StackDriver Trace
* - StackDriver Profiler
* - StackDriver Debugger
*/
export function startTooling() {
// Ensure tools are only setup once per process.
if (toolsAreSetup) {
return null;
} else {
toolsAreSetup = true;
}
// Start Trace
trace.start();
// Start profiler
profiler
.start({
serviceContext: {
service: getServiceName(),
version: 'v1',
},
})
.catch(err => {
console.error('Failed to start profiler', err);
});
// Start debugger
const debug = debugAgent.start({
serviceContext: {
service: getServiceName(),
version: 'v1',
// version: functions.config().tsc.version
},
});
// Return all tools
return {
trace,
profiler,
debug,
};
}
/**
* Gets the name of the function for logging.
* @returns {string} The name of the function with a '_function' suffix.
*/
function getServiceName(): string {
const serviceName = process.env.FUNCTION_TARGET || 'unknown_cloud';
return `${serviceName}_function`;
}
```
コントリビューションガイド
調査の方向性
cloud-trace-nodejs ライブラリと issue 内の TypeScript の例から始めます。リポジトリのファイル、テスト、エントリーポイントは指定されていません。まず、統合を Functions Framework に含めるのかチュートリアルに含めるのかを明確にし、その後、サポートする動作と受け入れ確認項目を定義します。完了した実装は合意したスコープに一致し、Stackdriver Trace のサポートを実証する必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- google-cloud, node.js, typescript
- 領域
- cloud, observability-sre
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100