Skip to content

Commit 05b7eb5

Browse files
committed
Merge branch '3.x'
2 parents ba7cbe1 + 529e2e1 commit 05b7eb5

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/framework-metric_writer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The credential payload of the service may contain the following entries:
2121
| Name | Description
2222
| ---- | -----------
2323
| `access_key` | The access key used to authenticate agains the endpoint
24-
| `hostname` | The hostname of the endpoint
24+
| `endpoint` | The endpoint
2525

2626
## Configuration
2727
For general information on configuring the buildpack, including how to specify configuration values through environment variables, refer to [Configuration and Extension][].

lib/java_buildpack/framework/metric_writer.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def release
3636
@droplet.java_opts
3737
.add_system_property('cloudfoundry.metrics.accessToken', credentials[ACCESS_KEY])
3838
.add_system_property('cloudfoundry.metrics.applicationId', @application.details['application_id'])
39-
.add_system_property('cloudfoundry.metrics.endpoint', "https://#{credentials[HOSTNAME]}")
39+
.add_system_property('cloudfoundry.metrics.endpoint', credentials[ENDPOINT])
4040
.add_system_property('cloudfoundry.metrics.instanceId', '$CF_INSTANCE_GUID')
4141
.add_system_property('cloudfoundry.metrics.instanceIndex', '$CF_INSTANCE_INDEX')
4242
end
@@ -45,16 +45,16 @@ def release
4545

4646
# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
4747
def supports?
48-
@application.services.one_service? FILTER, ACCESS_KEY, HOSTNAME
48+
@application.services.one_service? FILTER, ACCESS_KEY, ENDPOINT
4949
end
5050

5151
ACCESS_KEY = 'access_key'.freeze
5252

53-
FILTER = /metrics-forwarder/
53+
ENDPOINT = 'endpoint'.freeze
5454

55-
HOSTNAME = 'hostname'.freeze
55+
FILTER = /metrics-forwarder/
5656

57-
private_constant :ACCESS_KEY, :FILTER, :HOSTNAME
57+
private_constant :ACCESS_KEY, :ENDPOINT, :FILTER
5858

5959
end
6060

spec/java_buildpack/framework/metric_writer_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
context do
2828

2929
before do
30-
allow(services).to receive(:one_service?).with(/metrics-forwarder/, 'access_key', 'hostname').and_return(true)
30+
allow(services).to receive(:one_service?).with(/metrics-forwarder/, 'access_key', 'endpoint').and_return(true)
3131
end
3232

3333
it 'detects with metric-forwarder service' do
@@ -54,7 +54,7 @@
5454
cache_fixture: 'stub-metric-writer.jar' do
5555

5656
allow(services).to receive(:find_service).and_return('credentials' => { 'access_key' => 'test-access-key',
57-
'hostname' => 'test-hostname' })
57+
'endpoint' => 'https://test-endpoint' })
5858

5959
component.release
6060

@@ -63,13 +63,13 @@
6363

6464
it 'updates JAVA_OPTS' do
6565
allow(services).to receive(:find_service).and_return('credentials' => { 'access_key' => 'test-access-key',
66-
'hostname' => 'test-hostname' })
66+
'endpoint' => 'https://test-endpoint' })
6767

6868
component.release
6969

7070
expect(java_opts).to include('-Dcloudfoundry.metrics.accessToken=test-access-key')
7171
expect(java_opts).to include('-Dcloudfoundry.metrics.applicationId=test-application-id')
72-
expect(java_opts).to include('-Dcloudfoundry.metrics.endpoint=https://test-hostname')
72+
expect(java_opts).to include('-Dcloudfoundry.metrics.endpoint=https://test-endpoint')
7373
expect(java_opts).to include('-Dcloudfoundry.metrics.instanceId=$CF_INSTANCE_GUID')
7474
expect(java_opts).to include('-Dcloudfoundry.metrics.instanceIndex=$CF_INSTANCE_INDEX')
7575
end

0 commit comments

Comments
 (0)