github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/example/event/default_service/default_service_event.go (about)

     1  // (c) Copyright IBM Corp. 2021
     2  // (c) Copyright Instana Inc. 2017
     3  
     4  package main
     5  
     6  import (
     7  	"time"
     8  
     9  	instana "github.com/mier85/go-sensor"
    10  )
    11  
    12  const (
    13  	service = "go-microservice-14c"
    14  )
    15  
    16  func main() {
    17  	instana.InitSensor(&instana.Options{
    18  		Service:  service,
    19  		LogLevel: instana.Debug})
    20  
    21  	go forever()
    22  	select {}
    23  }
    24  
    25  func forever() {
    26  	for {
    27  		instana.SendDefaultServiceEvent(
    28  			"Service Restart", "This service has been restarted with change e3b926d by @pglombardo",
    29  			instana.SeverityChange, 5*time.Second)
    30  		time.Sleep(30 * time.Second)
    31  	}
    32  }