Skip to content

Commit

Permalink
Updrade to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Jun 27, 2024
1 parent 61da412 commit 7346be4
Show file tree
Hide file tree
Showing 19 changed files with 128 additions and 86 deletions.
40 changes: 40 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<EventuousVersion>0.15.0-rc.1</EventuousVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Eventuous.Extensions.DependencyInjection" Version="$(EventuousVersion)"/>
<PackageVersion Include="Eventuous.Diagnostics.OpenTelemetry" Version="$(EventuousVersion)"/>
<PackageVersion Include="Eventuous.Gateway" Version="$(EventuousVersion)"/>
<PackageVersion Include="Eventuous.ElasticSearch" Version="$(EventuousVersion)"/>
<PackageVersion Include="Eventuous.EventStore" Version="$(EventuousVersion)" />
<PackageVersion Include="Eventuous.Projections.MongoDB" Version="$(EventuousVersion)" />
<PackageVersion Include="Eventuous.Subscriptions.Polly" Version="$(EventuousVersion)"/>
<PackageVersion Include="Serilog" Version="4.0.0"/>
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1"/>
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0"/>
<PackageVersion Include="NetEscapades.Configuration.Yaml" Version="3.1.0"/>
<PackageVersion Include="Google.Protobuf" Version="3.27.2" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.63.0"/>
<PackageVersion Include="Grpc.Core.Api" Version="2.63.0" />
<PackageVersion Include="Grpc.Tools" Version="2.64.0" PrivateAssets="All"/>
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageVersion Include="MongoDB.Driver.Core.Extensions.OpenTelemetry" Version="1.0.0" />
<PackageVersion Include="OpenTelemetry.Exporter.Jaeger" Version="1.5.1"/>
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0"/>
<PackageVersion Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.9.0-beta.2"/>
<PackageVersion Include="OpenTelemetry.Exporter.Zipkin" Version="1.9.0"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.9.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Contrib.Instrumentation.ElasticsearchClient" Version="1.0.0-beta2"/>
<PackageVersion Include="MinVer" Version="5.0.0" PrivateAssets="All"/>
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup Label="Depencies for samples">
<PackageVersion Include="Microsoft.AspNetCore.Grpc.Swagger" Version="0.8.6" />
<PackageVersion Include="Microsoft.AspNetCore.Grpc.JsonTranscoding" Version="8.0.6" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions samples/GrpcProjector/GrpcProjector.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -13,12 +13,12 @@
</PropertyGroup>
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Grpc.Swagger" Version="0.3.9" />
<PackageReference Include="Serilog" Version="2.12.0"/>
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0"/>
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0"/>
<PackageReference Include="Microsoft.AspNetCore.Grpc.JsonTranscoding" Version="7.0.9" />
<PackageReference Include="Grpc.AspNetCore" Version="2.49.0"/>
<PackageReference Include="Microsoft.AspNetCore.Grpc.Swagger"/>
<PackageReference Include="Serilog"/>
<PackageReference Include="Serilog.AspNetCore"/>
<PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="Microsoft.AspNetCore.Grpc.JsonTranscoding"/>
<PackageReference Include="Grpc.AspNetCore"/>
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\server.proto" GrpcServices="Server"/>
Expand Down
11 changes: 4 additions & 7 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EventuousVersion>0.14.1-alpha.0.31</EventuousVersion>
<OtelVersion>1.5.0-rc.1</OtelVersion>
<OtelExtensionsVersion>1.0.0-rc9.6</OtelExtensionsVersion>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
<NoWarn>CS8981</NoWarn>
</PropertyGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="MinVer" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
<None Include="$(RepoRoot)\e-logo.png" Pack="true" PackagePath="\"/>
<Using Include="JetBrains.Annotations"/>
<Using Include="Eventuous"/>
Expand Down
24 changes: 12 additions & 12 deletions src/Eventuous.Connector.Base/App/ConnectorApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ IHealthChecksBuilder healthChecks
)
where TSubscription : EventSubscription<TSubscriptionOptions>
where TSubscriptionOptions : SubscriptionOptions
where TProducer : class, IEventProducer<TProduceOptions>
where TProducer : class, IProducer<TProduceOptions>
where TProduceOptions : class;

LogEventLevel? _minimumLogLevel;
LogEventLevel? _minimumLogLevel;
Func<LoggerSinkConfiguration, LoggerConfiguration>? _sinkConfiguration;
Func<LoggerConfiguration, LoggerConfiguration>? _configureLogger;
Func<LoggerConfiguration, LoggerConfiguration>? _configureLogger;

