4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Application Insights SDK v2 / v3 / OpenTelemetry Distro における Azure Monitor ログ出力の比較検証

4
Last updated at Posted at 2026-03-04

背景

2026年2月上旬にApplication Insights SDK v3 が登場し、従来の v2 系 SDK とは内部実装が大きく変更されました。v3 は OpenTelemetry ベースへと移行しており、その結果として API や挙動に複数の破壊的変更が含まれています。

v2 系 SDK は将来的にサポートが縮小または終了する可能性が考えられるので、早期に v3 へ更新するか、あるいは OpenTelemetry Distro へ移行することも選択肢として検討しました。

しかし、懸念点がありました。破壊的変更は API や構成方法にとどまらず、Azure Monitor に記録されるログの内容そのもの (フィールド名の変更や欠落) に影響を与える可能性があるのではないか、という点です。

これらが変化した場合、以下への影響が考えられます。

  • 既存の Log Alert ルール
  • KQL クエリ
  • ダッシュボード
  • 外部連携システム

しかしながら、公式ドキュメントには API や移行方法の説明はあるものの、Azure Monitor 上に最終的にどのようなログが保存されるかという観点での詳細な比較情報は十分でないように思われました。

そこで本検証では、

  • v2 を維持した場合
  • v3 に更新した場合
  • OpenTelemetry Distro に載せ替えた場合

それぞれにおいて、Azure Monitor に記録されるログの内容に差異が生じるかどうか、また差異がある場合はどのような変化が発生するのかを、実験的に検証することとしました。

本記事では、その比較結果を実験レポート形式で整理します。

本記事は筆者個人による検証結果および見解をまとめたものであり、株式会社デジタルバリューの公式見解を示すものではないことご留意ください。

手法

実験環境

  • .NET バージョン: .NET 10
  • アプリケーション種別: ASP.NET Core Web API
  • 実行環境: Azure Web Apps

検証対象としたテレメトリは以下の 4 種類です。

  • requests
  • traces
  • dependencies
  • exceptions

比較対象パッケージ

以下の 3 パターンでアプリケーションを構成し、同一条件で比較を行いました。

① Application Insights SDK v2

Microsoft.ApplicationInsights.AspNetCore: 2.23.0
以下、appiv2 と表記します。

② Application Insights SDK v3

Microsoft.ApplicationInsights.AspNetCore: 3.0.0
以下、appiv3 と表記します。

③ Azure Monitor OpenTelemetry Distro

Azure.Monitor.OpenTelemetry.AspNetCore: 1.4.0
以下、otel と表記します。


各パターンごとに個別のアプリケーションをデプロイし、他の条件は可能な限り同一としました。

実験手順

  1. Azure Web Apps に各パターンのアプリケーションをデプロイします
  2. Visual Studio に配置した .http ファイルから HTTP リクエストを送信します
  3. 意図的に以下を発生させます
    • 正常リクエスト
    • 例外発生リクエスト
    • 外部 HTTP 呼び出し(dependency)
    • ログ出力(ILogger)
  4. Azure Monitor(Application Insights)に記録されたログを KQL で抽出します
  5. 各テーブル(requests / traces / dependencies / exceptions)を CSV として保存します
  6. フィールド構造および値の差異を比較します

比較観点

比較は主に以下の観点で実施しました。

  • 記録されるフィールドの有無
  • フィールド名の差異
  • appiv2 を基準とした appiv3 / otel の差異

マスク・編集方針

  • iKey 等の機微情報はマスクします
  • URL / GUID 等の長い値は一部省略します
  • 値なしは null として表記します
  • 全列が null のフィールドは比較表から除外します

結果

テーブルごとの appiv2 / appiv3 / otel のログ内容を抽出し、比較表を作成しました。

※1: 列 null(v2→v3/otel で null)
※2: 列の意味が変わる(同じ列名でも解釈が変わる可能性が高い)
※3: 列追加(v2 で null → v3/otel で値が入る)

※印はフィールド単位ではなく、テーブルごとのセル単位で付与しています。同じフィールドでもテーブルによって挙動が異なる場合があります。

