github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/example/event/service/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 = "games"
    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  		print("Sending event on service:", service)
    28  		instana.SendServiceEvent("games",
    29  			"Games High Latency", "Games - High latency from East Asia POP.",
    30  			instana.SeverityCritical, 1*time.Second)
    31  		time.Sleep(30 * time.Second)
    32  	}
    33  }