MCPcopy Index your code
hub / github.com/cloudfoundry/app-autoscaler

github.com/cloudfoundry/app-autoscaler @v15.16.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v15.16.0 ↗ · + Follow
2,638 symbols 10,481 edges 470 files 166 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Application Autoscaler

The Application Autoscaler provides the capability to adjust the computation resources for Cloud Foundry applications through:

  • Dynamic scaling based on application performance metrics
  • Dynamic scaling based on custom metrics
  • Scheduled scaling based on time

This repository contains the core Application Autoscaler source code, extracted and refactored from app-autoscaler-release.

Architecture

The Application Autoscaler consists of several microservices and are deployed as CF Applications

Component Description
api Public-facing API server for policy management and scaling history
servicebroker Cloud Foundry service broker implementation
scheduler Manages scheduled scaling policies and triggers scaling actions
eventgenerator Evaluates scaling rules and generates scaling events based on metrics
scalingengine Executes scaling decisions by adjusting application instances
metricsforwarder Forwards custom application metrics to the autoscaler
operator Manages autoscaler operations and instance synchronization

API Specifications

OpenAPI specifications are available in the openapi/ directory:

  • application-metric-api.openapi.yaml - Application metrics API
  • custom-metrics-api.openapi.yaml - Custom metrics submission API
  • policy-api.openapi.yaml - Scaling policy management API
  • scaling-history-api.openapi.yaml - Scaling history query API
  • internal-scaling-history-api.openapi.yaml - Internal scaling history API

Local Development

Prerequisites

  • Go 1.24.3 or later
  • Docker to spin up required databases
  • devbox (optional but recommended) - starts a shell with all required tools
  • Maven for building the Java-based scheduler component
  • direnv (optional) to automatically configure the development environment

Make Targets

Target Description
make generate-fakes Generate test mocks/fakes
make test Run unit tests against PostgreSQL
make integration Run integration tests against PostgreSQL
make acceptance-tests Run acceptance tests (see acceptance/README.md)
make lint Check code style
OPTS=--fix make lint Check code style and apply auto-fixes
make fmt Format Go code
make clean Remove build artifacts and generated code
make mta-build Build MTA archive for deployment
make mta-deploy Deploy to Cloud Foundry using MTA

Use Application Autoscaler Service

Refer to user guide for the details of how to use the Auto-Scaler service, including policy definition, supported metrics, public API specification and command line tool.

Monitor Microservices

The app-autoscaler provides a number of health endpoints that are available externally that can be used to check the state of each component. Each health endpoint is protected with basic auth (apart from the api server), the usernames are listed in the table below, but the passwords are available in credhub.

Component Health URL Username Password Key
eventgenerator https://autoscaler-eventgenerator.((system_domain))/health eventgenerator /autoscaler_eventgenerator_health_password
metricsforwarder https://autoscaler-metricsforwarder.((system_domain))/health metricsforwarder /autoscaler_metricsforwarder_health_password
scalingengine https://autoscaler-scalingengine.((system_domain))/health scalingengine /autoscaler_scalingengine_health_password
operator https://autoscaler-operator.((system_domain))/health operator /autoscaler_operator_health_password
scheduler https://autoscaler-scheduler.((system_domain))/health scheduler /autoscaler_scheduler_health_password

Running Tests

# Run all unit tests
make test

# Run integration tests
make integration

# Run acceptance tests (requires deployed autoscaler)
make acceptance-tests

Note: Running tests will automatically spin up the PostgreSQL database via Docker.

Database Setup

The autoscaler supports PostgreSQL.

To manually start a local database for development:

make start-db                    # Start PostgreSQL

To stop the database:

make stop-db                     # Stop PostgreSQL

Documentation

Related Repositories

License

This project is released under version 2.0 of the Apache License.

Extension points exported contracts — how you extend this code

ConfigValidator (Interface)
(no doc) [10 implementers]
startup/startup.go
MetricForwarder (Interface)
(no doc) [5 implementers]
metricsforwarder/forwarder/metric_forwarder.go
DatabaseStatus (Interface)
(no doc) [5 implementers]
healthendpoint/database_status_collector.go
Pinger (Interface)
(no doc) [5 implementers]
healthendpoint/health_readiness.go
Emitter (Interface)
(no doc) [5 implementers]
metricsgateway/emitter/syslog_emitter.go
Operator (Interface)
(no doc) [4 implementers]
operator/applicationsyncer.go
BasicAuthHandlingImplConfig (Interface)
BasicAuthHandlingImplConfig defines how "Basic Authentication" is implemented. This is a sealed interface with two imple [2 …
models/basic_auth_config.go
TimeWaster (Interface)
counterfeiter:generate . TimeWaster [2 implementers]
acceptance/assets/app/go_app/internal/app/responsetime.go

Core symbols most depended-on inside this repo

Error
called by 496
metricsforwarder/server/errors.go
Add
called by 242
cf/mocks/mocks.go
Info
called by 151
cf/mocks/mocks.go
Close
called by 144
db/sqldb/lock_sqldb.go
String
called by 104
api/broker/binding_request_parser/binding-request-parser.go
get
called by 90
ratelimiter/store.go
Printf
called by 83
helpers/loggregator_logger.go
DefaultTimeoutDuration
called by 82
acceptance/config/config.go

Shape

Method 1,354
Function 780
Struct 317
Class 94
Interface 49
TypeAlias 21
FuncType 19
Enum 4

Languages

Go72%
Java28%
Python1%

Modules by API surface

integration/integration_suite_test.go60 symbols
db/db.go58 symbols
acceptance/helpers/helpers.go51 symbols
configutil/cf.go47 symbols
acceptance/config/config.go45 symbols
models/policy.go36 symbols
api/broker/broker.go36 symbols
db/sqldb/sqldb_suite_test.go34 symbols
scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/util/TestDataSetupHelper.java33 symbols
cf/cfclient_wrapper.go33 symbols
scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleManagerTest.java31 symbols
scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/quartz/AppScalingScheduleJobTest.java30 symbols

Datastores touched

autoscalerDatabase · 1 repos
(mysql)Database · 1 repos
policy_dbDatabase · 1 repos
pqgotestDatabase · 1 repos
autoscalerDatabase · 1 repos
bindingDatabase · 1 repos
dbnameDatabase · 1 repos
policyDatabase · 1 repos

For agents

$ claude mcp add app-autoscaler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page