Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.3 KB

EventAPI.md

File metadata and controls

38 lines (27 loc) · 1.3 KB

Event API

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.

Events are a versatile way to broaden the knowledge base that Instana has to continuously monitor, learn from and alert on your environment.

Example: A High Latency Service Event

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.

The following example shows how such Go code would send a critical event on the service games.

package main

import (
	"time"
	"github.com/instana/go-sensor"
)

func main() {
	instana.InitSensor(&instana.Options{Service:  service})

	go forever()
	select {}
}

func forever() {
	for {
		instana.SendServiceEvent("games",
			"Games High Latency", "Games - High latency from East Asia POP.",
			instana.SeverityCritical, 1*time.Second)
		time.Sleep(30 * time.Second)
	}
}

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.