From 7a0a31387d9a3c3f7cf6d74792052a9dad0e8d7b Mon Sep 17 00:00:00 2001 From: ElectroNafta Date: Thu, 22 Aug 2024 11:36:48 +0200 Subject: [PATCH] feat(BRIDGE-122): added observability request and types to GPA feat(BRIDGE-122): added priority --- observability.go | 13 +++++++++++++ observability_types.go | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 observability.go create mode 100644 observability_types.go 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"` +}