requests
Field appiv2 appiv3 otel
_ResourceId /subscriptions/.../apis-kaneko-appiv2-je /subscriptions/.../apis-kaneko-appiv3-je /subscriptions/.../apis-kaneko-oteldistro-je
appId b3ede9cc-f947-4c06-a4f1-8f5cdf5a09bb 7341c693-00a7-4f6c-bd94-68fd01b528b9 e15e8619-b48a-40d3-9a29-a434246145fe
appName /subscriptions/.../apis-kaneko-appiv2-je /subscriptions/.../apis-kaneko-appiv3-je /subscriptions/.../apis-kaneko-oteldistro-je
application_Version ※1 1.0.0.0 null null
client_Browser ※3 null Other Other
client_City Tokyo Tokyo Tokyo
client_CountryOrRegion Japan Japan Japan
client_IP 0.0.0.0 0.0.0.0 0.0.0.0
client_Model ※3 null Other Other
client_OS ※3 null Windows 10 Windows 10
client_StateOrProvince Tokyo Tokyo Tokyo
client_Type PC PC PC
cloud_RoleInstance ※2 wn0sdwk00029I 1e885205bffd006c03ea7d96de18e9c5bb0e9a52d0c03d3bbd8c69a8c1990f61 1e885205bffd006c03ea7d96de18e9c5bb0e9a52d0c03d3bbd8c69a8c1990f61
cloud_RoleName ※2 app-kaneko-appiv2-je-heg6eeafcxc6eqen.japaneast-01 app-kaneko-appiv3-je app-kaneko-oteldistro-je
customDimensions AspNetCoreEnvironment ※1 Production null null
customDimensions _MS.ProcessedByMetricExtractors ※2 (Name:'Requests', Ver:'1.1') (Name: X,Ver:'1.1') (Name: X,Ver:'1.1')
customDimensions _MS.ResourceAttributeId ※3 null 7b0cf3ee-6912-47d4-97ab-a7d1391e35a8 d1c0d1ff-eebb-4b50-89c0-4a43574f63dd
customDimensions microsoft.sample_rate ※3 null 100 null
customDimensions network.protocol.version ※3 null 1.1 1.1
duration 90.6987 51.1087 49.2192
iKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
id 17e59a84292e288b 1b93bb75b057f7af 5d9715f9742debe0
itemCount 1 1 1
itemId 6fd1537b-10c3-11f1-9da6-7ced8de8722a 6e8f21c5-10c3-11f1-9da6-7ced8dbf6509 7c6a17fe-10c3-11f1-95b1-002248e67e4f
itemType request request request
links null null null
name GET /request-ok GET /request-ok GET /request-ok
operation_Id 46477ca1c40e2f27bcf5fcf65abe1a98 7a5a2e20bc651964d2d80742fccff4e5 6d7f675dba4f5b8e76d37e3f4c160b5d
operation_Name GET /request-ok GET /request-ok GET /request-ok
operation_ParentId cfffc4d552d3ca5a 48e51f4867c11705 8e7aa59dddf7b4b2
performanceBucket <250ms <250ms <250ms
resultCode 200 200 200
sdkVersion aspnet5c:2.23.0+... dotnet10.0.0-rtm...:otel1.15.0:shc3.0.0 dotnet10.0.0-rtm...:otel1.14.0:ext1.5.0-d
success True True True
timestamp [UTC] yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss
url https://app-kaneko-appiv2-.../request-ok https://app-kaneko-appiv3-.../request-ok https://app-kaneko-oteldistro-.../request-ok

補足: appiv3 / otel での Name の値 X はマスクや省略ではなく、実際に Azure Monitor 上でリテラルとして X が記録されていました。