internal ConnectorApplicationBuilder(string configFile) {
Builder = WebApplication.CreateBuilder();
Expand All @@ -56,7 +56,7 @@ internal ConnectorApplicationBuilder(string configFile) {
}

public IHealthChecksBuilder HealthChecks { get; }
WebApplicationBuilder Builder { get; }
WebApplicationBuilder Builder { get; }

public ConnectorConfig<TSourceConfig, TTargetConfig, TFilterConfig> Config { get; }

Expand All @@ -78,25 +78,25 @@ ConfigureConnector<TSubscription, TSubscriptionOptions, TProducer, TProduceOptio
)
where TSubscription : EventSubscription<TSubscriptionOptions>
where TSubscriptionOptions : SubscriptionOptions
where TProducer : class, IEventProducer<TProduceOptions>
where TProducer : class, IProducer<TProduceOptions>
where TProduceOptions : class {
var builder = configure(new ConnectorBuilder(), Config, HealthChecks);
builder.Register(Builder.Services, HealthChecks);
}

const string ConnectorIdTag = "connectorId";

void EnrichActivity(Activity activity, string arg1, object arg2) => activity.AddTag(ConnectorIdTag, Config.Connector.ConnectorId);
void EnrichActivity(Activity activity) => activity.AddTag(ConnectorIdTag, Config.Connector.ConnectorId);

bool _oTelAdded;

