github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/EventAPI.md (about)

     1  # Event API
     2  
     3  The Instana Go Event API is a simple method to report custom events into your dashboard.  These events can range from generic change events to more severe events tied to a specific host or service.
     4  
     5  Events are a versatile way to broaden the knowledge base that Instana has to continuously monitor, learn from and alert on your environment.
     6  
     7  # Example: A High Latency Service Event
     8  
     9  Suppose that we have a remote point of presence monitoring a specific public microservice (_games_) in Eastern Asia that is critical to our infrastructure for that local area.  When that monitor detects slow response times to its queries, it reports a custom high latency event to Instana.
    10  
    11  The following example shows how such Go code would send a _critical_ event on the service _games_.
    12  
    13  ```Go
    14  package main
    15  
    16  import (
    17  	"time"
    18  	"github.com/mier85/go-sensor"
    19  )
    20  
    21  func main() {
    22  	instana.InitSensor(&instana.Options{Service:  service})
    23  
    24  	go forever()
    25  	select {}
    26  }
    27  
    28  func forever() {
    29  	for {
    30  		instana.SendServiceEvent("games",
    31  			"Games High Latency", "Games - High latency from East Asia POP.",
    32  			instana.SeverityCritical, 1*time.Second)
    33  		time.Sleep(30 * time.Second)
    34  	}
    35  }
    36  ```
    37  
    38  The critical event is reported to the Instana _Service Quality Engine_, it is logged to the dashboard and directly affects the state of the _games_ service:
    39  
    40  ![games_service_event](https://disznc.s3.amazonaws.com/Instana-Event-API-Service-Event-games-2017-07-18.png)