increase reporting interval. (#96)
also fixed a bug in SD export registration in Ads.
This commit is contained in:
parent
424692befa
commit
d69f1a4f25
5 changed files with 19 additions and 7 deletions
|
@ -207,16 +207,24 @@ public class AdService {
|
|||
// Registers logging trace exporter.
|
||||
LoggingTraceExporter.register();
|
||||
long sleepTime = 10; /* seconds */
|
||||
int maxAttempts = 3;
|
||||
int maxAttempts = 5;
|
||||
boolean statsExporterRegistered = false;
|
||||
boolean traceExporterRegistered = false;
|
||||
|
||||
for (int i=0; i<maxAttempts; i++) {
|
||||
try {
|
||||
StackdriverTraceExporter.createAndRegister(
|
||||
StackdriverTraceConfiguration.builder().build());
|
||||
StackdriverStatsExporter.createAndRegister(
|
||||
StackdriverStatsConfiguration.builder()
|
||||
.setExportInterval(Duration.create(15, 0))
|
||||
.build());
|
||||
if (!traceExporterRegistered) {
|
||||
StackdriverTraceExporter.createAndRegister(
|
||||
StackdriverTraceConfiguration.builder().build());
|
||||
traceExporterRegistered = true;
|
||||
}
|
||||
if (!statsExporterRegistered) {
|
||||
StackdriverStatsExporter.createAndRegister(
|
||||
StackdriverStatsConfiguration.builder()
|
||||
.setExportInterval(Duration.create(60, 0))
|
||||
.build());
|
||||
statsExporterRegistered = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (i==(maxAttempts-1)) {
|
||||
logger.log(Level.WARN, "Failed to register Stackdriver Exporter." +
|
||||
|
|
|
@ -99,6 +99,7 @@ func main() {
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering default server views")
|
||||
|
|
|
@ -143,6 +143,7 @@ func main() {
|
|||
}
|
||||
|
||||
func initStats(log logrus.FieldLogger, exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ochttp.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering http default server views")
|
||||
|
|
|
@ -90,6 +90,7 @@ func run(port int) string {
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Info("Error registering default server views")
|
||||
|
|
|
@ -129,6 +129,7 @@ func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.Sh
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering default server views")
|
||||
|
|
Loading…
Reference in a new issue