Merge pull request #2 from hpcloud-mon/region-config

Add region configuration and use region as meta for all posted metrics.
This commit is contained in:
Jonathan Halterman 2014-06-02 14:06:07 -07:00
commit 64656670d8
3 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,6 @@
# The region for which all metrics passing through this server will be persisted
region: region-a
# Whether this server is running on a secure port
accessedViaHttps: false

View File

@ -28,6 +28,7 @@ import com.hpcloud.messaging.kafka.KafkaConfiguration;
import com.hpcloud.mon.infrastructure.middleware.MiddlewareConfiguration;
public class MonApiConfiguration extends Configuration {
@NotEmpty public String region;
@NotNull public Boolean accessedViaHttps;
@NotEmpty public String metricsTopic = "metrics";
@NotEmpty public String eventsTopic = "events";

View File

@ -52,7 +52,7 @@ public class MetricService {
public void create(List<Metric> metrics, String tenantId, @Nullable String crossTenantId) {
Builder<String, Object> metaBuilder = new ImmutableMap.Builder<String, Object>().put(
"tenantId", tenantId);
"tenantId", tenantId).put("region", config.region);
if (crossTenantId != null)
metaBuilder.put("crossTenantId", crossTenantId);
ImmutableMap<String, Object> meta = metaBuilder.build();