[PublicAPI]
public void AddOpenTelemetry(
Action<TracerProviderBuilder, Action<Activity, string, object>>? configureTracing = null,
Action<MeterProviderBuilder>? configureMetrics = null,
Sampler? sampler = null,
ExporterMappings<TracerProviderBuilder>? tracingExporters = null,
ExporterMappings<MeterProviderBuilder>? metricsExporters = null
Action<TracerProviderBuilder, Action<Activity>>? configureTracing = null,
Action<MeterProviderBuilder>? configureMetrics = null,
Sampler? sampler = null,
ExporterMappings<TracerProviderBuilder>? tracingExporters = null,
ExporterMappings<MeterProviderBuilder>? metricsExporters = null
) {
_oTelAdded = true;

Expand Down Expand Up @@ -187,4 +187,4 @@ this ConnectorApplicationBuilder<TSourceConfig, TTargetConfig, TFilterConfig> bu

return application.Run();
}
}
}
4 changes: 2 additions & 2 deletions src/Eventuous.Connector.Base/App/ConnectorBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ConnectorBuilder<TSub, TSubOptions> ConfigureSubscription(Action<Subscrip
[PublicAPI]
public ConnectorBuilder<TSub, TSubOptions, TProducer, TProduceOptions>
ProduceWith<TProducer, TProduceOptions>(ResolveRetryPolicy? retryPolicy = null, bool awaitProduce = true)
where TProducer : class, IEventProducer<TProduceOptions>
where TProducer : class, IProducer<TProduceOptions>
where TProduceOptions : class
=> new(this, retryPolicy, awaitProduce);

Expand All @@ -68,7 +68,7 @@ bool awaitProduce
)
where TSub : EventSubscription<TSubOptions>
where TSubOptions : SubscriptionOptions
where TProducer : class, IEventProducer<TProduceOptions>
where TProducer : class, IProducer<TProduceOptions>
where TProduceOptions : class {
Func<IServiceProvider, IGatewayTransform<TProduceOptions>>? _getTransformer;
Type? _transformerType;
Expand Down
22 changes: 11 additions & 11 deletions src/Eventuous.Connector.Base/Eventuous.Connector.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eventuous.AspNetCore" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.Gateway" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.Subscriptions.Polly" Version="$(EventuousVersion)" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.2.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.48.0" />
<PackageReference Include="Grpc.Tools" Version="2.48.1" PrivateAssets="All" />
<PackageReference Include="Eventuous.Extensions.DependencyInjection"/>
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry"/>
<PackageReference Include="Eventuous.Gateway"/>
<PackageReference Include="Eventuous.Subscriptions.Polly"/>
<PackageReference Include="Serilog"/>
<PackageReference Include="Serilog.AspNetCore"/>
<PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="NetEscapades.Configuration.Yaml"/>
<PackageReference Include="Grpc.AspNetCore"/>
<PackageReference Include="Grpc.Tools" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions src/Eventuous.Connector.EsdbBase/EsdbProjectorStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Eventuous.Connector.EsdbBase;

public abstract class EsdbProjectorStartup<TConfig, TProjector, TProjectorOptions> : IConnectorStartup
where TConfig : class
where TProjector : class, IEventProducer<TProjectorOptions>
where TProjector : class, IProducer<TProjectorOptions>
where TProjectorOptions : class, new() {
public ConnectorApp BuildConnectorApp(
string configFile,
Expand All @@ -40,7 +40,7 @@ ExporterMappings<MeterProviderBuilder> metricsExporters

builder.AddOpenTelemetry(
(cfg, enrich) => {
cfg.AddGrpcClientInstrumentation(options => options.Enrich = enrich);
cfg.AddGrpcClientInstrumentation(options => options.EnrichWithHttpRequestMessage = (a, _) => enrich(a));
ConfigureTrace(cfg, enrich);
},
sampler: new AlwaysOnSampler(),
Expand Down Expand Up @@ -86,5 +86,5 @@ void RegisterProject(IServiceCollection services, ConnectorConfig<EsdbConfig, TC

protected abstract void RegisterTarget(IServiceCollection services, TConfig config);

protected abstract void ConfigureTrace(TracerProviderBuilder builder, Action<Activity, string, object> enrich);
}
protected abstract void ConfigureTrace(TracerProviderBuilder builder, Action<Activity> enrich);
}
6 changes: 3 additions & 3 deletions src/Eventuous.Connector.EsdbElastic/ConnectorStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ ExporterMappings<MeterProviderBuilder> metricsExporters
builder.AddOpenTelemetry(
(cfg, enrich) =>
cfg
.AddGrpcClientInstrumentation(options => options.Enrich = enrich)
.AddElasticsearchClientInstrumentation(options => options.Enrich = enrich),
.AddGrpcClientInstrumentation(options => options.EnrichWithHttpRequestMessage = (activity, _) => enrich(activity))
.AddElasticsearchClientInstrumentation(options => options.Enrich = (activity, _, _) => enrich(activity)),
sampler: new AlwaysOnSampler(),
tracingExporters: tracingExporters,
metricsExporters: metricsExporters
Expand Down Expand Up @@ -136,4 +136,4 @@ static ConnectorBuilder<AllStreamSubscription, AllStreamSubscriptionOptions> Add
}
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" Version="$(EventuousVersion)"/>
<PackageReference Include="Eventuous.ElasticSearch" Version="$(EventuousVersion)"/>
<PackageReference Include="Eventuous.EventStore" Version="$(EventuousVersion)"/>
<PackageReference Include="Eventuous.Subscriptions.Polly" Version="$(EventuousVersion)"/>
<PackageReference Include="OpenTelemetry.Contrib.Instrumentation.ElasticsearchClient" Version="1.0.0-beta2"/>
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="$(OtelExtensionsVersion)"/>
<PackageReference Include="Grpc.Tools" Version="2.48.1" PrivateAssets="All"/>
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" />
<PackageReference Include="Eventuous.ElasticSearch" />
<PackageReference Include="Eventuous.EventStore" />
<PackageReference Include="Eventuous.Subscriptions.Polly" />
<PackageReference Include="OpenTelemetry.Contrib.Instrumentation.ElasticsearchClient" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Eventuous.Connector.Base\Eventuous.Connector.Base.csproj"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.EventStore" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.Subscriptions.Polly" Version="$(EventuousVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="$(OtelExtensionsVersion)" />
<PackageReference Include="Grpc.Tools" Version="2.48.1" PrivateAssets="All" />
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" />
<PackageReference Include="Eventuous.EventStore" />
<PackageReference Include="Eventuous.Subscriptions.Polly" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Eventuous.Connector.Base\Eventuous.Connector.Base.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Eventuous.Connector.EsdbGenericGrpc/ProjectorStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ExporterMappings<MeterProviderBuilder> metricsExporters
builder.RegisterConnector(ConfigureProjectConnector);

builder.AddOpenTelemetry(
(cfg, enrich) => cfg.AddGrpcClientInstrumentation(options => options.Enrich = enrich),
(cfg, enrich) => cfg.AddGrpcClientInstrumentation(options => options.EnrichWithHttpRequestMessage = (a, _) => enrich(a)),
sampler: new AlwaysOnSampler(),
tracingExporters: tracingExporters,
metricsExporters: metricsExporters
Expand Down Expand Up @@ -61,4 +61,4 @@ IHealthChecksBuilder healthChecks
.ProduceWith<GrpcJsonProjector, GrpcJsonProjectOptions>(sp => RetryPolicies.RetryForever<RpcException>(sp, config))
.TransformWith(getTransform);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.EventStore" Version="$(EventuousVersion)" />
<PackageReference Include="Eventuous.Projections.MongoDB" Version="$(EventuousVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="$(OtelExtensionsVersion)" />
<PackageReference Include="MongoDB.Driver.Core.Extensions.OpenTelemetry" Version="1.0.0" />
<PackageReference Include="Grpc.Tools" Version="2.48.1" PrivateAssets="All" />
<PackageReference Include="Eventuous.Diagnostics.OpenTelemetry" />
<PackageReference Include="Eventuous.EventStore" />
<PackageReference Include="Eventuous.Projections.MongoDB" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" />
<PackageReference Include="MongoDB.Driver.Core.Extensions.OpenTelemetry" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Grpc\Protos\client.proto" GrpcServices="Client" AdditionalImportDirs=".; .." />
Expand Down
2 changes: 1 addition & 1 deletion src/Eventuous.Connector.EsdbMongo/ProjectorStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ protected override void RegisterTarget(IServiceCollection services, MongoConfig
Ensure.NotEmptyString(config.Database, "MongoDB database")
);

protected override void ConfigureTrace(TracerProviderBuilder builder, Action<Activity, string, object> enrich) => builder.AddMongoDBInstrumentation();
protected override void ConfigureTrace(TracerProviderBuilder builder, Action<Activity> enrich) => builder.AddMongoDBInstrumentation();
}
Loading

0 comments on commit 7346be4

Please sign in to comment.