dependencies
Field appiv2 appiv3 otel
_ResourceId /subscriptions/.../components/appiv2 /subscriptions/.../components/appiv3 /subscriptions/.../components/oteldistro
appId b3ede9cc-f947-4c06-a4f1-8f5cdf5a09bb 7341c693-00a7-4f6c-bd94-68fd01b528b9 e15e8619-b48a-40d3-9a29-a434246145fe
appName /subscriptions/.../apis-kaneko-appiv2-je /subscriptions/.../apis-kaneko-appiv3-je /subscriptions/.../apis-kaneko-oteldistro-je
application_Version ※1 1.0.0.0 null null
client_Browser ※3 null Other Other
client_City Tokyo Tokyo Tokyo
client_CountryOrRegion Japan Japan Japan
client_IP 0.0.0.0 0.0.0.0 0.0.0.0
client_Model ※3 null Other Other
client_OS ※3 null Windows 10 Windows 10
client_StateOrProvince Tokyo Tokyo Tokyo
client_Type PC PC PC
cloud_RoleInstance ※2 wn0sdwk00029I 1e885205bffd006c03ea7d96d...d8c69a8c1990f61 1e885205bffd006c03ea7d96d...d8c69a8c1990f61
cloud_RoleName ※2 app-kaneko-appiv2-je-heg6eeafcxc6eqen.japaneast-01 app-kaneko-appiv3-je app-kaneko-oteldistro-je
data https://example.com/ https://example.com/ https://example.com/
duration 79.4443 43.3551 42.1102
iKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
id a348770b29b71165 9066f092e3916e34 70fc61162c6c2095
itemCount 1 1 1
itemId 6fb2e069-10c3-11f1-9da6-7ced8de91434 71fda5f3-10c3-11f1-9da6-7ced8dea9517 7fcfc3b3-10c3-11f1-9da6-7ced8dbe0338
itemType dependency dependency dependency
name GET / GET / GET /
operation_Id 3600c6b2ddd8b8559f394f051e182882 031512269f97e8cc16ea4e8bbe08da44 7665cd13bb43f5c2a8f99df85653f0df
operation_Name ※1 GET /dependency null null
operation_ParentId 4e6d6fde399a5319 d6643409973e9862 5c3af610cf0e32bf
performanceBucket <250ms <250ms <250ms
resultCode 200 200 200
sdkVersion rdddsc:2.23.0-29 dotnet10.0.0-rtm...:otel1.15.0:shc3.0.0 dotnet10.0.0-rtm...:otel1.14.0:ext1.5.0-d
success True True True
target example.com example.com example.com
timestamp [UTC] yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss
type HTTP HTTP HTTP
customDimensions AspNetCoreEnvironment ※1 Production null null
customDimensions _MS.ProcessedByMetricExtractors ※2 (Name:'Dependencies', Ver:'1.1') (Name: X,Ver:'1.1') (Name: X,Ver:'1.1')
customDimensions _MS.ResourceAttributeId ※3 null cc1fe377-5568-432a-bfc1-7fbe9beca430 8cadabc8-724b-4d66-b96b-d46b0432fa36
customDimensions microsoft.sample_rate ※3 null 100 null
customDimensions network.protocol.version ※3 null 1.1 1.1
traces
Field appiv2 appiv3 otel
_ResourceId /subscriptions/.../components/appiv2 /subscriptions/.../components/appiv3 /subscriptions/.../components/oteldistro
appId b3ede9cc-f947-4c06-a4f1-8f5cdf5a09bb 7341c693-00a7-4f6c-bd94-68fd01b528b9 e15e8619-b48a-40d3-9a29-a434246145fe
appName /subscriptions/.../components/appiv2 /subscriptions/.../components/appiv3 /subscriptions/.../components/oteldistro
application_Version ※1 1.0.0.0 null null
client_Browser ※3 null Other Other
client_City Tokyo Tokyo Tokyo
client_CountryOrRegion Japan Japan Japan
client_IP 0.0.0.0 0.0.0.0 0.0.0.0
client_Model ※3 null Other Other
client_OS ※3 null Windows 10 Windows 10
client_StateOrProvince Tokyo Tokyo Tokyo
client_Type PC PC PC
cloud_RoleInstance ※2 wn0sdwk00029I 1e885205bffd006c03ea7d96de18e9c5bb0e9a52d0c03d3bbd8c69a8c1990f61 1e885205bffd006c03ea7d96de18e9c5bb0e9a52d0c03d3bbd8c69a8c1990f61
cloud_RoleName ※2 app-kaneko-appiv2-je-... app-kaneko-appiv3-je app-kaneko-oteldistro-je
iKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
itemCount 1 1 1
itemId 6fbaacc4-10c3-11f1-95b1-002248e67527 71d36d0d-10c3-11f1-95af-7ced8dbfb613 7ffa00d7-10c3-11f1-9da6-7ced8d30633d
itemType trace trace trace
message Trace comparison sample: error...Severity = High } Trace comparison sample: error...Severity = High } Trace comparison sample: error...Severity = High }
operation_Id f2408fb6ac8d8702398ca110757255b4 c218ad99f7312a23ccca97c16d1bb9e2 7db9dfdb27f8896ad49cd145c2cde1b9
operation_Name ※1 GET /trace null null
operation_ParentId 6c7536e39299ff6d 50700babe35b8d5a 51952a3868105a59
sdkVersion il:2.23.0-29 dotnet10.0.0-rtm...:otel1.15.0:shc3.0.0 dotnet10.0.0-rtm...:otel1.14.0:ext1.5.0-d
severityLevel 3 3 3
timestamp [UTC] yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss
customDimensions AspNetCoreEnvironment ※1 Production null null
customDimensions CategoryName Api.AiV2.Program Api.AiV3.Program Api.OtelDistro.Program
customDimensions Custom_CorrelationId 85b0c755-b406-48fd-8602-... 468d2406-a372-45ca-af98-... a87ac243-154f-4e94-a64a-...
customDimensions Custom_Details { Reason = Simulated, Severity = High } { Reason = Simulated, Severity = High } { Reason = Simulated, Severity = High }
customDimensions Custom_ErrorCode E001 E001 E001
customDimensions OriginalFormat ※1 Trace comparison sample: error... null null
customDimensions ParentId ※1 d76ebb53fac03fa3 null null
customDimensions RequestId ※1 4000036f-0000-ce00-b63f-... null null
customDimensions RequestPath ※1 /trace null null
customDimensions SpanId ※1 6c7536e39299ff6d null null
customDimensions TraceId ※1 f2408fb6ac8d8702398ca110757255b4 null null
exceptions

