Proposal: built-in tracing and metrics via ActivitySource/Meter
维护者通常 3 天内回复
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
Read the working prototype linked in the issue and inspect the existing Internal* methods it hooks into. The proposal covers tracing for connections, SFTP operations, and command execution, plus an operation duration metric; existing unit tests and integration tests are reported passing. Before implementation, resolve the dependency, attribute naming, command secrecy, and first PR scope questions; done means the agreed telemetry scope is covered and verified.
由索引模型根据 Issue 内容生成。
描述
Hi, I'd like to propose adding built-in tracing and metrics to SSH.NET using System.Diagnostics.ActivitySource and Meter, the same approach Npgsql and the MongoDB driver use.
I first opened an OpenTelemetry contrib package that wraps ISftpClient/ISshClient (https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/5781). An OTel maintainer suggested building it into the library instead, so users only need AddSource("Renci.SshNet") and AddMeter("Renci.SshNet"). That also works with other backends (Datadog, App Insights), and covers cases a wrapper can't reach: CreateCommand + Execute, Begin*/End*, non-seekable streams.
I have a working prototype: https://github.com/YoussefElshemi/SSH.NET/tree/native-telemetry
- Spans:
Connect(ssh/sftp/scp/netconf)- SFTP
UploadFile,DownloadFile,ListDirectory SshCommandexecution
- Metric:
ssh.client.operation.durationhistogram (seconds) - Where it hooks in: the existing
Internal*methods, so every overload is covered - When nobody is listening: no allocation or extra work
- Tests: existing unit tests pass. New integration tests pass on net48/net8/net9/net10.
Questions before I go further:
- It adds
System.Diagnostics.DiagnosticSource(8.0.1) as a dependency on net462/netstandard2.0 only. Is that acceptable? - Attribute names like
ssh.operation.name,sftp.transfer.bytesandssh.command.exit_codearen't official OpenTelemetry names yet. Any preference? - Command text isn't recorded, since it may contain secrets. Should there be an opt-in?
- Should a first PR stay this small, or also cover
Exists/Delete/Rename/SCP?
Would you be open to a PR along these lines?
- 主要语言
- C#
- 星标
- 4.4k
- 派生
- 987
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sshnet/SSH.NET 的其他 Issue
-
难度 5/5 一周以上 新手友好度 12/100
维护者通常 3 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 69/100
维护者通常 3 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
维护者通常 3 天内回复
相似的 Issue
-
needs-triage
难度 1/5 1-3 小时 新手友好度 76/100
Azure/azure-sdk-for-net#64658 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/aspnetcore#70370 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
NethermindEth/nethermind#15684 ·
维护者通常 1 天内回复
-
area/ai-assistant squad/flyt
难度 2/5 1-3 小时 新手友好度 83/100
Altinn/altinn-studio#21798 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
SubtitleEdit/subtitleedit#16699 ·
维护者通常 1 天内回复