Skip to content

Commit

Permalink
更新 plugin 、在說明中加入新功能的資訊
Browse files Browse the repository at this point in the history
  • Loading branch information
YuChia-Wei committed Feb 29, 2024
1 parent b128836 commit 9dca41d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ The pre-installed plugin provides the following functionalities:

## 執行時需要的環境參數

- [官方說明文件](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.1.0/docs/README.md)
- [官方設定參數說明](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.1.0/docs/config.md)
- [官方說明文件](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.4.0/docs/README.md)
- [官方設定參數說明](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/v1.4.0/docs/config.md)

### Open Telemetry 執行參數

Expand Down Expand Up @@ -95,6 +95,16 @@ The pre-installed plugin provides the following functionalities:
| OTEL_RESOURCE_ATTRIBUTES | service.version=docker-image-name:imagetag, service.namespace=service-namespace, deployment.environment=dev |
| OTEL_SERVICE_NAME | sample-api |

### Instrumentation options (1.4.0 版後支援)

**因為 1.4.0 版後已支援使用環境參數調整 SQL 語法的輸出,因此在 Plugin 中的設定已被移除**

| Environment variable | Default value |
|-----------------------------------------------------------------|---------------|
| `OTEL_DOTNET_AUTO_ENTITYFRAMEWORKCORE_SET_DBSTATEMENT_FOR_TEXT` | `false` |
| `OTEL_DOTNET_AUTO_GRAPHQL_SET_DOCUMENT` | `false` |
| `OTEL_DOTNET_AUTO_SQLCLIENT_SET_DBSTATEMENT_FOR_TEXT` | `false` |

## 更新命令筆記

**建議在 wsl 內執行以下命令,因為 linux 的命令操作比較方便**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<!-- <PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.9" />-->
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.1" />
<!-- <PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10" />-->
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.7.0-beta.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void ConfigureTracesOptions(HttpClientTraceInstrumentationOptions options
options.RecordException = true;

// for .net / .net core
// Request 過濾器
// options.FilterHttpRequestMessage = httpRequestMessage => HttpClientRequestHostChecker.IsValidHost(httpRequestMessage.RequestUri?.Host);

// for .net framework
Expand All @@ -84,12 +85,9 @@ public void ConfigureTracesOptions(HttpClientTraceInstrumentationOptions options
/// should be rename to ConfigureTracesOptions when OpenTelemetry.DotNet.Instrumentation upgrade to ^0.5.1
/// </summary>
/// <param name="options"></param>
public void ConfigureTracesOptions(SqlClientInstrumentationOptions options)
public void ConfigureTracesOptions(SqlClientTraceInstrumentationOptions options)
{
options.RecordException = true;

// 這邊建議視情況開啟,可以用環境參數去控制開關
options.SetDbStatementForText = true;
}

/// <summary>
Expand Down

0 comments on commit 9dca41d

Please sign in to comment.