Closed alfusinigoj closed 4 years ago
@hananiel At this point, do we need to enable /info and /health endpoints explicitly via configuration or they exposed by default. Any samples are welcome. Thanks!
@alfusinigoj health and info should be exposed by default. Here is a sample: https://github.com/SteeltoeOSS/Samples/blob/master/Management/src/AspDotNetCore/CloudFoundry/Startup.cs
@hananiel the sample still uses steeltoe 2.4.0-rc1 which has this issue, i will test and let you know. thanks!
@hananiel I still think we will not be able to use cloudfoundry actuators and hypermedia actuators together. Is that true? Because it doesn't seem to work when i used ActuatorContext.ActuatorAndCloudFoundry
It was working before - let me take a look.
ok thanks @hananiel . Here is my code (using in a ASP.NET app)
ActuatorConfigurator.UseCloudFoundryActuators(configuration,
dynamicLoggerProvider,
MediaTypeVersion.V1,
ActuatorContext.ActuatorAndCloudFoundry,
GetHealthContributors(),
GlobalConfiguration.Configuration.Services.GetApiExplorer(),
loggerFactory);
Looking at this decompiled code... it seems like the hypermedia actuator is ignored for any context other than Actuator
public static void UseCloudFoundryActuators(IConfiguration configuration, ILoggerProvider dynamicLogger, MediaTypeVersion version, ActuatorContext context, IEnumerable<IHealthContributor> healthContributors = null, IApiExplorer apiExplorer = null, ILoggerFactory loggerFactory = null)
{
if (context != ActuatorContext.Actuator)
{
ActuatorConfigurator.UseCloudFoundrySecurity(configuration, null, loggerFactory);
ActuatorConfigurator.UseCloudFoundryActuator(configuration, loggerFactory);
}
else
{
ActuatorConfigurator.UseHypermediaActuator(configuration, loggerFactory);
}
ActuatorConfigurator.UseHealthActuator(configuration, null, healthContributors, loggerFactory);
ActuatorConfigurator.UseHeapDumpActuator(configuration, null, loggerFactory);
ActuatorConfigurator.UseThreadDumpActuator(configuration, version, null, loggerFactory);
ActuatorConfigurator.UseInfoActuator(configuration, null, loggerFactory);
ActuatorConfigurator.UseLoggerActuator(configuration, dynamicLogger, loggerFactory);
ActuatorConfigurator.UseTraceActuator(configuration, version, null, loggerFactory);
ActuatorConfigurator.UseMappingsActuator(configuration, apiExplorer, loggerFactory);
}
@alfusinigoj looking at the decompiled code now -- it does not match the latest version of 2.x. 2.4.0 is the latest stable and it was cut on Nov13th. For now myget is the latest version. I'll update the 4.x sample to reflect this once released - which should be soon.
This fix will be in 2.4.1 set to be released 1/17.
tested with steeltoe dev version, works perfect. thanks!
@alfusinigoj , can you please provide me a sample where you have got the actuator work. I'm still not able to get it working
@VenkateshSrini here is a working sample https://github.com/alfusinigoj/pivotal_aspnet_bootstrap_cloudfoundry_extensions/tree/master/samples/Actuators/ActuatorSample
Thanks alfus it worked
Describe the bug
Package
steeltoe.management.endpointweb.2.4.0-rc1
Trying to enable actuators for an ASP.NET full framework application using
ActuatorConfigurator
as below. The problem is that when I set the context toActuatorContext.Actuator
I am able to hit the endpoints, say/actuator/health
, but since I need the Cf Actuators to be enabled for AppsMan, I set the context toActuatorContext.ActuatorAndCloudFoundry
where I can see the actuators enabled in AppsMan, but I am getting401 UnAuthorized
when trying to access the endpoints say/actuator/health
or/actuator/info
Expected behavior
When context is set to
ActuatorContext.ActuatorAndCloudFoundry
, we should be able to hit the endpoints, together with AppsMan actuators.Environment (please complete the following information):