Skip to content

Commit

Permalink
Update to the 1.7.0-alpha release of otel (#373)
Browse files Browse the repository at this point in the history
* Update to the 1.7.0-alpha release of otel
- This adds 2 experimental flags to for projects to enable the semantic conventions for event ids and exceptions

Fixes #173

* Updated the otel in memory exporter to make tests pass
  • Loading branch information
davidfowl authored Oct 18, 2023
1 parent c7c1713 commit 37207ea
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 40 deletions.
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
<PackageVersion Include="Npgsql.DependencyInjection" Version="8.0.0-rc.2" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.2" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="8.0.0-rc.2" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.6.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.7.0-alpha.1" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0-alpha.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.6.0-rc.1" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0-alpha.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.7" />
<PackageVersion Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.5.1-alpha.1" />
Expand Down
20 changes: 10 additions & 10 deletions samples/dapr/AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"servicea": {
"type": "project.v1",
"path": "..\\ServiceA\\DaprServiceA.csproj",
"env": {},
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
Expand All @@ -20,7 +23,10 @@
"serviceb": {
"type": "project.v1",
"path": "..\\ServiceB\\DaprServiceB.csproj",
"env": {},
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
Expand All @@ -36,10 +42,7 @@
},
"service-a": {
"type": "executable.v1",
"env": {
"OTEL_EXPORTER_OTLP_INSECURE": "true",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc"
},
"env": {},
"bindings": {
"grpc": {
"scheme": "tcp",
Expand All @@ -60,10 +63,7 @@
},
"service-b": {
"type": "executable.v1",
"env": {
"OTEL_EXPORTER_OTLP_INSECURE": "true",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc"
},
"env": {},
"bindings": {
"grpc": {
"scheme": "tcp",
Expand Down
34 changes: 11 additions & 23 deletions samples/eShopLite/AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"resources": {
"grafana": {
"type": "container.v1",
"image": "grafana/grafana:latest",
"bindings": {
"grafana-http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
}
}
},
"postgres": {
"type": "postgres.server.v1"
},
Expand All @@ -25,6 +14,8 @@
"type": "project.v1",
"path": "..\\CatalogService\\CatalogService.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"ConnectionStrings__catalog": "{catalog.connectionString}"
},
"bindings": {
Expand All @@ -50,6 +41,8 @@
"type": "project.v1",
"path": "..\\BasketService\\BasketService.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"ConnectionStrings__basketCache": "{basketCache.connectionString}",
"ConnectionStrings__messaging": "{messaging.connectionString}"
},
Expand All @@ -70,6 +63,8 @@
"type": "project.v1",
"path": "..\\MyFrontend\\MyFrontend.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"services__basketservice__0": "{basketservice.bindings.http.url}",
"services__basketservice__1": "{basketservice.bindings.https.url}",
"services__catalogservice__0": "{catalogservice.bindings.http.url}"
Expand All @@ -91,6 +86,8 @@
"type": "project.v1",
"path": "..\\OrderProcessor\\OrderProcessor.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"ConnectionStrings__messaging": "{messaging.connectionString}"
},
"bindings": {
Expand All @@ -110,6 +107,8 @@
"type": "project.v1",
"path": "..\\ApiGateway\\ApiGateway.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"services__basketservice__0": "{basketservice.bindings.http.url}",
"services__basketservice__1": "{basketservice.bindings.https.url}",
"services__catalogservice__0": "{catalogservice.bindings.http.url}",
Expand All @@ -127,17 +126,6 @@
"transport": "http"
}
}
},
"prometheus": {
"type": "container.v1",
"image": "prom/prometheus:latest",
"bindings": {
"tcp": {
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp"
}
}
}
}
}
}
4 changes: 4 additions & 0 deletions src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public static class ProjectResourceBuilderExtensions
{
var project = new ProjectResource(name);
var projectBuilder = builder.AddResource(project);
// We only want to turn these on for .NET projects, ConfigureOtlpEnvironment works for any resource type that
// implements IDistributedApplicationResourceWithEnvironment.
projectBuilder.WithEnvironment("OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES", "true");
projectBuilder.WithEnvironment("OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES", "true");
projectBuilder.ConfigureOtlpEnvironment();
projectBuilder.ConfigureConsoleLogs();
var serviceMetadata = new TProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="<REPLACE_WITH_EXTENSIONS_VERSION>" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="<REPLACE_WITH_LATEST_VERSION>" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0-alpha.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0-alpha.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.5.1-beta.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="<REPLACE_WITH_EXTENSIONS_VERSION>" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="<REPLACE_WITH_LATEST_VERSION>" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0-alpha.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0-alpha.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.5.1-beta.1" />
Expand Down

0 comments on commit 37207ea

Please sign in to comment.