diff --git a/observability.go b/observability.go new file mode 100644 index 0000000..0da65bd --- /dev/null +++ b/observability.go @@ -0,0 +1,13 @@ +package proton + +import ( + "context" + + "github.com/go-resty/resty/v2" +) + +func (c *Client) SendObservabilityBatch(ctx context.Context, req ObservabilityBatch) error { + return c.do(ctx, func(r *resty.Request) (*resty.Response, error) { + return r.SetHeader("Priority", "u=6").SetBody(req).Post("/data/v1/metrics") + }) +} diff --git a/observability_types.go b/observability_types.go new file mode 100644 index 0000000..7541bc3 --- /dev/null +++ b/observability_types.go @@ -0,0 +1,14 @@ +package proton + +import "time" + +type ObservabilityBatch struct { + Metrics []ObservabilityMetric `json:"Metrics"` +} + +type ObservabilityMetric struct { + Name string `json:"Name"` + Version int `json:"Version"` + Timestamp time.Time `json:"Timestamp"` + Data interface{} `json:"Data"` +}