From ac92f69f5152a7cac143efc48f2532249ff17ae9 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Wed, 3 Apr 2019 16:05:43 +0900 Subject: [PATCH] Include stack trace when failed to send metrics to Stackdriver (#1269) Also add successful debug logging of how many time series sent. --- .../micrometer/stackdriver/StackdriverMeterRegistry.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/implementations/micrometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverMeterRegistry.java b/implementations/micrometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverMeterRegistry.java index a7303865a0..b874581023 100644 --- a/implementations/micrometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverMeterRegistry.java +++ b/implementations/micrometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverMeterRegistry.java @@ -171,12 +171,13 @@ protected void publish() { .build(); if (logger.isTraceEnabled()) { - logger.trace("publishing batch to stackdriver:\n{}", request); + logger.trace("publishing batch to Stackdriver:\n{}", request); } client.createTimeSeries(request); + logger.debug("successfully sent {} TimeSeries to Stackdriver", partition.size()); } catch (ApiException e) { - logger.warn("failed to send metrics to stackdriver: {}", e.getCause().getMessage()); + logger.warn("failed to send metrics to Stackdriver", e); } } } @@ -368,7 +369,7 @@ private void createMetricDescriptorIfNecessary(MetricServiceClient client, Meter client.createMetricDescriptor(request); verifiedDescriptors.add(id.getName()); } catch (ApiException e) { - logger.warn("failed to create metric descriptor in stackdriver for meter " + id + " {}", e.getCause().getMessage()); + logger.warn("failed to create metric descriptor in Stackdriver for meter " + id, e); } } }