補足: client_Browser / client_Model / client_OS 等の client 系フィールドは、exceptions テーブルではすべてのパターンで null であったため、マスク・編集方針に従い比較表から除外しています。

Field appiv2 appiv3 otel
_ResourceId /subscriptions/.../components/appiv2 /subscriptions/.../components/appiv3 /subscriptions/.../components/oteldistro
appId b3ede9cc-f947-4c06-a4f1-8f5cdf5a09bb 7341c693-00a7-4f6c-bd94-68fd01b528b9 e15e8619-b48a-40d3-9a29-a434246145fe
appName /subscriptions/.../components/appiv2 /subscriptions/.../components/appiv3 /subscriptions/.../components/oteldistro
application_Version ※1 1.0.0.0 null null
assembly Api.AiV2, Version=1.0.0.0, Culture=neutral,... Api.AiV3, Version=1.0.0.0, Culture=neutral,... Api.OtelDistro, Version=1.0.0.0, Culture=neutral,...
cloud_RoleInstance ※2 wn0sdwk00029I 1e885205bffd006c03ea7d96d... 1e885205bffd006c03ea7d96d...
cloud_RoleName ※2 app-kaneko-appiv2-je-... app-kaneko-appiv3-je app-kaneko-oteldistro-je
details [{"severityLevel":"Error",...}] [{"severityLevel":"Error",...}] [{"severityLevel":"Error",...}]
iKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
innermostAssembly ※3 null Api.AiV3, Version=1.0.0.0,... Api.OtelDistro, Version=1.0.0.0,...
innermostMessage ※3 null Intentional exception for telemetry... Intentional exception for telemetry...
innermostMethod ※3 null Api.AiV3.Program+<>c.b__0_6 Api.OtelDistro.Program+<>c.b__0_6
innermostType ※3 null System.InvalidOperationException System.InvalidOperationException
itemCount 1 1 1
itemId 6ef8c7be-10c3-11f1-95b1-... 7497e379-10c3-11f1-95af-... 83117103-10c3-11f1-9da6-...
itemType exception exception exception
method Api.AiV2.Program+<>c.b__0_6 Api.AiV3.Program+<>c.b__0_6 Api.OtelDistro.Program+<>c.b__0_6
operation_Id 7b8517edba54fd9f14bad1b6d3564252 6e400a671ae2aa83c57c541bdf6cf004 8d692bf55a756359fe3fc70d86de0bd3
operation_Name ※1 GET /exception null null
operation_ParentId a0b8ffba8697c588 b76f2d3690092fea 543b496b3f08d499
outerAssembly Api.AiV2, Version=1.0.0.0,... Api.AiV3, Version=1.0.0.0,... Api.OtelDistro, Version=1.0.0.0,...
outerMessage Intentional exception for telemetry... Intentional exception for telemetry... Intentional exception for telemetry...
outerMethod Api.AiV2.Program+<>c.b__0_6 Api.AiV3.Program+<>c.b__0_6 Api.OtelDistro.Program+<>c.b__0_6
outerType System.InvalidOperationException System.InvalidOperationException System.InvalidOperationException
problemId System.InvalidOperationException at Api.AiV2... System.InvalidOperationException at Api.AiV3... System.InvalidOperationException at Api.OtelDistro...
sdkVersion il:2.23.0-29 dotnet10.0.0-rtm...:otel1.15.0:shc3.0.0 dotnet10.0.0-rtm...:otel1.14.0:ext1.5.0-d
severityLevel 3 3 3
timestamp [UTC] yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss yyyy/m/dd hh:mm:ss.sss
type System.InvalidOperationException System.InvalidOperationException System.InvalidOperationException
customDimensions CategoryName Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
customDimensions EventId 2 2 2
customDimensions EventName ApplicationError ApplicationError ApplicationError
customDimensions TraceIdentifier 40000370-0000-... 40000fa9-0000-... 40000fae-0000-...
customDimensions _MS.ProcessedByMetricExtractors ※1 (Name:'Exceptions', Ver:'1.1') null null

