Proposal: built-in tracing and metrics via ActivitySource/Meter
Les mainteneurs répondent en général sous 3 jours
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- csharp
- Domaine
- observability
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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?
- Langage dominant
- C#
- Étoiles
- 4.4k
- Forks
- 987
- Merge moyen
- 2 j 6 h
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de sshnet/SSH.NET
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 12/100
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 3 jours
-
MAC ERROR after migrate to 2026Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
sshnet/SSH.NET#1853 · 4 commentaires ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 69/100
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
sshnet/SSH.NET#1843 · 1 commentaire ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de sshnet/SSH.NET
Issues similaires
-
needs-triage
Difficulté 1/5 1-3 heures Accessibilité débutants 76/100
Azure/azure-sdk-for-net#64658 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dotnet/aspnetcore#70370 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
NethermindEth/nethermind#15684 ·
Les mainteneurs répondent en général sous 1 jour
-
area/ai-assistant squad/flyt
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Altinn/altinn-studio#21798 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
SubtitleEdit/subtitleedit#16699 ·
Les mainteneurs répondent en général sous 1 jour