Skip to content

Commit

Permalink
Reverting updates to sample apps
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon committed Apr 4, 2024
1 parent 5d9e578 commit 10178ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 8 additions & 8 deletions test/integrations/applications/SampleAspNetCoreApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public void ConfigureServices(IServiceCollection services)

public static void ConfigureServicesExceptMvc(IServiceCollection services)
{
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SKIP_AGENT_REGISTRATION")))
services.AddAllElasticApm();

const string connection = @"Data Source=blogging.db";
services.AddDbContext<SampleDataContext>
(options => options.UseSqlite(connection));
Expand All @@ -57,12 +54,15 @@ public static void ConfigureServicesExceptMvc(IServiceCollection services)
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
#if NET6_0_OR_GREATER
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
#else
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
#endif
=> ConfigureAllExceptAgent(app);
{
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SKIP_AGENT_REGISTRATION")))
#pragma warning disable CS0618 // Type or member is obsolete
app.UseAllElasticApm(Configuration);
#pragma warning restore CS0618 // Type or member is obsolete

ConfigureAllExceptAgent(app);
}

public static void ConfigureAllExceptAgent(IApplicationBuilder app)
{
Expand Down
10 changes: 8 additions & 2 deletions test/integrations/applications/WebApiSample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using Elastic.Apm.NetCoreAll;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand All @@ -17,7 +18,7 @@ public class Startup

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) =>
services.AddAllElasticApm().AddMvc();
services.AddMvc();


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand All @@ -26,7 +27,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
#else
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
#endif
=> ConfigureAllExceptAgent(app);
{
#pragma warning disable CS0618 // Type or member is obsolete
app.UseAllElasticApm(_configuration);
#pragma warning restore CS0618 // Type or member is obsolete
ConfigureAllExceptAgent(app);
}

public static void ConfigureAllExceptAgent(IApplicationBuilder app)
{
Expand Down

0 comments on commit 10178ee

Please sign in to comment.