分析

appiv2 からの破壊的変更

  • cloud_RoleName フィールドは、appiv2 ではデプロイ先インスタンスを想起させる名前(Azure のデフォルトホスト名のような値)が設定されている一方で、appiv3 / otel ではサービス名に寄った値が設定されるように見えました
  • cloud_RoleInstance フィールドは、appiv2 では短い値(例: wn0sdwk00029I)が設定されていました。一方で appiv3 / otel では長いハッシュ様の値が設定されるようになっており、instance id 相当の値のように見えました
  • structured logging の扱いの差異が気になったため、traces / exceptions には独自フィールド(Custom_ErrorCode など)を設定していました。今回の範囲では、独自フィールドの値自体は appiv2 / appiv3 / otel のいずれでも同様に出力されていました
  • customDimensions 内のキーには大きな差異がありました。例えば OriginalFormatTraceIdAspNetCoreEnvironment は appiv3 / otel では確認できませんでした
  • operation_Name は、requests では各パターンで設定されていましたが、dependencies / traces / exceptions では appiv3 / otel で null になっていました。operation_Name を前提にした集計・アラート・ダッシュボードがある場合は影響が出そうです

appiv3 / otel で追加された項目

  • client_Browser 等の client フィールドは、appiv2 より appiv3 / otel で設定されるようになっていました。集計などで利用している場合は、結果の分布に影響を与える可能性があります
  • exceptions の innermost* 関連の情報は、appiv2 では設定されていない一方で appiv3 / otel では設定されていました

appiv3 と otel の差異

今回の検証範囲では appiv3 と otel のログ出力はほぼ同一でしたが、以下の差異が確認できました。

  • customDimensions microsoft.sample_rate: appiv3 では 100 が記録されていたのに対し、otel では null でした。appiv3 ではサンプリングレートがメタデータとして明示的に記録される一方、otel ではこの情報が付与されないようです
  • sdkVersion: appiv3 は otel1.15.0:shc3.0.0、otel は otel1.14.0:ext1.5.0-d となっており、内部で利用する OpenTelemetry SDK のバージョンや Exporter の種別が異なることがわかります

上記以外のフィールドでは、appiv3 と otel の間に実質的な差異は見られませんでした。いずれも OpenTelemetry ベースの実装であることから、Azure Monitor 上のログ構造は収束しているようです。

総評、所感

今回の条件での検証範囲では、主要テーブル(requests / traces / dependencies / exceptions)自体は維持されており、移行によってすべてが大きく崩れるわけではなさそうでした。一方で、operation_Nameapplication_Version のように null になる列、cloud_RoleName / cloud_RoleInstance のように値の性質が変わる列、customDimensions のキー差分は確認できました。ログの内容を監視や集計に利用している場合は、移行前に参照している列・キーを洗い出したうえで検証することが重要です。

移行時のチェックリスト

本検証の結果を踏まえ、v2 からの移行を検討する際には少なくとも以下の確認をしたほうがよさそうです。

  • operation_Name を利用した KQL クエリ・Log Alert ルール・ダッシュボードがないか確認する(dependencies / traces / exceptions で null になるため)
  • application_Version を参照している監視・集計がないか確認する(v3 / otel では null
  • cloud_RoleName / cloud_RoleInstance の値に依存したフィルタリングや集計がないか確認する(値の形式が変わるため)
  • customDimensions 内のキー(OriginalFormatTraceIdSpanIdAspNetCoreEnvironment 等)を参照している箇所がないか確認する
  • structured logging で出力している独自フィールドが移行後も同様に記録されることを検証する
  • 移行先で新たに追加されるフィールド(client_Browserinnermost* 等)が既存の集計結果に影響しないか確認する
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?