Add device and OS attributes to metrics on mobile, as the native SDKs do

オープン
#6,046 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp

調査の方向性

Read the metrics spec linked in the issue and compare its default attribute guidance with the native SDK behavior described for sentry-java and sentry-cocoa. If the SDK and ingest teams decide .NET should match the native SDKs, inspect SentryOptions.DeviceLogAttributes and SentryMetric.Factory.cs, where SetDefaultAttributes is called. Done means the decision is reflected consistently in the metrics attributes and, if needed, the spec.

索引モデルが issue の本文から書いたものです。

説明

Feature Metrics State: Needs Discussion
Problem Statement

#6028 adds device and OS attributes (os.name, os.version, device.brand, device.model, device.family) to structured logs on Android, iOS and Mac Catalyst, as the logs spec asks of mobile SDKs. Metrics don't get them.

The native SDKs we wrap do add them to metrics:

  • sentry-java (8.66.0): DefaultAndroidEventProcessor.process(SentryMetricsEvent, Hint) sets the same five attributes it sets on logs.
  • sentry-cocoa (9.35.0): TelemetryScopeApplier adds the OS and device attributes to every telemetry item, metrics included.

So a metric emitted from .NET on Android or iOS carries fewer attributes than one emitted from the native SDK in the same app.

Why this needs a decision first

The metrics spec doesn't list device or OS attributes. It also says SDKs SHOULD minimize default attributes because of cardinality, and that new defaults SHOULD only be added after discussion with the SDK and ingest teams. The native SDKs go beyond that.

The question is whether .NET should match the native SDKs or follow the spec as written, and whether the spec should be updated.

Solution Brainstorm

If we match the native SDKs, the work is small. #6028 adds an internal SentryOptions.DeviceLogAttributes hook, filled by the Android and Cocoa integrations and applied in SentryLog.SetDefaultAttributes. Metrics would apply the same hook in SentryMetric.Factory.cs, where SetDefaultAttributes is already called. The hook would then want a name that isn't specific to logs.

主要言語
C#
スター
775
フォーク
262
平均マージ
1日 16時間
マージ済み PR(30日)
118

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-dotnet のほかの issue

getsentry/sentry-dotnet の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。