From 56870465b79946d79a72570bbf691578e01749d8 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Fri, 24 May 2024 15:55:20 -0700 Subject: [PATCH] Decoupled API version and Schema version. Fixed Record datatype --- collector/internal/telemetryapi/client.go | 7 +++++-- collector/receiver/telemetryapireceiver/types.go | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/collector/internal/telemetryapi/client.go b/collector/internal/telemetryapi/client.go index db57573fc2..2eb9fd5e4e 100644 --- a/collector/internal/telemetryapi/client.go +++ b/collector/internal/telemetryapi/client.go @@ -27,8 +27,11 @@ import ( ) const ( + ApiVersion20220701 = "2022-07-01" + ApiVersionLatest = ApiVersion20220701 SchemaVersion20220701 = "2022-07-01" - SchemaVersionLatest = SchemaVersion20220701 + SchemaVersion20221213 = "2022-12-13" + SchemaVersionLatest = SchemaVersion20221213 lambdaAgentIdentifierHeaderKey = "Lambda-Extension-Identifier" ) @@ -42,7 +45,7 @@ func NewClient(logger *zap.Logger) *Client { return &Client{ logger: logger.Named("telemetryAPI.Client"), httpClient: &http.Client{}, - baseURL: fmt.Sprintf("http://%s/%s/telemetry", os.Getenv("AWS_LAMBDA_RUNTIME_API"), SchemaVersionLatest), + baseURL: fmt.Sprintf("http://%s/%s/telemetry", os.Getenv("AWS_LAMBDA_RUNTIME_API"), ApiVersionLatest), } } diff --git a/collector/receiver/telemetryapireceiver/types.go b/collector/receiver/telemetryapireceiver/types.go index 40bbc6ff94..fdcb4e3f28 100644 --- a/collector/receiver/telemetryapireceiver/types.go +++ b/collector/receiver/telemetryapireceiver/types.go @@ -15,7 +15,7 @@ package telemetryapireceiver // import "github.com/open-telemetry/opentelemetry-lambda/collector/receiver/telemetryapireceiver" type event struct { - Time string `json:"time"` - Type string `json:"type"` - Record map[string]any `json:"record"` + Time string `json:"time"` + Type string `json:"type"` + Record any `json:"record"` }