Skip to content

Commit

Permalink
feat(signalfx): Add configurable remote baseurls to support realms. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldju authored and cfieber committed Jun 5, 2019
1 parent fd8e438 commit 861f1a7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 55 deletions.
5 changes: 4 additions & 1 deletion kayenta-signalfx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ This module adds support to Kayenta to use SignalFx as a metric source.
enabled: true
accounts:
- name: sfx-integration-test-account
accessToken: ${kayenta.signalfx.apiKey}
accessToken: ${kayenta.signalfx.apiKey} # The sfx api token
endpoint.baseUrl: https://stream.signalfx.com # Optional defaults to https://stream.signalfx.com
defaultScopeKey: server_scope # Optional, if omitted every request must supply the _scope_key param in extended scope params
defaultLocationKey: server_region # Optional, if omitted requests must supply the _location_key if it is needed.
supportedTypes:
- METRICS_STORE
```
Expand Down
51 changes: 0 additions & 51 deletions kayenta-signalfx/src/integration-test/resources/config/kayenta.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
redis:
connection: redis://localhost:${redis.port}

#retrofit:
# logLevel: FULL

kayenta:
atlas:
enabled: false

google:
enabled: false

aws:
enabled: false

datadog:
enabled: false

prometheus:
enabled: false

influxdb:
enabled: false

gcs:
enabled: false

s3:
enabled: false

signalfx:
enabled: true
Expand All @@ -39,9 +13,6 @@ kayenta:
defaultScopeKey: canary-scope
defaultLocationKey: location

stackdriver:
enabled: false

memory:
enabled: true
accounts:
Expand All @@ -54,8 +25,6 @@ kayenta:

standaloneCanaryAnalysis.enabled: true

management.security.enabled: false

keiko:
queue:
redis:
Expand All @@ -66,23 +35,3 @@ spectator:
applicationName: ${spring.application.name}
webEndpoint:
enabled: true

swagger:
enabled: true
title: Kayenta API
description:
contact:
patterns:
- /admin.*
- /canary.*
- /canaryConfig.*
- /canaryJudgeResult.*
- /credentials.*
- /fetch.*
- /health
- /judges.*
- /metadata.*
- /metricSetList.*
- /metricSetPairList.*
- /pipeline.*
- /standalone.*
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

@Configuration
Expand Down Expand Up @@ -79,8 +80,8 @@ MetricsService signalFxMetricService(SignalFxConfigurationProperties signalFxCon
List<AccountCredentials.Type> supportedTypes = signalFxManagedAccount.getSupportedTypes();
SignalFxCredentials signalFxCredentials = new SignalFxCredentials(signalFxManagedAccount.getAccessToken());

final RemoteService signalFxSignalFlowEndpoint = new RemoteService()
.setBaseUrl(SIGNAL_FX_SIGNAL_FLOW_ENDPOINT_URI);
final RemoteService signalFxSignalFlowEndpoint = Optional.ofNullable(signalFxManagedAccount.getEndpoint())
.orElse(new RemoteService().setBaseUrl(SIGNAL_FX_SIGNAL_FLOW_ENDPOINT_URI));

SignalFxNamedAccountCredentials.SignalFxNamedAccountCredentialsBuilder accountCredentialsBuilder =
SignalFxNamedAccountCredentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package com.netflix.kayenta.signalfx.config;

import com.netflix.kayenta.retrofit.config.RemoteService;
import com.netflix.kayenta.security.AccountCredentials;
import lombok.Data;

Expand All @@ -34,6 +35,9 @@ public class SignalFxManagedAccount {

private List<AccountCredentials.Type> supportedTypes;

@Nullable
private RemoteService endpoint;

@Nullable
private String defaultScopeKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.netflix.kayenta.signalfx.service;

import java.util.Optional;

public class SignalFxRequestError extends RuntimeException {

private static final String MSG_TEMPLATE =
Expand All @@ -26,6 +28,7 @@ public class SignalFxRequestError extends RuntimeException {
public SignalFxRequestError(ErrorResponse errorResponse, String program, long start, long end,
long resolution, String accountName) {

super(String.format(MSG_TEMPLATE, program, start, end, resolution, accountName, errorResponse.toString()));
super(String.format(MSG_TEMPLATE, program, start, end, resolution, accountName,
errorResponse != null ? errorResponse.toString() : "no response received from Signal Fx"));
}
}

0 comments on commit 861f1a7

Please sign in to comment.