From d53d9da6027b444911c4e6e1a32b8ce340627914 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 30 May 2024 15:55:09 -0700 Subject: [PATCH 01/35] Added refresh logic --- .../solarwindsapmsettingsextension/README.md | 2 +- .../extension.go | 140 +++++++++++++++++- 2 files changed, 139 insertions(+), 3 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/README.md b/extension/solarwindsapmsettingsextension/README.md index 0af3f00168b1..07630bf145ed 100644 --- a/extension/solarwindsapmsettingsextension/README.md +++ b/extension/solarwindsapmsettingsextension/README.md @@ -12,7 +12,7 @@ ## Overview -The Solarwinds APM Settings extension gets Solarwinds APM specific settings from Solarwinds APM collector and `/tmp/solarwinds-apm-settings.json` & `/tmp/solarwinds-apm-settings-raw` periodically. +The Solarwinds APM Settings extension gets Solarwinds APM specific settings from Solarwinds APM collector and `/tmp/solarwinds-apm-settings.json` periodically. ## Configuration diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 04bd1b75cc56..9d8e35ae56df 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -6,6 +6,11 @@ package solarwindsapmsettingsextension // import "github.com/open-telemetry/open import ( "context" "crypto/tls" + "encoding/binary" + "encoding/json" + "math" + "os" + "strconv" "time" "github.com/solarwindscloud/apm-proto/go/collectorpb" @@ -14,6 +19,12 @@ import ( "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/protobuf/encoding/protojson" +) + +const ( + JSONOutputFile = "/tmp/solarwinds-apm-settings.json" + GrpcContextDeadline = time.Duration(1) * time.Second ) type solarwindsapmSettingsExtension struct { @@ -76,6 +87,131 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err } func refresh(extension *solarwindsapmSettingsExtension) { - // Concrete implementation will be available in later PR - extension.logger.Info("refresh task") + extension.logger.Info("Time to refresh from " + extension.config.Endpoint) + if hostname, err := os.Hostname(); err != nil { + extension.logger.Error("Unable to call os.Hostname() " + err.Error()) + } else { + ctx, cancel := context.WithTimeout(context.Background(), GrpcContextDeadline) + defer cancel() + + request := &collectorpb.SettingsRequest{ + ApiKey: extension.config.Key, + Identity: &collectorpb.HostID{ + Hostname: hostname, + }, + ClientVersion: "2", + } + if response, err := extension.client.GetSettings(ctx, request); err != nil { + extension.logger.Error("Unable to getSettings from " + extension.config.Endpoint + " " + err.Error()) + } else { + switch result := response.GetResult(); result { + case collectorpb.ResultCode_OK: + if len(response.GetWarning()) > 0 { + extension.logger.Warn(response.GetWarning()) + } + var settings []map[string]any + for _, item := range response.GetSettings() { + marshalOptions := protojson.MarshalOptions{ + UseEnumNumbers: true, + EmitUnpopulated: true, + } + if settingBytes, err := marshalOptions.Marshal(item); err != nil { + extension.logger.Warn("Error to marshal setting JSON[] byte from response.GetSettings() " + err.Error()) + } else { + setting := make(map[string]any) + if err := json.Unmarshal(settingBytes, &setting); err != nil { + extension.logger.Warn("Error to unmarshal setting JSON object from setting JSON[]byte " + err.Error()) + } else { + if value, ok := setting["value"].(string); ok { + if num, err := strconv.ParseInt(value, 10, 0); err != nil { + extension.logger.Warn("Unable to parse value " + value + " as number " + err.Error()) + } else { + setting["value"] = num + } + } + if timestamp, ok := setting["timestamp"].(string); ok { + if num, err := strconv.ParseInt(timestamp, 10, 0); err != nil { + extension.logger.Warn("Unable to parse timestamp " + timestamp + " as number " + err.Error()) + } else { + setting["timestamp"] = num + } + } + if ttl, ok := setting["ttl"].(string); ok { + if num, err := strconv.ParseInt(ttl, 10, 0); err != nil { + extension.logger.Warn("Unable to parse ttl " + ttl + " as number " + err.Error()) + } else { + setting["ttl"] = num + } + } + if _, ok := setting["flags"]; ok { + setting["flags"] = string(item.Flags) + } + if arguments, ok := setting["arguments"].(map[string]any); ok { + if value, ok := item.Arguments["BucketCapacity"]; ok { + arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["BucketRate"]; ok { + arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { + arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { + arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { + arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { + arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["MetricsFlushInterval"]; ok { + arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxTransactions"]; ok { + arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxCustomMetrics"]; ok { + arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["EventsFlushInterval"]; ok { + arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["ProfilingInterval"]; ok { + arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + // Remove SignatureKey from collector response + delete(arguments, "SignatureKey") + } + settings = append(settings, setting) + } + } + } + if content, err := json.Marshal(settings); err != nil { + extension.logger.Warn("Error to marshal setting JSON[] byte from settings " + err.Error()) + } else { + if err := os.WriteFile(JSONOutputFile, content, 0600); err != nil { + extension.logger.Error("Unable to write " + JSONOutputFile + " " + err.Error()) + } else { + if len(response.GetWarning()) > 0 { + extension.logger.Warn(JSONOutputFile + " is refreshed (soft disabled)") + } else { + extension.logger.Info(JSONOutputFile + " is refreshed") + } + extension.logger.Info(string(content)) + } + } + case collectorpb.ResultCode_TRY_LATER: + extension.logger.Warn("GetSettings returned TRY_LATER " + response.GetWarning()) + case collectorpb.ResultCode_INVALID_API_KEY: + extension.logger.Warn("GetSettings returned INVALID_API_KEY " + response.GetWarning()) + case collectorpb.ResultCode_LIMIT_EXCEEDED: + extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED " + response.GetWarning()) + case collectorpb.ResultCode_REDIRECT: + extension.logger.Warn("GetSettings returned REDIRECT " + response.GetWarning()) + default: + extension.logger.Warn("Unknown ResultCode from GetSettings " + response.GetWarning()) + } + } + } } From f4258b1d624f5547bc4a5f18597bf0b3c46f0270 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 30 May 2024 16:10:47 -0700 Subject: [PATCH 02/35] Added changlog --- ..._solarwindsapmsettingsetension-impl-2.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .chloggen/feature_solarwindsapmsettingsetension-impl-2.yaml diff --git a/.chloggen/feature_solarwindsapmsettingsetension-impl-2.yaml b/.chloggen/feature_solarwindsapmsettingsetension-impl-2.yaml new file mode 100644 index 000000000000..f1fd9de27134 --- /dev/null +++ b/.chloggen/feature_solarwindsapmsettingsetension-impl-2.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: solarwindsapmsettingsextension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Added logic for refresh function + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [27668] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] From f4c6d03a46906c0acc95ddbdaf041c7a70454594 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 30 May 2024 16:34:17 -0700 Subject: [PATCH 03/35] make gotidy --- extension/solarwindsapmsettingsextension/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 446bc1fb44a2..09546e7b0434 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -13,6 +13,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/grpc v1.64.0 + google.golang.org/protobuf v1.34.1 ) require ( @@ -45,6 +46,5 @@ require ( golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect - google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) From 4674c760064ecafe5a847d41bcb1f9d0e46f5edb Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 3 Jun 2024 10:08:17 -0700 Subject: [PATCH 04/35] Update extension/solarwindsapmsettingsextension/extension.go Co-authored-by: Antoine Toulme --- extension/solarwindsapmsettingsextension/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 9d8e35ae56df..c05b9f87831c 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -24,7 +24,7 @@ import ( const ( JSONOutputFile = "/tmp/solarwinds-apm-settings.json" - GrpcContextDeadline = time.Duration(1) * time.Second + GrpcContextDeadline = 1 * time.Second ) type solarwindsapmSettingsExtension struct { From d1cba8223361beff7f94729309782929857ef73a Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 3 Jun 2024 10:08:35 -0700 Subject: [PATCH 05/35] Update extension/solarwindsapmsettingsextension/extension.go Co-authored-by: Antoine Toulme --- extension/solarwindsapmsettingsextension/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index c05b9f87831c..3dfa028e2588 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -102,7 +102,7 @@ func refresh(extension *solarwindsapmSettingsExtension) { ClientVersion: "2", } if response, err := extension.client.GetSettings(ctx, request); err != nil { - extension.logger.Error("Unable to getSettings from " + extension.config.Endpoint + " " + err.Error()) + extension.logger.Error("unable to get settings", zap.String("endpoint",extension.config.Endpoint), zap.Error(err)) } else { switch result := response.GetResult(); result { case collectorpb.ResultCode_OK: From a0688c58dd43073284a644dfaef205d2c19b4605 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 3 Jun 2024 11:03:00 -0700 Subject: [PATCH 06/35] Updated log messages --- .../extension.go | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 3dfa028e2588..b3789c18ea29 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -44,7 +44,7 @@ func newSolarwindsApmSettingsExtension(extensionCfg *Config, logger *zap.Logger) } func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ component.Host) error { - extension.logger.Info("Starting up solarwinds apm settings extension") + extension.logger.Info("starting up solarwinds apm settings extension") ctx := context.Background() ctx, extension.cancel = context.WithCancel(ctx) var err error @@ -52,7 +52,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp if err != nil { return err } - extension.logger.Info("Dailed to endpoint", zap.String("endpoint", extension.config.Endpoint)) + extension.logger.Info("dailed to endpoint", zap.String("endpoint", extension.config.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) // initial refresh @@ -66,7 +66,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp case <-ticker.C: refresh(extension) case <-ctx.Done(): - extension.logger.Info("Received ctx.Done() from ticker") + extension.logger.Info("received ctx.Done() from ticker") return } } @@ -76,7 +76,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp } func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) error { - extension.logger.Info("Shutting down solarwinds apm settings extension") + extension.logger.Info("shutting down solarwinds apm settings extension") if extension.cancel != nil { extension.cancel() } @@ -87,9 +87,9 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err } func refresh(extension *solarwindsapmSettingsExtension) { - extension.logger.Info("Time to refresh from " + extension.config.Endpoint) + extension.logger.Info("time to refresh", zap.String("endpoint", extension.config.Endpoint)) if hostname, err := os.Hostname(); err != nil { - extension.logger.Error("Unable to call os.Hostname() " + err.Error()) + extension.logger.Error("unable to call os.Hostname()", zap.Error(err)) } else { ctx, cancel := context.WithTimeout(context.Background(), GrpcContextDeadline) defer cancel() @@ -102,12 +102,12 @@ func refresh(extension *solarwindsapmSettingsExtension) { ClientVersion: "2", } if response, err := extension.client.GetSettings(ctx, request); err != nil { - extension.logger.Error("unable to get settings", zap.String("endpoint",extension.config.Endpoint), zap.Error(err)) + extension.logger.Error("unable to get settings", zap.String("endpoint", extension.config.Endpoint), zap.Error(err)) } else { switch result := response.GetResult(); result { case collectorpb.ResultCode_OK: if len(response.GetWarning()) > 0 { - extension.logger.Warn(response.GetWarning()) + extension.logger.Warn("GetSettings returned OK", zap.String("warning", response.GetWarning())) } var settings []map[string]any for _, item := range response.GetSettings() { @@ -116,29 +116,29 @@ func refresh(extension *solarwindsapmSettingsExtension) { EmitUnpopulated: true, } if settingBytes, err := marshalOptions.Marshal(item); err != nil { - extension.logger.Warn("Error to marshal setting JSON[] byte from response.GetSettings() " + err.Error()) + extension.logger.Warn("error to marshal setting JSON[] byte from response.GetSettings()", zap.Error(err)) } else { setting := make(map[string]any) if err := json.Unmarshal(settingBytes, &setting); err != nil { - extension.logger.Warn("Error to unmarshal setting JSON object from setting JSON[]byte " + err.Error()) + extension.logger.Warn("error to unmarshal setting JSON object from setting JSON[]byte", zap.Error(err)) } else { if value, ok := setting["value"].(string); ok { if num, err := strconv.ParseInt(value, 10, 0); err != nil { - extension.logger.Warn("Unable to parse value " + value + " as number " + err.Error()) + extension.logger.Warn("unable to parse value "+value+" as number", zap.Error(err)) } else { setting["value"] = num } } if timestamp, ok := setting["timestamp"].(string); ok { if num, err := strconv.ParseInt(timestamp, 10, 0); err != nil { - extension.logger.Warn("Unable to parse timestamp " + timestamp + " as number " + err.Error()) + extension.logger.Warn("unable to parse timestamp "+timestamp+" as number", zap.Error(err)) } else { setting["timestamp"] = num } } if ttl, ok := setting["ttl"].(string); ok { if num, err := strconv.ParseInt(ttl, 10, 0); err != nil { - extension.logger.Warn("Unable to parse ttl " + ttl + " as number " + err.Error()) + extension.logger.Warn("unable to parse ttl "+ttl+" as number", zap.Error(err)) } else { setting["ttl"] = num } @@ -188,10 +188,10 @@ func refresh(extension *solarwindsapmSettingsExtension) { } } if content, err := json.Marshal(settings); err != nil { - extension.logger.Warn("Error to marshal setting JSON[] byte from settings " + err.Error()) + extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) } else { if err := os.WriteFile(JSONOutputFile, content, 0600); err != nil { - extension.logger.Error("Unable to write " + JSONOutputFile + " " + err.Error()) + extension.logger.Error("unable to write "+JSONOutputFile, zap.Error(err)) } else { if len(response.GetWarning()) > 0 { extension.logger.Warn(JSONOutputFile + " is refreshed (soft disabled)") @@ -202,15 +202,15 @@ func refresh(extension *solarwindsapmSettingsExtension) { } } case collectorpb.ResultCode_TRY_LATER: - extension.logger.Warn("GetSettings returned TRY_LATER " + response.GetWarning()) + extension.logger.Warn("GetSettings returned TRY_LATER", zap.String("warning", response.GetWarning())) case collectorpb.ResultCode_INVALID_API_KEY: - extension.logger.Warn("GetSettings returned INVALID_API_KEY " + response.GetWarning()) + extension.logger.Warn("GetSettings returned INVALID_API_KEY", zap.String("warning", response.GetWarning())) case collectorpb.ResultCode_LIMIT_EXCEEDED: - extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED " + response.GetWarning()) + extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED", zap.String("warning", response.GetWarning())) case collectorpb.ResultCode_REDIRECT: - extension.logger.Warn("GetSettings returned REDIRECT " + response.GetWarning()) + extension.logger.Warn("GetSettings returned REDIRECT", zap.String("warning", response.GetWarning())) default: - extension.logger.Warn("Unknown ResultCode from GetSettings " + response.GetWarning()) + extension.logger.Warn("unknown ResultCode from GetSettings", zap.String("warning", response.GetWarning())) } } } From 07212ee515f5eaa46cef1723c47e30f77672be8f Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 3 Jun 2024 11:05:36 -0700 Subject: [PATCH 07/35] Fixed export --- .../solarwindsapmsettingsextension/extension.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index b3789c18ea29..0f493be8962d 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -23,8 +23,8 @@ import ( ) const ( - JSONOutputFile = "/tmp/solarwinds-apm-settings.json" - GrpcContextDeadline = 1 * time.Second + jsonOutputFile = "/tmp/solarwinds-apm-settings.json" + grpcContextDeadline = 1 * time.Second ) type solarwindsapmSettingsExtension struct { @@ -91,7 +91,7 @@ func refresh(extension *solarwindsapmSettingsExtension) { if hostname, err := os.Hostname(); err != nil { extension.logger.Error("unable to call os.Hostname()", zap.Error(err)) } else { - ctx, cancel := context.WithTimeout(context.Background(), GrpcContextDeadline) + ctx, cancel := context.WithTimeout(context.Background(), grpcContextDeadline) defer cancel() request := &collectorpb.SettingsRequest{ @@ -190,13 +190,13 @@ func refresh(extension *solarwindsapmSettingsExtension) { if content, err := json.Marshal(settings); err != nil { extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) } else { - if err := os.WriteFile(JSONOutputFile, content, 0600); err != nil { - extension.logger.Error("unable to write "+JSONOutputFile, zap.Error(err)) + if err := os.WriteFile(jsonOutputFile, content, 0600); err != nil { + extension.logger.Error("unable to write "+jsonOutputFile, zap.Error(err)) } else { if len(response.GetWarning()) > 0 { - extension.logger.Warn(JSONOutputFile + " is refreshed (soft disabled)") + extension.logger.Warn(jsonOutputFile + " is refreshed (soft disabled)") } else { - extension.logger.Info(JSONOutputFile + " is refreshed") + extension.logger.Info(jsonOutputFile + " is refreshed") } extension.logger.Info(string(content)) } From 08dc77b749b9647b8925278897e16a9ac9e838ba Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 3 Jun 2024 11:12:43 -0700 Subject: [PATCH 08/35] Removed gigantic else clause --- .../extension.go | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 0f493be8962d..069a9983ae73 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -101,117 +101,118 @@ func refresh(extension *solarwindsapmSettingsExtension) { }, ClientVersion: "2", } - if response, err := extension.client.GetSettings(ctx, request); err != nil { + response, err := extension.client.GetSettings(ctx, request) + if err != nil { extension.logger.Error("unable to get settings", zap.String("endpoint", extension.config.Endpoint), zap.Error(err)) - } else { - switch result := response.GetResult(); result { - case collectorpb.ResultCode_OK: - if len(response.GetWarning()) > 0 { - extension.logger.Warn("GetSettings returned OK", zap.String("warning", response.GetWarning())) + return + } + switch result := response.GetResult(); result { + case collectorpb.ResultCode_OK: + if len(response.GetWarning()) > 0 { + extension.logger.Warn("GetSettings returned OK", zap.String("warning", response.GetWarning())) + } + var settings []map[string]any + for _, item := range response.GetSettings() { + marshalOptions := protojson.MarshalOptions{ + UseEnumNumbers: true, + EmitUnpopulated: true, } - var settings []map[string]any - for _, item := range response.GetSettings() { - marshalOptions := protojson.MarshalOptions{ - UseEnumNumbers: true, - EmitUnpopulated: true, - } - if settingBytes, err := marshalOptions.Marshal(item); err != nil { - extension.logger.Warn("error to marshal setting JSON[] byte from response.GetSettings()", zap.Error(err)) + if settingBytes, err := marshalOptions.Marshal(item); err != nil { + extension.logger.Warn("error to marshal setting JSON[] byte from response.GetSettings()", zap.Error(err)) + } else { + setting := make(map[string]any) + if err := json.Unmarshal(settingBytes, &setting); err != nil { + extension.logger.Warn("error to unmarshal setting JSON object from setting JSON[]byte", zap.Error(err)) } else { - setting := make(map[string]any) - if err := json.Unmarshal(settingBytes, &setting); err != nil { - extension.logger.Warn("error to unmarshal setting JSON object from setting JSON[]byte", zap.Error(err)) - } else { - if value, ok := setting["value"].(string); ok { - if num, err := strconv.ParseInt(value, 10, 0); err != nil { - extension.logger.Warn("unable to parse value "+value+" as number", zap.Error(err)) - } else { - setting["value"] = num - } + if value, ok := setting["value"].(string); ok { + if num, err := strconv.ParseInt(value, 10, 0); err != nil { + extension.logger.Warn("unable to parse value "+value+" as number", zap.Error(err)) + } else { + setting["value"] = num + } + } + if timestamp, ok := setting["timestamp"].(string); ok { + if num, err := strconv.ParseInt(timestamp, 10, 0); err != nil { + extension.logger.Warn("unable to parse timestamp "+timestamp+" as number", zap.Error(err)) + } else { + setting["timestamp"] = num + } + } + if ttl, ok := setting["ttl"].(string); ok { + if num, err := strconv.ParseInt(ttl, 10, 0); err != nil { + extension.logger.Warn("unable to parse ttl "+ttl+" as number", zap.Error(err)) + } else { + setting["ttl"] = num } - if timestamp, ok := setting["timestamp"].(string); ok { - if num, err := strconv.ParseInt(timestamp, 10, 0); err != nil { - extension.logger.Warn("unable to parse timestamp "+timestamp+" as number", zap.Error(err)) - } else { - setting["timestamp"] = num - } + } + if _, ok := setting["flags"]; ok { + setting["flags"] = string(item.Flags) + } + if arguments, ok := setting["arguments"].(map[string]any); ok { + if value, ok := item.Arguments["BucketCapacity"]; ok { + arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - if ttl, ok := setting["ttl"].(string); ok { - if num, err := strconv.ParseInt(ttl, 10, 0); err != nil { - extension.logger.Warn("unable to parse ttl "+ttl+" as number", zap.Error(err)) - } else { - setting["ttl"] = num - } + if value, ok := item.Arguments["BucketRate"]; ok { + arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - if _, ok := setting["flags"]; ok { - setting["flags"] = string(item.Flags) + if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { + arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - if arguments, ok := setting["arguments"].(map[string]any); ok { - if value, ok := item.Arguments["BucketCapacity"]; ok { - arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["BucketRate"]; ok { - arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { - arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { - arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { - arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { - arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["MetricsFlushInterval"]; ok { - arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxTransactions"]; ok { - arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxCustomMetrics"]; ok { - arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["EventsFlushInterval"]; ok { - arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["ProfilingInterval"]; ok { - arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - // Remove SignatureKey from collector response - delete(arguments, "SignatureKey") + if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { + arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - settings = append(settings, setting) + if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { + arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { + arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["MetricsFlushInterval"]; ok { + arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxTransactions"]; ok { + arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxCustomMetrics"]; ok { + arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["EventsFlushInterval"]; ok { + arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["ProfilingInterval"]; ok { + arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + // Remove SignatureKey from collector response + delete(arguments, "SignatureKey") } + settings = append(settings, setting) } } - if content, err := json.Marshal(settings); err != nil { - extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) + } + if content, err := json.Marshal(settings); err != nil { + extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) + } else { + if err := os.WriteFile(jsonOutputFile, content, 0600); err != nil { + extension.logger.Error("unable to write "+jsonOutputFile, zap.Error(err)) } else { - if err := os.WriteFile(jsonOutputFile, content, 0600); err != nil { - extension.logger.Error("unable to write "+jsonOutputFile, zap.Error(err)) + if len(response.GetWarning()) > 0 { + extension.logger.Warn(jsonOutputFile + " is refreshed (soft disabled)") } else { - if len(response.GetWarning()) > 0 { - extension.logger.Warn(jsonOutputFile + " is refreshed (soft disabled)") - } else { - extension.logger.Info(jsonOutputFile + " is refreshed") - } - extension.logger.Info(string(content)) + extension.logger.Info(jsonOutputFile + " is refreshed") } + extension.logger.Info(string(content)) } - case collectorpb.ResultCode_TRY_LATER: - extension.logger.Warn("GetSettings returned TRY_LATER", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_INVALID_API_KEY: - extension.logger.Warn("GetSettings returned INVALID_API_KEY", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_LIMIT_EXCEEDED: - extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_REDIRECT: - extension.logger.Warn("GetSettings returned REDIRECT", zap.String("warning", response.GetWarning())) - default: - extension.logger.Warn("unknown ResultCode from GetSettings", zap.String("warning", response.GetWarning())) } + case collectorpb.ResultCode_TRY_LATER: + extension.logger.Warn("GetSettings returned TRY_LATER", zap.String("warning", response.GetWarning())) + case collectorpb.ResultCode_INVALID_API_KEY: + extension.logger.Warn("GetSettings returned INVALID_API_KEY", zap.String("warning", response.GetWarning())) + case collectorpb.ResultCode_LIMIT_EXCEEDED: + extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED", zap.String("warning", response.GetWarning())) + case collectorpb.ResultCode_REDIRECT: + extension.logger.Warn("GetSettings returned REDIRECT", zap.String("warning", response.GetWarning())) + default: + extension.logger.Warn("unknown ResultCode from GetSettings", zap.String("warning", response.GetWarning())) } } } From baa26f9ef7d9d370a3a4dbf78ebefb1ff3746cf8 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 14:15:41 -0700 Subject: [PATCH 09/35] Added test case for refresh function --- .../extension.go | 28 +-- .../extension_test.go | 190 ++++++++++++++++++ .../solarwindsapmsettingsextension/go.mod | 5 +- .../solarwindsapmsettingsextension/go.sum | 10 +- 4 files changed, 209 insertions(+), 24 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 069a9983ae73..79a216c9830c 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -13,7 +13,7 @@ import ( "strconv" "time" - "github.com/solarwindscloud/apm-proto/go/collectorpb" + "github.com/solarwinds/apm-proto/go/collectorpb" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/extension" "go.uber.org/zap" @@ -56,7 +56,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp extension.client = collectorpb.NewTraceCollectorClient(extension.conn) // initial refresh - refresh(extension) + refresh(extension, jsonOutputFile) go func() { ticker := time.NewTicker(extension.config.Interval) @@ -64,7 +64,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp for { select { case <-ticker.C: - refresh(extension) + refresh(extension, jsonOutputFile) case <-ctx.Done(): extension.logger.Info("received ctx.Done() from ticker") return @@ -86,7 +86,7 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err return nil } -func refresh(extension *solarwindsapmSettingsExtension) { +func refresh(extension *solarwindsapmSettingsExtension, filename string) { extension.logger.Info("time to refresh", zap.String("endpoint", extension.config.Endpoint)) if hostname, err := os.Hostname(); err != nil { extension.logger.Error("unable to call os.Hostname()", zap.Error(err)) @@ -109,7 +109,7 @@ func refresh(extension *solarwindsapmSettingsExtension) { switch result := response.GetResult(); result { case collectorpb.ResultCode_OK: if len(response.GetWarning()) > 0 { - extension.logger.Warn("GetSettings returned OK", zap.String("warning", response.GetWarning())) + extension.logger.Warn("GetSettings succeed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } var settings []map[string]any for _, item := range response.GetSettings() { @@ -192,27 +192,19 @@ func refresh(extension *solarwindsapmSettingsExtension) { if content, err := json.Marshal(settings); err != nil { extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) } else { - if err := os.WriteFile(jsonOutputFile, content, 0600); err != nil { - extension.logger.Error("unable to write "+jsonOutputFile, zap.Error(err)) + if err := os.WriteFile(filename, content, 0600); err != nil { + extension.logger.Error("unable to write "+filename, zap.Error(err)) } else { if len(response.GetWarning()) > 0 { - extension.logger.Warn(jsonOutputFile + " is refreshed (soft disabled)") + extension.logger.Warn(filename + " is refreshed (soft disabled)") } else { - extension.logger.Info(jsonOutputFile + " is refreshed") + extension.logger.Info(filename + " is refreshed") } extension.logger.Info(string(content)) } } - case collectorpb.ResultCode_TRY_LATER: - extension.logger.Warn("GetSettings returned TRY_LATER", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_INVALID_API_KEY: - extension.logger.Warn("GetSettings returned INVALID_API_KEY", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_LIMIT_EXCEEDED: - extension.logger.Warn("GetSettings returned LIMIT_EXCEEDED", zap.String("warning", response.GetWarning())) - case collectorpb.ResultCode_REDIRECT: - extension.logger.Warn("GetSettings returned REDIRECT", zap.String("warning", response.GetWarning())) default: - extension.logger.Warn("unknown ResultCode from GetSettings", zap.String("warning", response.GetWarning())) + extension.logger.Warn("GetSettings failed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } } } diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index 743f9b89eca7..67146fe870d8 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -5,12 +5,17 @@ package solarwindsapmsettingsextension import ( "context" + "os" "testing" "time" + "github.com/solarwinds/apm-proto/go/collectorpb" + "github.com/solarwinds/apm-proto/go/collectorpb/mocks" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/extension" "go.uber.org/zap" + "go.uber.org/zap/zaptest/observer" ) func TestCreateExtension(t *testing.T) { @@ -53,3 +58,188 @@ func createAnExtension(c *Config, t *testing.T) extension.Extension { require.NoError(t, ex.Start(context.TODO(), nil)) return ex } + +func TestRefresh(t *testing.T) { + t.Parallel() + tests := []struct { + name string + cfg *Config + reply *collectorpb.SettingsResult + filename string + expectedLogMessages []string + fileExist bool + }{ + { + name: "ok without warning", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_OK, + Settings: []*collectorpb.OboeSetting{ + &collectorpb.OboeSetting{ + Type: collectorpb.OboeSettingType_DEFAULT_SAMPLE_RATE, + Flags: []byte("flags"), + Timestamp: 0, + Value: 0, + Layer: []byte{}, + Arguments: map[string][]byte{ + "BucketCapacity": []byte{1, 0, 0, 0, 0, 0, 0, 64}, + "BucketRate": []byte{2, 0, 0, 0, 0, 0, 240, 63}, + "TriggerRelaxedBucketCapacity": []byte{3, 0, 0, 0, 0, 0, 52, 64}, + "TriggerRelaxedBucketRate": []byte{4, 0, 0, 0, 0, 0, 240, 63}, + "TriggerStrictBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 24, 64}, + "TriggerStrictBucketRate": []byte{154, 153, 153, 153, 153, 153, 185, 63}, + "MetricsFlushInterval": []byte{60, 0, 0, 0}, + "MaxTransactions": []byte{1, 0, 0, 0}, + "MaxCustomMetrics": []byte{2, 0, 0, 0}, + "EventsFlushInterval": []byte{3, 0, 0, 0}, + "ProfilingInterval": []byte{4, 0, 0, 0}, + "SignatureKey": []byte("key"), + }, + Ttl: 12, + }, + }, + }, + filename: "testdata/refresh_ok.json", + expectedLogMessages: []string{ + "time to refresh", + "testdata/refresh_ok.json is refreshed", + "[{\"arguments\":{\"BucketCapacity\":2.0000000000000004,\"BucketRate\":1.0000000000000004,\"EventsFlushInterval\":3,\"MaxCustomMetrics\":2,\"MaxTransactions\":1,\"MetricsFlushInterval\":60,\"ProfilingInterval\":4,\"TriggerRelaxedBucketCapacity\":20.00000000000001,\"TriggerRelaxedBucketRate\":1.0000000000000009,\"TriggerStrictBucketCapacity\":6,\"TriggerStrictBucketRate\":0.1},\"flags\":\"flags\",\"layer\":\"\",\"timestamp\":0,\"ttl\":12,\"type\":0,\"value\":0}]", + }, + fileExist: true, + }, + { + name: "ok with warning", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_OK, + Settings: []*collectorpb.OboeSetting{ + &collectorpb.OboeSetting{ + Type: collectorpb.OboeSettingType_DEFAULT_SAMPLE_RATE, + Flags: []byte("flags"), + Timestamp: 0, + Value: 0, + Layer: []byte{}, + Arguments: map[string][]byte{ + "BucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, + "BucketRate": []byte{2, 0, 0, 0, 0, 0, 0, 0}, + "TriggerRelaxedBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerRelaxedBucketRate": []byte{0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerStrictBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerStrictBucketRate": []byte{0, 0, 0, 0, 0, 0, 0, 0}, + "MetricsFlushInterval": []byte{0, 0, 0, 0}, + "MaxTransactions": []byte{0, 0, 0, 0}, + "MaxCustomMetrics": []byte{0, 0, 0, 0}, + "EventsFlushInterval": []byte{0, 0, 0, 0}, + "ProfilingInterval": []byte{0, 0, 0, 0}, + "SignatureKey": []byte(""), + }, + Ttl: 10, + }, + }, + Warning: "warning", + }, + filename: "testdata/refresh_warning.json", + expectedLogMessages: []string{ + "time to refresh", + "GetSettings succeed", + "testdata/refresh_warning.json is refreshed (soft disabled)", + "[{\"arguments\":{\"BucketCapacity\":0,\"BucketRate\":1e-323,\"EventsFlushInterval\":0,\"MaxCustomMetrics\":0,\"MaxTransactions\":0,\"MetricsFlushInterval\":0,\"ProfilingInterval\":0,\"TriggerRelaxedBucketCapacity\":0,\"TriggerRelaxedBucketRate\":0,\"TriggerStrictBucketCapacity\":0,\"TriggerStrictBucketRate\":0},\"flags\":\"flags\",\"layer\":\"\",\"timestamp\":0,\"ttl\":10,\"type\":0,\"value\":0}]", + }, + fileExist: true, + }, + { + name: "try later", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_TRY_LATER, + Warning: "warning", + }, + filename: "testdata/refresh_later.json", + expectedLogMessages: []string{ + "time to refresh", + "GetSettings failed", + }, + fileExist: false, + }, + { + name: "invalid api key", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_INVALID_API_KEY, + Warning: "warning", + }, + filename: "testdata/refresh_invalid_api_key.json", + expectedLogMessages: []string{ + "time to refresh", + "GetSettings failed", + }, + fileExist: false, + }, + { + name: "limit exceeded", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_LIMIT_EXCEEDED, + Warning: "warning", + }, + filename: "testdata/refresh_limit.json", + expectedLogMessages: []string{ + "time to refresh", + "GetSettings failed", + }, + fileExist: false, + }, + { + name: "redirect", + cfg: &Config{ + Endpoint: DefaultEndpoint, + }, + reply: &collectorpb.SettingsResult{ + Result: collectorpb.ResultCode_REDIRECT, + Warning: "warning", + }, + filename: "testdata/refresh_redirect.json", + expectedLogMessages: []string{ + "time to refresh", + "GetSettings failed", + }, + fileExist: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + mockTraceCollectorClient := &mocks.TraceCollectorClient{} + mockTraceCollectorClient.On("GetSettings", mock.Anything, mock.Anything).Return(tt.reply, nil) + observedZapCore, observedLogs := observer.New(zap.InfoLevel) + logger := zap.New(observedZapCore) + + settingsExtension := &solarwindsapmSettingsExtension{ + config: tt.cfg, + logger: logger, + client: mockTraceCollectorClient, + } + refresh(settingsExtension, tt.filename) + require.Equal(t, len(tt.expectedLogMessages), observedLogs.Len()) + for index, observedLog := range observedLogs.All() { + require.Equal(t, tt.expectedLogMessages[index], observedLog.Message) + } + _, err := os.Stat(tt.filename) + if tt.fileExist { + require.NoError(t, err) + require.NoError(t, os.Remove(tt.filename)) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 09546e7b0434..c55bed0f125f 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/solar go 1.21.0 require ( - github.com/solarwindscloud/apm-proto v1.0.3 + github.com/solarwinds/apm-proto v1.0.5 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.101.1-0.20240529223953-eaab76e46d38 go.opentelemetry.io/collector/confmap v0.101.1-0.20240529223953-eaab76e46d38 @@ -13,7 +13,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 ) require ( @@ -35,6 +35,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.53.0 // indirect github.com/prometheus/procfs v0.15.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.101.1-0.20240529223953-eaab76e46d38 // indirect go.opentelemetry.io/collector/pdata v1.8.1-0.20240529223953-eaab76e46d38 // indirect go.opentelemetry.io/otel v1.27.0 // indirect diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index 50b10cfb658e..03436337482c 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -45,8 +45,10 @@ github.com/prometheus/procfs v0.15.0 h1:A82kmvXJq2jTu5YUhSGNlYoxh85zLnKgPz4bMZgI github.com/prometheus/procfs v0.15.0/go.mod h1:Y0RJ/Y5g5wJpkTisOtqwDSo4HwhGmLB4VQSw2sQJLHk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/solarwindscloud/apm-proto v1.0.3 h1:fmPwWNrM5kduAqvmH8mCD0E9MASK8m/mtPmw0yXGOBs= -github.com/solarwindscloud/apm-proto v1.0.3/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/solarwinds/apm-proto v1.0.5 h1:HH1bozLsH+j1Nqn/MKb+h3aNEmrI8OcCWZJFbVEvjr8= +github.com/solarwinds/apm-proto v1.0.5/go.mod h1:CN4fCYBnxyOJlBV0CYNXLz6lzNH8SCfNqcCBbpai76c= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -114,8 +116,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From 0084eace9cbb8a282fc0064fd92e6bcc669983c9 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 14:38:52 -0700 Subject: [PATCH 10/35] nits --- extension/solarwindsapmsettingsextension/extension_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index 67146fe870d8..dc8bb1db8f81 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -70,7 +70,7 @@ func TestRefresh(t *testing.T) { fileExist bool }{ { - name: "ok without warning", + name: "ok", cfg: &Config{ Endpoint: DefaultEndpoint, }, From 465c37688ffb73b54c68fdc59d017f8856021b0e Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 14:44:27 -0700 Subject: [PATCH 11/35] Fixed linter error --- .../extension_test.go | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index dc8bb1db8f81..cd62d9dbdbab 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -77,24 +77,24 @@ func TestRefresh(t *testing.T) { reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_OK, Settings: []*collectorpb.OboeSetting{ - &collectorpb.OboeSetting{ + { Type: collectorpb.OboeSettingType_DEFAULT_SAMPLE_RATE, Flags: []byte("flags"), Timestamp: 0, Value: 0, Layer: []byte{}, Arguments: map[string][]byte{ - "BucketCapacity": []byte{1, 0, 0, 0, 0, 0, 0, 64}, - "BucketRate": []byte{2, 0, 0, 0, 0, 0, 240, 63}, - "TriggerRelaxedBucketCapacity": []byte{3, 0, 0, 0, 0, 0, 52, 64}, - "TriggerRelaxedBucketRate": []byte{4, 0, 0, 0, 0, 0, 240, 63}, - "TriggerStrictBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 24, 64}, - "TriggerStrictBucketRate": []byte{154, 153, 153, 153, 153, 153, 185, 63}, - "MetricsFlushInterval": []byte{60, 0, 0, 0}, - "MaxTransactions": []byte{1, 0, 0, 0}, - "MaxCustomMetrics": []byte{2, 0, 0, 0}, - "EventsFlushInterval": []byte{3, 0, 0, 0}, - "ProfilingInterval": []byte{4, 0, 0, 0}, + "BucketCapacity": {1, 0, 0, 0, 0, 0, 0, 64}, + "BucketRate": {2, 0, 0, 0, 0, 0, 240, 63}, + "TriggerRelaxedBucketCapacity": {3, 0, 0, 0, 0, 0, 52, 64}, + "TriggerRelaxedBucketRate": {4, 0, 0, 0, 0, 0, 240, 63}, + "TriggerStrictBucketCapacity": {0, 0, 0, 0, 0, 0, 24, 64}, + "TriggerStrictBucketRate": {154, 153, 153, 153, 153, 153, 185, 63}, + "MetricsFlushInterval": {60, 0, 0, 0}, + "MaxTransactions": {1, 0, 0, 0}, + "MaxCustomMetrics": {2, 0, 0, 0}, + "EventsFlushInterval": {3, 0, 0, 0}, + "ProfilingInterval": {4, 0, 0, 0}, "SignatureKey": []byte("key"), }, Ttl: 12, @@ -117,24 +117,24 @@ func TestRefresh(t *testing.T) { reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_OK, Settings: []*collectorpb.OboeSetting{ - &collectorpb.OboeSetting{ + { Type: collectorpb.OboeSettingType_DEFAULT_SAMPLE_RATE, Flags: []byte("flags"), Timestamp: 0, Value: 0, Layer: []byte{}, Arguments: map[string][]byte{ - "BucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, - "BucketRate": []byte{2, 0, 0, 0, 0, 0, 0, 0}, - "TriggerRelaxedBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, - "TriggerRelaxedBucketRate": []byte{0, 0, 0, 0, 0, 0, 0, 0}, - "TriggerStrictBucketCapacity": []byte{0, 0, 0, 0, 0, 0, 0, 0}, - "TriggerStrictBucketRate": []byte{0, 0, 0, 0, 0, 0, 0, 0}, - "MetricsFlushInterval": []byte{0, 0, 0, 0}, - "MaxTransactions": []byte{0, 0, 0, 0}, - "MaxCustomMetrics": []byte{0, 0, 0, 0}, - "EventsFlushInterval": []byte{0, 0, 0, 0}, - "ProfilingInterval": []byte{0, 0, 0, 0}, + "BucketCapacity": {0, 0, 0, 0, 0, 0, 0, 0}, + "BucketRate": {2, 0, 0, 0, 0, 0, 0, 0}, + "TriggerRelaxedBucketCapacity": {0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerRelaxedBucketRate": {0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerStrictBucketCapacity": {0, 0, 0, 0, 0, 0, 0, 0}, + "TriggerStrictBucketRate": {0, 0, 0, 0, 0, 0, 0, 0}, + "MetricsFlushInterval": {0, 0, 0, 0}, + "MaxTransactions": {0, 0, 0, 0}, + "MaxCustomMetrics": {0, 0, 0, 0}, + "EventsFlushInterval": {0, 0, 0, 0}, + "ProfilingInterval": {0, 0, 0, 0}, "SignatureKey": []byte(""), }, Ttl: 10, From 0120d04d34e90c2a1f55a5e132d6af5013726e76 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 15:30:10 -0700 Subject: [PATCH 12/35] Simplified implementation --- .../extension.go | 116 +++++++----------- .../extension_test.go | 12 +- .../solarwindsapmsettingsextension/go.mod | 2 +- 3 files changed, 48 insertions(+), 82 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 79a216c9830c..5c277aeed320 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -10,7 +10,6 @@ import ( "encoding/json" "math" "os" - "strconv" "time" "github.com/solarwinds/apm-proto/go/collectorpb" @@ -19,7 +18,6 @@ import ( "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - "google.golang.org/protobuf/encoding/protojson" ) const ( @@ -113,81 +111,49 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { } var settings []map[string]any for _, item := range response.GetSettings() { - marshalOptions := protojson.MarshalOptions{ - UseEnumNumbers: true, - EmitUnpopulated: true, + setting := make(map[string]any) + setting["type"] = item.GetType().Number() + setting["flags"] = string(item.GetFlags()) + setting["timestamp"] = item.GetTimestamp() + setting["value"] = item.GetValue() + setting["layer"] = string(item.GetLayer()) + arguments := make(map[string]any) + if value, ok := item.Arguments["BucketCapacity"]; ok { + arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - if settingBytes, err := marshalOptions.Marshal(item); err != nil { - extension.logger.Warn("error to marshal setting JSON[] byte from response.GetSettings()", zap.Error(err)) - } else { - setting := make(map[string]any) - if err := json.Unmarshal(settingBytes, &setting); err != nil { - extension.logger.Warn("error to unmarshal setting JSON object from setting JSON[]byte", zap.Error(err)) - } else { - if value, ok := setting["value"].(string); ok { - if num, err := strconv.ParseInt(value, 10, 0); err != nil { - extension.logger.Warn("unable to parse value "+value+" as number", zap.Error(err)) - } else { - setting["value"] = num - } - } - if timestamp, ok := setting["timestamp"].(string); ok { - if num, err := strconv.ParseInt(timestamp, 10, 0); err != nil { - extension.logger.Warn("unable to parse timestamp "+timestamp+" as number", zap.Error(err)) - } else { - setting["timestamp"] = num - } - } - if ttl, ok := setting["ttl"].(string); ok { - if num, err := strconv.ParseInt(ttl, 10, 0); err != nil { - extension.logger.Warn("unable to parse ttl "+ttl+" as number", zap.Error(err)) - } else { - setting["ttl"] = num - } - } - if _, ok := setting["flags"]; ok { - setting["flags"] = string(item.Flags) - } - if arguments, ok := setting["arguments"].(map[string]any); ok { - if value, ok := item.Arguments["BucketCapacity"]; ok { - arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["BucketRate"]; ok { - arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { - arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { - arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { - arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { - arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["MetricsFlushInterval"]; ok { - arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxTransactions"]; ok { - arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxCustomMetrics"]; ok { - arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["EventsFlushInterval"]; ok { - arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["ProfilingInterval"]; ok { - arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - // Remove SignatureKey from collector response - delete(arguments, "SignatureKey") - } - settings = append(settings, setting) - } + if value, ok := item.Arguments["BucketRate"]; ok { + arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { + arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { + arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { + arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { + arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["MetricsFlushInterval"]; ok { + arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxTransactions"]; ok { + arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxCustomMetrics"]; ok { + arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["EventsFlushInterval"]; ok { + arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["ProfilingInterval"]; ok { + arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) } + setting["arguments"] = arguments + setting["ttl"] = item.GetTtl() + settings = append(settings, setting) } if content, err := json.Marshal(settings); err != nil { extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index cd62d9dbdbab..8fe89ff19c16 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -79,10 +79,10 @@ func TestRefresh(t *testing.T) { Settings: []*collectorpb.OboeSetting{ { Type: collectorpb.OboeSettingType_DEFAULT_SAMPLE_RATE, - Flags: []byte("flags"), - Timestamp: 0, - Value: 0, - Layer: []byte{}, + Flags: []byte("flag1,flag2,flag3"), + Timestamp: 123, + Value: 456, + Layer: []byte("layer1"), Arguments: map[string][]byte{ "BucketCapacity": {1, 0, 0, 0, 0, 0, 0, 64}, "BucketRate": {2, 0, 0, 0, 0, 0, 240, 63}, @@ -97,7 +97,7 @@ func TestRefresh(t *testing.T) { "ProfilingInterval": {4, 0, 0, 0}, "SignatureKey": []byte("key"), }, - Ttl: 12, + Ttl: 789, }, }, }, @@ -105,7 +105,7 @@ func TestRefresh(t *testing.T) { expectedLogMessages: []string{ "time to refresh", "testdata/refresh_ok.json is refreshed", - "[{\"arguments\":{\"BucketCapacity\":2.0000000000000004,\"BucketRate\":1.0000000000000004,\"EventsFlushInterval\":3,\"MaxCustomMetrics\":2,\"MaxTransactions\":1,\"MetricsFlushInterval\":60,\"ProfilingInterval\":4,\"TriggerRelaxedBucketCapacity\":20.00000000000001,\"TriggerRelaxedBucketRate\":1.0000000000000009,\"TriggerStrictBucketCapacity\":6,\"TriggerStrictBucketRate\":0.1},\"flags\":\"flags\",\"layer\":\"\",\"timestamp\":0,\"ttl\":12,\"type\":0,\"value\":0}]", + "[{\"arguments\":{\"BucketCapacity\":2.0000000000000004,\"BucketRate\":1.0000000000000004,\"EventsFlushInterval\":3,\"MaxCustomMetrics\":2,\"MaxTransactions\":1,\"MetricsFlushInterval\":60,\"ProfilingInterval\":4,\"TriggerRelaxedBucketCapacity\":20.00000000000001,\"TriggerRelaxedBucketRate\":1.0000000000000009,\"TriggerStrictBucketCapacity\":6,\"TriggerStrictBucketRate\":0.1},\"flags\":\"flag1,flag2,flag3\",\"layer\":\"layer1\",\"timestamp\":123,\"ttl\":789,\"type\":0,\"value\":456}]", }, fileExist: true, }, diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index c55bed0f125f..a0701eb4fde6 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -13,7 +13,6 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.2 ) require ( @@ -47,5 +46,6 @@ require ( golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) From 8f65ad1bafdd3668252bc8094aff9ee565907bb9 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 15:54:35 -0700 Subject: [PATCH 13/35] Updated otelcontribcol go modules --- cmd/otelcontribcol/go.mod | 2 +- cmd/otelcontribcol/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/otelcontribcol/go.mod b/cmd/otelcontribcol/go.mod index 0f3c18a7e380..cecf797827a6 100644 --- a/cmd/otelcontribcol/go.mod +++ b/cmd/otelcontribcol/go.mod @@ -695,7 +695,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/snowflakedb/gosnowflake v1.10.1 // indirect github.com/soheilhy/cmux v0.1.5 // indirect - github.com/solarwindscloud/apm-proto v1.0.3 // indirect + github.com/solarwinds/apm-proto v1.0.5 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.11.0 // indirect diff --git a/cmd/otelcontribcol/go.sum b/cmd/otelcontribcol/go.sum index eb4ec5a485aa..27033e24438f 100644 --- a/cmd/otelcontribcol/go.sum +++ b/cmd/otelcontribcol/go.sum @@ -2130,8 +2130,8 @@ github.com/snowflakedb/gosnowflake v1.10.1/go.mod h1:hvc58mU03qg78mSz5z17/qnzI56 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/solarwindscloud/apm-proto v1.0.3 h1:fmPwWNrM5kduAqvmH8mCD0E9MASK8m/mtPmw0yXGOBs= -github.com/solarwindscloud/apm-proto v1.0.3/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/solarwinds/apm-proto v1.0.5 h1:HH1bozLsH+j1Nqn/MKb+h3aNEmrI8OcCWZJFbVEvjr8= +github.com/solarwinds/apm-proto v1.0.5/go.mod h1:CN4fCYBnxyOJlBV0CYNXLz6lzNH8SCfNqcCBbpai76c= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= From 85091f5d6be89e89bbcc879de0342b2f1c97c260 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 16:28:24 -0700 Subject: [PATCH 14/35] Updated --- .../solarwindsapmsettingsextension/generated_component_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/extension/solarwindsapmsettingsextension/generated_component_test.go b/extension/solarwindsapmsettingsextension/generated_component_test.go index 26e58b52fae0..5180bc7b8ad0 100644 --- a/extension/solarwindsapmsettingsextension/generated_component_test.go +++ b/extension/solarwindsapmsettingsextension/generated_component_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/extension/extensiontest" From 0ef422bd3c886ffd77ecfbf3ad776d17cc98f34c Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 18 Jun 2024 16:33:29 -0700 Subject: [PATCH 15/35] Revert --- .../solarwindsapmsettingsextension/generated_component_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/generated_component_test.go b/extension/solarwindsapmsettingsextension/generated_component_test.go index 5180bc7b8ad0..26e58b52fae0 100644 --- a/extension/solarwindsapmsettingsextension/generated_component_test.go +++ b/extension/solarwindsapmsettingsextension/generated_component_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/extension/extensiontest" From ce61f501ff83e6448f2bc26997b9b978251f1547 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 16 Jul 2024 14:44:12 -0700 Subject: [PATCH 16/35] Fixed go.mod after updating --- extension/solarwindsapmsettingsextension/go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index da6f45c14547..0992cf9882ef 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -36,6 +36,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.105.0 // indirect go.opentelemetry.io/collector/featuregate v1.12.0 // indirect go.opentelemetry.io/collector/internal/globalgates v0.105.0 // indirect From 25be1fde73c92735c03841a477443f4c73aad77e Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 16 Jul 2024 15:03:43 -0700 Subject: [PATCH 17/35] fixed go version --- extension/solarwindsapmsettingsextension/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 0992cf9882ef..1b4f6c78be12 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -1,6 +1,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/solarwindsapmsettingsextension -go 1.21.0 +go 1.21.12 require ( github.com/solarwinds/apm-proto v1.0.5 From 7b928924ae6725f15b13b3e976122ece79f0dffc Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 16 Jul 2024 15:24:12 -0700 Subject: [PATCH 18/35] Reverted --- extension/solarwindsapmsettingsextension/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 1b4f6c78be12..0992cf9882ef 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -1,6 +1,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/solarwindsapmsettingsextension -go 1.21.12 +go 1.21.0 require ( github.com/solarwinds/apm-proto v1.0.5 From 7119763160d2fa765c685c243552ba1e7ed3c36d Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Wed, 17 Jul 2024 10:10:37 -0700 Subject: [PATCH 19/35] Update extension/solarwindsapmsettingsextension/extension.go Co-authored-by: Antoine Toulme --- extension/solarwindsapmsettingsextension/extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 5c277aeed320..374b2a474741 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -50,7 +50,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp if err != nil { return err } - extension.logger.Info("dailed to endpoint", zap.String("endpoint", extension.config.Endpoint)) + extension.logger.Info("dialed to endpoint", zap.String("endpoint", extension.config.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) // initial refresh From 1b59c855aa6e0dc2d83021b93627cce3be77dace Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 23 Jul 2024 15:35:26 -0700 Subject: [PATCH 20/35] Added to get system certificate pool for TLS config --- extension/solarwindsapmsettingsextension/extension.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 374b2a474741..20aaeefee41d 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -6,6 +6,7 @@ package solarwindsapmsettingsextension // import "github.com/open-telemetry/open import ( "context" "crypto/tls" + "crypto/x509" "encoding/binary" "encoding/json" "math" @@ -45,12 +46,15 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp extension.logger.Info("starting up solarwinds apm settings extension") ctx := context.Background() ctx, extension.cancel = context.WithCancel(ctx) - var err error - extension.conn, err = grpc.NewClient(extension.config.Endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{}))) + systemCertPool, err := x509.SystemCertPool() if err != nil { return err } - extension.logger.Info("dialed to endpoint", zap.String("endpoint", extension.config.Endpoint)) + extension.conn, err = grpc.NewClient(extension.config.Endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) + if err != nil { + return err + } + extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) // initial refresh From da99852d25a023d9c087acf2c181fd228aef9e52 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 23 Jul 2024 16:00:05 -0700 Subject: [PATCH 21/35] Fixed go.mod --- extension/solarwindsapmsettingsextension/go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 681eef86d8f2..0d227f2055ea 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -36,6 +36,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.105.1-0.20240717163034-43ed6184f9fe // indirect go.opentelemetry.io/collector/featuregate v1.12.1-0.20240716231837-5753a58f712b // indirect go.opentelemetry.io/collector/internal/globalgates v0.105.1-0.20240717163034-43ed6184f9fe // indirect From 2a17e91c85c8f10d3a3d78dea191373cb3de68c5 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 11:02:19 -0700 Subject: [PATCH 22/35] Used os.TempDir() --- extension/solarwindsapmsettingsextension/extension.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 20aaeefee41d..720e8e32569e 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -11,6 +11,7 @@ import ( "encoding/json" "math" "os" + "path" "time" "github.com/solarwinds/apm-proto/go/collectorpb" @@ -22,7 +23,7 @@ import ( ) const ( - jsonOutputFile = "/tmp/solarwinds-apm-settings.json" + jsonOutputFile = "solarwinds-apm-settings.json" grpcContextDeadline = 1 * time.Second ) @@ -57,8 +58,9 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) + outputFile := path.Join(os.TempDir(), jsonOutputFile) // initial refresh - refresh(extension, jsonOutputFile) + refresh(extension, outputFile) go func() { ticker := time.NewTicker(extension.config.Interval) @@ -66,7 +68,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp for { select { case <-ticker.C: - refresh(extension, jsonOutputFile) + refresh(extension, outputFile) case <-ctx.Done(): extension.logger.Info("received ctx.Done() from ticker") return From 59b1911e46b5aeda63607a9b66aa6b01259cc6c0 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 16:26:09 -0700 Subject: [PATCH 23/35] Updated dependencies --- cmd/otelcontribcol/go.mod | 2 +- cmd/otelcontribcol/go.sum | 4 ++-- extension/solarwindsapmsettingsextension/extension.go | 4 +--- .../solarwindsapmsettingsextension/extension_test.go | 8 ++++---- extension/solarwindsapmsettingsextension/go.mod | 3 ++- extension/solarwindsapmsettingsextension/go.sum | 6 ++++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cmd/otelcontribcol/go.mod b/cmd/otelcontribcol/go.mod index 37655d60e653..3046eb685fa7 100644 --- a/cmd/otelcontribcol/go.mod +++ b/cmd/otelcontribcol/go.mod @@ -715,7 +715,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/snowflakedb/gosnowflake v1.11.0 // indirect github.com/soheilhy/cmux v0.1.5 // indirect - github.com/solarwindscloud/apm-proto v1.0.6 // indirect + github.com/solarwindscloud/apm-proto v1.0.7 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.11.0 // indirect diff --git a/cmd/otelcontribcol/go.sum b/cmd/otelcontribcol/go.sum index 84bb9bf3ed39..7dc00e942187 100644 --- a/cmd/otelcontribcol/go.sum +++ b/cmd/otelcontribcol/go.sum @@ -2168,8 +2168,8 @@ github.com/snowflakedb/gosnowflake v1.11.0/go.mod h1:WFe+8mpsapDaQjHX6BqJBKtfQCG github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/solarwindscloud/apm-proto v1.0.6 h1:xkHvnQWjfYh54PHkpTsLI1c2Byv2giqRC1Y4eX8JAds= -github.com/solarwindscloud/apm-proto v1.0.6/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/solarwindscloud/apm-proto v1.0.7 h1:7vJWXKjMwCv4Ej1niRQr8nGKLBoBtDXLMM9p5v7mW+I= +github.com/solarwindscloud/apm-proto v1.0.7/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 720e8e32569e..13886b02e3ab 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -14,7 +14,7 @@ import ( "path" "time" - "github.com/solarwinds/apm-proto/go/collectorpb" + "github.com/solarwindscloud/apm-proto/go/collectorpb" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/extension" "go.uber.org/zap" @@ -118,11 +118,9 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { var settings []map[string]any for _, item := range response.GetSettings() { setting := make(map[string]any) - setting["type"] = item.GetType().Number() setting["flags"] = string(item.GetFlags()) setting["timestamp"] = item.GetTimestamp() setting["value"] = item.GetValue() - setting["layer"] = string(item.GetLayer()) arguments := make(map[string]any) if value, ok := item.Arguments["BucketCapacity"]; ok { arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index 8fe89ff19c16..d056c754718e 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/solarwinds/apm-proto/go/collectorpb" - "github.com/solarwinds/apm-proto/go/collectorpb/mocks" + "github.com/solarwindscloud/apm-proto/go/collectorpb" + "github.com/solarwindscloud/apm-proto/go/collectorpb/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/extension" @@ -105,7 +105,7 @@ func TestRefresh(t *testing.T) { expectedLogMessages: []string{ "time to refresh", "testdata/refresh_ok.json is refreshed", - "[{\"arguments\":{\"BucketCapacity\":2.0000000000000004,\"BucketRate\":1.0000000000000004,\"EventsFlushInterval\":3,\"MaxCustomMetrics\":2,\"MaxTransactions\":1,\"MetricsFlushInterval\":60,\"ProfilingInterval\":4,\"TriggerRelaxedBucketCapacity\":20.00000000000001,\"TriggerRelaxedBucketRate\":1.0000000000000009,\"TriggerStrictBucketCapacity\":6,\"TriggerStrictBucketRate\":0.1},\"flags\":\"flag1,flag2,flag3\",\"layer\":\"layer1\",\"timestamp\":123,\"ttl\":789,\"type\":0,\"value\":456}]", + "[{\"arguments\":{\"BucketCapacity\":2.0000000000000004,\"BucketRate\":1.0000000000000004,\"EventsFlushInterval\":3,\"MaxCustomMetrics\":2,\"MaxTransactions\":1,\"MetricsFlushInterval\":60,\"ProfilingInterval\":4,\"TriggerRelaxedBucketCapacity\":20.00000000000001,\"TriggerRelaxedBucketRate\":1.0000000000000009,\"TriggerStrictBucketCapacity\":6,\"TriggerStrictBucketRate\":0.1},\"flags\":\"flag1,flag2,flag3\",\"timestamp\":123,\"ttl\":789,\"value\":456}]", }, fileExist: true, }, @@ -147,7 +147,7 @@ func TestRefresh(t *testing.T) { "time to refresh", "GetSettings succeed", "testdata/refresh_warning.json is refreshed (soft disabled)", - "[{\"arguments\":{\"BucketCapacity\":0,\"BucketRate\":1e-323,\"EventsFlushInterval\":0,\"MaxCustomMetrics\":0,\"MaxTransactions\":0,\"MetricsFlushInterval\":0,\"ProfilingInterval\":0,\"TriggerRelaxedBucketCapacity\":0,\"TriggerRelaxedBucketRate\":0,\"TriggerStrictBucketCapacity\":0,\"TriggerStrictBucketRate\":0},\"flags\":\"flags\",\"layer\":\"\",\"timestamp\":0,\"ttl\":10,\"type\":0,\"value\":0}]", + "[{\"arguments\":{\"BucketCapacity\":0,\"BucketRate\":1e-323,\"EventsFlushInterval\":0,\"MaxCustomMetrics\":0,\"MaxTransactions\":0,\"MetricsFlushInterval\":0,\"ProfilingInterval\":0,\"TriggerRelaxedBucketCapacity\":0,\"TriggerRelaxedBucketRate\":0,\"TriggerStrictBucketCapacity\":0,\"TriggerStrictBucketRate\":0},\"flags\":\"flags\",\"timestamp\":0,\"ttl\":10,\"value\":0}]", }, fileExist: true, }, diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 4e17c4b2d283..b6b911fa01ab 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/solar go 1.22.0 require ( - github.com/solarwindscloud/apm-proto v1.0.6 + github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.107.0 go.opentelemetry.io/collector/confmap v0.107.0 @@ -34,6 +34,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect go.opentelemetry.io/collector/featuregate v1.13.0 // indirect go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index f01c6bcc0f1f..75ed32e2f956 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -49,8 +49,10 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/solarwindscloud/apm-proto v1.0.6 h1:xkHvnQWjfYh54PHkpTsLI1c2Byv2giqRC1Y4eX8JAds= -github.com/solarwindscloud/apm-proto v1.0.6/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/solarwindscloud/apm-proto v1.0.7 h1:7vJWXKjMwCv4Ej1niRQr8nGKLBoBtDXLMM9p5v7mW+I= +github.com/solarwindscloud/apm-proto v1.0.7/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= From 5c7853756bfa851ea89d8e273120833a4459b7a3 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 16:54:21 -0700 Subject: [PATCH 24/35] Applied configgrpc --- .../solarwindsapmsettingsextension/config.go | 15 +++--- .../config_test.go | 13 +++-- .../extension.go | 8 +-- .../extension_test.go | 33 +++++++++--- .../factory_test.go | 2 +- .../solarwindsapmsettingsextension/go.mod | 19 ++++++- .../solarwindsapmsettingsextension/go.sum | 50 +++++++++++++++++-- 7 files changed, 112 insertions(+), 28 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/config.go b/extension/solarwindsapmsettingsextension/config.go index 70011b4e65d8..81b0a01c6dbf 100644 --- a/extension/solarwindsapmsettingsextension/config.go +++ b/extension/solarwindsapmsettingsextension/config.go @@ -10,12 +10,13 @@ import ( "time" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configgrpc" ) type Config struct { - Endpoint string `mapstructure:"endpoint"` - Key string `mapstructure:"key"` - Interval time.Duration `mapstructure:"interval"` + ClientConfig configgrpc.ClientConfig `mapstructure:",squash"` + Key string `mapstructure:"key"` + Interval time.Duration `mapstructure:"interval"` } const ( @@ -27,17 +28,19 @@ const ( func createDefaultConfig() component.Config { return &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, Interval: DefaultInterval, } } func (cfg *Config) Validate() error { // Endpoint - matched, _ := regexp.MatchString(`apm.collector.[a-z]{2,3}-[0-9]{2}.[a-z\-]*.solarwinds.com:443`, cfg.Endpoint) + matched, _ := regexp.MatchString(`apm.collector.[a-z]{2,3}-[0-9]{2}.[a-z\-]*.solarwinds.com:443`, cfg.ClientConfig.Endpoint) if !matched { // Replaced by the default - cfg.Endpoint = DefaultEndpoint + cfg.ClientConfig.Endpoint = DefaultEndpoint } // Key keyArr := strings.Split(cfg.Key, ":") diff --git a/extension/solarwindsapmsettingsextension/config_test.go b/extension/solarwindsapmsettingsextension/config_test.go index a6814ec5b83e..3ae6f88f1964 100644 --- a/extension/solarwindsapmsettingsextension/config_test.go +++ b/extension/solarwindsapmsettingsextension/config_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/confmap/confmaptest" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/solarwindsapmsettingsextension/internal/metadata" @@ -31,7 +32,9 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ - Endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443", + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443", + }, Key: "something:name", Interval: time.Duration(10) * time.Second, }, @@ -39,7 +42,9 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "2"), expected: &Config{ - Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + }, Key: "something", Interval: time.Duration(5) * time.Second, }, @@ -47,7 +52,9 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "3"), expected: &Config{ - Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + }, Key: "something:name", Interval: time.Duration(60) * time.Second, }, diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 13886b02e3ab..0a66748968e3 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -51,11 +51,11 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ comp if err != nil { return err } - extension.conn, err = grpc.NewClient(extension.config.Endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) + extension.conn, err = grpc.NewClient(extension.config.ClientConfig.Endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) if err != nil { return err } - extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.Endpoint)) + extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) outputFile := path.Join(os.TempDir(), jsonOutputFile) @@ -91,7 +91,7 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err } func refresh(extension *solarwindsapmSettingsExtension, filename string) { - extension.logger.Info("time to refresh", zap.String("endpoint", extension.config.Endpoint)) + extension.logger.Info("time to refresh", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) if hostname, err := os.Hostname(); err != nil { extension.logger.Error("unable to call os.Hostname()", zap.Error(err)) } else { @@ -107,7 +107,7 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { } response, err := extension.client.GetSettings(ctx, request) if err != nil { - extension.logger.Error("unable to get settings", zap.String("endpoint", extension.config.Endpoint), zap.Error(err)) + extension.logger.Error("unable to get settings", zap.String("endpoint", extension.config.ClientConfig.Endpoint), zap.Error(err)) return } switch result := response.GetResult(); result { diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index d056c754718e..c638d831b4dd 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -13,6 +13,7 @@ import ( "github.com/solarwindscloud/apm-proto/go/collectorpb/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/extension" "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" @@ -28,14 +29,18 @@ func TestCreateExtension(t *testing.T) { { name: "default", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, Interval: DefaultInterval, }, }, { name: "anything", cfg: &Config{ - Endpoint: "apm.collector.na-02.cloud.solarwinds.com:443", + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.na-02.cloud.solarwinds.com:443", + }, Key: "something:name", Interval: time.Duration(10) * time.Second, }, @@ -72,7 +77,9 @@ func TestRefresh(t *testing.T) { { name: "ok", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_OK, @@ -112,7 +119,9 @@ func TestRefresh(t *testing.T) { { name: "ok with warning", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_OK, @@ -154,7 +163,9 @@ func TestRefresh(t *testing.T) { { name: "try later", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_TRY_LATER, @@ -170,7 +181,9 @@ func TestRefresh(t *testing.T) { { name: "invalid api key", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_INVALID_API_KEY, @@ -186,7 +199,9 @@ func TestRefresh(t *testing.T) { { name: "limit exceeded", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_LIMIT_EXCEEDED, @@ -202,7 +217,9 @@ func TestRefresh(t *testing.T) { { name: "redirect", cfg: &Config{ - Endpoint: DefaultEndpoint, + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, }, reply: &collectorpb.SettingsResult{ Result: collectorpb.ResultCode_REDIRECT, diff --git a/extension/solarwindsapmsettingsextension/factory_test.go b/extension/solarwindsapmsettingsextension/factory_test.go index 48f7ee1e35f8..d30f14fbaa44 100644 --- a/extension/solarwindsapmsettingsextension/factory_test.go +++ b/extension/solarwindsapmsettingsextension/factory_test.go @@ -17,7 +17,7 @@ func TestCreateDefaultConfig(t *testing.T) { assert.NoError(t, componenttest.CheckConfigStruct(cfg)) ocfg, ok := factory.CreateDefaultConfig().(*Config) assert.True(t, ok) - assert.Equal(t, ocfg.Endpoint, DefaultEndpoint, "Wrong default endpoint") + assert.Equal(t, ocfg.ClientConfig.Endpoint, DefaultEndpoint, "Wrong default endpoint") assert.Empty(t, ocfg.Key, "There is no default key") assert.Equal(t, ocfg.Interval, DefaultInterval, "Wrong default interval") } diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index b6b911fa01ab..7f4442461457 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -6,6 +6,7 @@ require ( github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configgrpc v0.107.0 go.opentelemetry.io/collector/confmap v0.107.0 go.opentelemetry.io/collector/extension v0.107.0 go.uber.org/goleak v1.3.0 @@ -17,17 +18,21 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect + github.com/klauspost/compress v1.17.8 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/knadh/koanf/providers/confmap v0.1.0 // indirect github.com/knadh/koanf/v2 v2.1.1 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -35,10 +40,20 @@ require ( github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/stretchr/objx v0.5.2 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.107.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect go.opentelemetry.io/collector/featuregate v1.13.0 // indirect go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect @@ -47,9 +62,9 @@ require ( go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index 75ed32e2f956..0c79982a2fd2 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -4,6 +4,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -13,14 +15,20 @@ github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAp github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= @@ -35,6 +43,12 @@ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa1 github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= +github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -57,20 +71,48 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector v0.107.0 h1:C1Mng03iE73flGhEg795IFVlr3qhDLef5GESjIVtx5g= +go.opentelemetry.io/collector v0.107.0/go.mod h1:7xDYvzBb3Ez6qFQl0IArBbmNNazIxZMVoRkbgJYRjyg= +go.opentelemetry.io/collector/client v1.13.0 h1:I0GzZPcOG+F6BY46SgsdcpCN+L0xPfjzTRN2Y4Etdrw= +go.opentelemetry.io/collector/client v1.13.0/go.mod h1:GOE/UvRdklwPCqYLRUOSiU/syl1BGQWa48ex7OGOq9Y= go.opentelemetry.io/collector/component v0.107.0 h1:3ReaEAtKwrPj7HrlKjEGBDKbBaxdRMPC2mfZ9b6zjXE= go.opentelemetry.io/collector/component v0.107.0/go.mod h1:1xMIYKvpnP7laipjgEw7kq1ozG7ySLkA0Evhr2Bp8M4= +go.opentelemetry.io/collector/config/configauth v0.107.0 h1:2rAoMJjSfdP+ao5i7Ku68QYW5p0jjZ9y6a0nj3cIFp0= +go.opentelemetry.io/collector/config/configauth v0.107.0/go.mod h1:IQx5BBZRoyPX9Qr3W4Ajy/4AnyJZb6jylI4rITrZMHQ= +go.opentelemetry.io/collector/config/configcompression v1.13.0 h1:2LApl3qDZgjsVblY1Qu0gJaw9ZyYnZ6ZDUvid9rCZVg= +go.opentelemetry.io/collector/config/configcompression v1.13.0/go.mod h1:6+m0GKCv7JKzaumn7u80A2dLNCuYf5wdR87HWreoBO0= +go.opentelemetry.io/collector/config/configgrpc v0.107.0 h1:hU7xjvvinsF2lrkiC3yHbDMvZT9v1ZgY1amiUBx1cRE= +go.opentelemetry.io/collector/config/configgrpc v0.107.0/go.mod h1:90Gm98rZbh2GDi0lN9BdW2D8SVuHxrNSEHiryFhPLpk= +go.opentelemetry.io/collector/config/confignet v0.107.0 h1:epggoJD6q17Vd3KFtOv3HgdvGfLR1AePxS2U4alLwmw= +go.opentelemetry.io/collector/config/confignet v0.107.0/go.mod h1:pfOrCTfSZEB6H2rKtx41/3RN4dKs+X2EKQbw3MGRh0E= +go.opentelemetry.io/collector/config/configopaque v1.13.0 h1:EDB9JIifmBth1z9IsEduoE1bT1Q8jV0sR005EMW7q1w= +go.opentelemetry.io/collector/config/configopaque v1.13.0/go.mod h1:0xURn2sOy5j4fbaocpEYfM97HPGsiffkkVudSPyTJlM= go.opentelemetry.io/collector/config/configtelemetry v0.107.0 h1:pSGd4FWQ/Up/Af+XZTR8JNneH/wmQ/TAU4Z16JHQeUc= go.opentelemetry.io/collector/config/configtelemetry v0.107.0/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= +go.opentelemetry.io/collector/config/configtls v1.13.0 h1:N57vOibMIPX9YZq4ZLFjj5ZjUHMYW7bpkPkygU3vt8w= +go.opentelemetry.io/collector/config/configtls v1.13.0/go.mod h1:3CBJYFQYTCYIPJMRvzn3NVtasv8out21ZNXkSCPepuY= +go.opentelemetry.io/collector/config/internal v0.107.0 h1:aENT1bVin8HCHZuKXc8U1sTYalzl6+RpOMDWpt+VoCQ= +go.opentelemetry.io/collector/config/internal v0.107.0/go.mod h1:2LQPVQPDeIyXN6AXazlls1M0zmlhIM7q80V4K7mQ6PM= go.opentelemetry.io/collector/confmap v0.107.0 h1:M2o7jvQM9bnMU3pE2N6BK4KHYtSnvsSZkegUD89y8BU= go.opentelemetry.io/collector/confmap v0.107.0/go.mod h1:9Fs/ZEIeiMa38VqkqIpn+JKQkcPf/lhAKA9fHu6c9GY= +go.opentelemetry.io/collector/consumer v0.107.0 h1:fF/+xyv9BfXQUvuJqkljrpzKyBQExDQt6zB5rzGyuHs= +go.opentelemetry.io/collector/consumer v0.107.0/go.mod h1:wgWpFes9sbnZ11XeJPSeutU8GJx6dT/gzSUqHpaZZQA= go.opentelemetry.io/collector/extension v0.107.0 h1:wstZXb24RwdcchZu3juTH9M0xryKG4sYmb1/w6J3tqQ= go.opentelemetry.io/collector/extension v0.107.0/go.mod h1:w/+HXzRO7jPutUIMyBlzX6deUPl205QCEwteB0YgWOg= +go.opentelemetry.io/collector/extension/auth v0.107.0 h1:xv+MI9ce8RG1UP4XihTaPR3pCKVvKOl2iIyFqYa0bvE= +go.opentelemetry.io/collector/extension/auth v0.107.0/go.mod h1:tFMzaKaUAx3eWpp3lOLZ8OcLbryydyof9+GCvCWmKmU= go.opentelemetry.io/collector/featuregate v1.13.0 h1:rc84eCf5hesXQ8/bP6Zc15wqthbomfLBHmox5tT7AwM= go.opentelemetry.io/collector/featuregate v1.13.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= go.opentelemetry.io/collector/internal/globalgates v0.107.0 h1:PaD6WgQg80YTVxg8OF+YEqgI7WRd13wMu/R6GIG7uNU= go.opentelemetry.io/collector/internal/globalgates v0.107.0/go.mod h1:hca7Tpzu6JmBrAOgmlyp/ZM6kxprPRMKqSYoq/Tdzjw= go.opentelemetry.io/collector/pdata v1.13.0 h1:eV3NQt2f1UcaibkziMvGTQI34LlpiYBUGp1yP0G/Cxw= go.opentelemetry.io/collector/pdata v1.13.0/go.mod h1:MYeB0MmMAxeM0hstCFrCqWLzdyeYySim2dG6pDT6nYI= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0 h1:F25VZrEkSaneIBNcNI9LEBWf9nRC/WHKluSBTP0gKAA= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0/go.mod h1:1GrwsKtgogRCt8aG/0lfJ037yDdFtYqF+OtJr+snxRQ= +go.opentelemetry.io/collector/pdata/testdata v0.107.0 h1:02CqvJrYjkrBlWDD+6yrByN1AhG2zT61OScLPhyyMwU= +go.opentelemetry.io/collector/pdata/testdata v0.107.0/go.mod h1:bqaeiDH1Lc5DFJXvjVHwO50x00TXj+oFre+EbOVeZXs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/exporters/prometheus v0.50.0 h1:2Ewsda6hejmbhGFyUvWZjUThC98Cf8Zy6g0zkIimOng= @@ -106,8 +148,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= @@ -120,8 +162,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= From 0b1330b25d17eb53fa05c8095acd7a9a12119c94 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 17:51:22 -0700 Subject: [PATCH 25/35] Applied ToClientConn function --- .../extension.go | 30 ++++++++----------- .../extension_test.go | 16 ++++++++-- .../solarwindsapmsettingsextension/factory.go | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 0a66748968e3..90f939c22869 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -5,8 +5,6 @@ package solarwindsapmsettingsextension // import "github.com/open-telemetry/open import ( "context" - "crypto/tls" - "crypto/x509" "encoding/binary" "encoding/json" "math" @@ -19,7 +17,6 @@ import ( "go.opentelemetry.io/collector/extension" "go.uber.org/zap" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) const ( @@ -28,30 +25,29 @@ const ( ) type solarwindsapmSettingsExtension struct { - logger *zap.Logger - config *Config - cancel context.CancelFunc - conn *grpc.ClientConn - client collectorpb.TraceCollectorClient + logger *zap.Logger + config *Config + cancel context.CancelFunc + conn *grpc.ClientConn + client collectorpb.TraceCollectorClient + telemetrySettings component.TelemetrySettings } -func newSolarwindsApmSettingsExtension(extensionCfg *Config, logger *zap.Logger) (extension.Extension, error) { +func newSolarwindsApmSettingsExtension(extensionCfg *Config, settings extension.Settings) (extension.Extension, error) { settingsExtension := &solarwindsapmSettingsExtension{ - config: extensionCfg, - logger: logger, + config: extensionCfg, + logger: settings.TelemetrySettings.Logger, + telemetrySettings: settings.TelemetrySettings, } return settingsExtension, nil } -func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, _ component.Host) error { +func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host component.Host) error { extension.logger.Info("starting up solarwinds apm settings extension") ctx := context.Background() ctx, extension.cancel = context.WithCancel(ctx) - systemCertPool, err := x509.SystemCertPool() - if err != nil { - return err - } - extension.conn, err = grpc.NewClient(extension.config.ClientConfig.Endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) + var err error + extension.conn, err = extension.config.ClientConfig.ToClientConn(ctx, host, extension.telemetrySettings) if err != nil { return err } diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index c638d831b4dd..c4befb4d364d 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -9,10 +9,13 @@ import ( "testing" "time" + "github.com/google/uuid" "github.com/solarwindscloud/apm-proto/go/collectorpb" "github.com/solarwindscloud/apm-proto/go/collectorpb/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/extension" "go.uber.org/zap" @@ -54,11 +57,18 @@ func TestCreateExtension(t *testing.T) { } } +// NewNopSettings returns a new nop settings for extension.Factory Create* functions. +func NewNopSettings() extension.Settings { + return extension.Settings{ + ID: component.NewIDWithName(component.MustNewType("nop"), uuid.NewString()), + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} + // create extension func createAnExtension(c *Config, t *testing.T) extension.Extension { - logger, err := zap.NewProduction() - require.NoError(t, err) - ex, err := newSolarwindsApmSettingsExtension(c, logger) + ex, err := newSolarwindsApmSettingsExtension(c, NewNopSettings()) require.NoError(t, err) require.NoError(t, ex.Start(context.TODO(), nil)) return ex diff --git a/extension/solarwindsapmsettingsextension/factory.go b/extension/solarwindsapmsettingsextension/factory.go index b521cbeee72f..c19b218eafec 100644 --- a/extension/solarwindsapmsettingsextension/factory.go +++ b/extension/solarwindsapmsettingsextension/factory.go @@ -13,7 +13,7 @@ import ( ) func createExtension(_ context.Context, settings extension.Settings, cfg component.Config) (extension.Extension, error) { - return newSolarwindsApmSettingsExtension(cfg.(*Config), settings.Logger) + return newSolarwindsApmSettingsExtension(cfg.(*Config), settings) } func NewFactory() extension.Factory { From 574d3f08869ec754e3802c63a1ac57549c929cee Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 18:05:13 -0700 Subject: [PATCH 26/35] Fixed checkapi problem --- extension/solarwindsapmsettingsextension/extension_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index c4befb4d364d..3ac35b4974ac 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -58,7 +58,7 @@ func TestCreateExtension(t *testing.T) { } // NewNopSettings returns a new nop settings for extension.Factory Create* functions. -func NewNopSettings() extension.Settings { +func newNopSettings() extension.Settings { return extension.Settings{ ID: component.NewIDWithName(component.MustNewType("nop"), uuid.NewString()), TelemetrySettings: componenttest.NewNopTelemetrySettings(), @@ -68,7 +68,7 @@ func NewNopSettings() extension.Settings { // create extension func createAnExtension(c *Config, t *testing.T) extension.Extension { - ex, err := newSolarwindsApmSettingsExtension(c, NewNopSettings()) + ex, err := newSolarwindsApmSettingsExtension(c, newNopSettings()) require.NoError(t, err) require.NoError(t, ex.Start(context.TODO(), nil)) return ex From 5bb4ddc64d9aad0d0891601bb5b2fc4b2ec11c03 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Thu, 15 Aug 2024 18:13:12 -0700 Subject: [PATCH 27/35] Fixed go.mod --- extension/solarwindsapmsettingsextension/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index 7f4442461457..a49b17649c2f 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/solar go 1.22.0 require ( + github.com/google/uuid v1.6.0 github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.107.0 @@ -24,7 +25,6 @@ require ( github.com/go-viper/mapstructure/v2 v2.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect From 82ef634f741b232c431adf4b9bdbac0347f7e643 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Fri, 16 Aug 2024 09:14:37 -0700 Subject: [PATCH 28/35] nits --- extension/solarwindsapmsettingsextension/extension_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index 3ac35b4974ac..eaf90335099b 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -57,7 +57,7 @@ func TestCreateExtension(t *testing.T) { } } -// NewNopSettings returns a new nop settings for extension.Factory Create* functions. +// newNopSettings returns a new nop settings for extension.Factory Create* functions. func newNopSettings() extension.Settings { return extension.Settings{ ID: component.NewIDWithName(component.MustNewType("nop"), uuid.NewString()), From 3f31f5175214d70bdb3a513b3446389d9f6ed39a Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Fri, 16 Aug 2024 09:49:07 -0700 Subject: [PATCH 29/35] Added more unit test cases & system pool --- .../config_test.go | 212 +++++++++++++++++- .../extension.go | 11 +- .../testdata/config.yaml | 88 +++++++- 3 files changed, 299 insertions(+), 12 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/config_test.go b/extension/solarwindsapmsettingsextension/config_test.go index 3ae6f88f1964..d1ca784893f1 100644 --- a/extension/solarwindsapmsettingsextension/config_test.go +++ b/extension/solarwindsapmsettingsextension/config_test.go @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ ClientConfig: configgrpc.ClientConfig{ - Endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443", + Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", }, Key: "something:name", Interval: time.Duration(10) * time.Second, @@ -43,20 +43,220 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "2"), expected: &Config{ ClientConfig: configgrpc.ClientConfig{ - Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + Endpoint: "apm.collector.na-02.cloud.solarwinds.com:443", }, - Key: "something", - Interval: time.Duration(5) * time.Second, + Key: "something:name", + Interval: time.Duration(10) * time.Second, }, }, { id: component.NewIDWithName(metadata.Type, "3"), expected: &Config{ ClientConfig: configgrpc.ClientConfig{ - Endpoint: "apm.collector.na-01.cloud.solarwinds.com:443", + Endpoint: "apm.collector.eu-01.cloud.solarwinds.com:443", + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "4"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443", + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "5"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.na-01.st-ssp.solarwinds.com:443", + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "6"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: "apm.collector.na-01.dev-ssp.solarwinds.com:443", + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "7"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "8"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "9"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "10"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "11"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "12"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, }, Key: "something:name", - Interval: time.Duration(60) * time.Second, + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "13"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "14"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "15"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "something:name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "16"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "17"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: ":", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "18"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "::", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "19"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: ":name", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "20"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "token:", + Interval: time.Duration(10) * time.Second, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "21"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "token:name", + Interval: MinimumInterval, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "22"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "token:name", + Interval: MaximumInterval, + }, + }, + { + id: component.NewIDWithName(metadata.Type, "23"), + expected: &Config{ + ClientConfig: configgrpc.ClientConfig{ + Endpoint: DefaultEndpoint, + }, + Key: "token:name", + Interval: MinimumInterval, }, }, } diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 90f939c22869..d8e063240289 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -5,6 +5,8 @@ package solarwindsapmsettingsextension // import "github.com/open-telemetry/open import ( "context" + "crypto/tls" + "crypto/x509" "encoding/binary" "encoding/json" "math" @@ -17,6 +19,7 @@ import ( "go.opentelemetry.io/collector/extension" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/credentials" ) const ( @@ -46,11 +49,15 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c extension.logger.Info("starting up solarwinds apm settings extension") ctx := context.Background() ctx, extension.cancel = context.WithCancel(ctx) - var err error - extension.conn, err = extension.config.ClientConfig.ToClientConn(ctx, host, extension.telemetrySettings) + systemCertPool, err := x509.SystemCertPool() if err != nil { return err } + extension.conn, err = extension.config.ClientConfig.ToClientConn(ctx, host, extension.telemetrySettings, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) + if err != nil { + extension.logger.Error("grpc.NewClient creation failed: ", zap.Error(err)) + return err + } extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) diff --git a/extension/solarwindsapmsettingsextension/testdata/config.yaml b/extension/solarwindsapmsettingsextension/testdata/config.yaml index 4fb5cf5c0417..f6e45b2b01f0 100644 --- a/extension/solarwindsapmsettingsextension/testdata/config.yaml +++ b/extension/solarwindsapmsettingsextension/testdata/config.yaml @@ -1,13 +1,93 @@ solarwindsapmsettings: solarwindsapmsettings/1: - endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443" + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" key: "something:name" interval: 10s solarwindsapmsettings/2: - endpoint: "apm.collector.eu-01.cloud.solarwinds.com" - key: "something" - interval: "4s" + endpoint: "apm.collector.na-02.cloud.solarwinds.com:443" + key: "something:name" + interval: 10s solarwindsapmsettings/3: + endpoint: "apm.collector.eu-01.cloud.solarwinds.com:443" + key: "something:name" + interval: 10s +solarwindsapmsettings/4: + endpoint: "apm.collector.apj-01.cloud.solarwinds.com:443" + key: "something:name" + interval: 10s +solarwindsapmsettings/5: + endpoint: "apm.collector.na-01.st-ssp.solarwinds.com:443" + key: "something:name" + interval: 10s +solarwindsapmsettings/6: + endpoint: "apm.collector.na-01.dev-ssp.solarwinds.com:443" + key: "something:name" + interval: 10s +solarwindsapmsettings/7: + endpoint: "apm.collector.na-01.cloud.solarwinds.com" + key: "something:name" + interval: 10s +solarwindsapmsettings/8: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:a:b" + key: "something:name" + interval: 10s +solarwindsapmsettings/9: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:port" + key: "something:name" + interval: 10s +solarwindsapmsettings/10: + endpoint: "apm.collector..cloud.solarwinds.com:443" + key: "something:name" + interval: 10s +solarwindsapmsettings/11: + endpoint: ":443" + key: "something:name" + interval: 10s +solarwindsapmsettings/12: + endpoint: ":" + key: "something:name" + interval: 10s +solarwindsapmsettings/13: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:" + key: "something:name" + interval: 10s +solarwindsapmsettings/14: + endpoint: "::" + key: "something:name" + interval: 10s +solarwindsapmsettings/15: endpoint: "" key: "something:name" + interval: 10s +solarwindsapmsettings/16: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "" + interval: 10s +solarwindsapmsettings/17: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: ":" + interval: 10s +solarwindsapmsettings/18: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "::" + interval: 10s +solarwindsapmsettings/19: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: ":name" + interval: 10s +solarwindsapmsettings/20: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "token:" + interval: 10s +solarwindsapmsettings/21: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "token:name" + interval: 4s +solarwindsapmsettings/22: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "token:name" interval: 61s +solarwindsapmsettings/23: + endpoint: "apm.collector.na-01.cloud.solarwinds.com:443" + key: "token:name" + interval: 30 From cdeee9ff7357d33ec0117e0b294f9c421f9d9ad1 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Fri, 16 Aug 2024 10:21:09 -0700 Subject: [PATCH 30/35] nits --- .../extension.go | 32 +++++++++---------- .../extension_test.go | 10 +++--- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index d8e063240289..4040fad565fe 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -28,7 +28,6 @@ const ( ) type solarwindsapmSettingsExtension struct { - logger *zap.Logger config *Config cancel context.CancelFunc conn *grpc.ClientConn @@ -39,14 +38,13 @@ type solarwindsapmSettingsExtension struct { func newSolarwindsApmSettingsExtension(extensionCfg *Config, settings extension.Settings) (extension.Extension, error) { settingsExtension := &solarwindsapmSettingsExtension{ config: extensionCfg, - logger: settings.TelemetrySettings.Logger, telemetrySettings: settings.TelemetrySettings, } return settingsExtension, nil } func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host component.Host) error { - extension.logger.Info("starting up solarwinds apm settings extension") + extension.telemetrySettings.Logger.Info("starting up solarwinds apm settings extension") ctx := context.Background() ctx, extension.cancel = context.WithCancel(ctx) systemCertPool, err := x509.SystemCertPool() @@ -55,10 +53,10 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c } extension.conn, err = extension.config.ClientConfig.ToClientConn(ctx, host, extension.telemetrySettings, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) if err != nil { - extension.logger.Error("grpc.NewClient creation failed: ", zap.Error(err)) + extension.telemetrySettings.Logger.Error("grpc.NewClient creation failed: ", zap.Error(err)) return err } - extension.logger.Info("created a gRPC client", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) + extension.telemetrySettings.Logger.Info("created a gRPC client", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) extension.client = collectorpb.NewTraceCollectorClient(extension.conn) outputFile := path.Join(os.TempDir(), jsonOutputFile) @@ -73,7 +71,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c case <-ticker.C: refresh(extension, outputFile) case <-ctx.Done(): - extension.logger.Info("received ctx.Done() from ticker") + extension.telemetrySettings.Logger.Info("received ctx.Done() from ticker") return } } @@ -83,7 +81,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c } func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) error { - extension.logger.Info("shutting down solarwinds apm settings extension") + extension.telemetrySettings.Logger.Info("shutting down solarwinds apm settings extension") if extension.cancel != nil { extension.cancel() } @@ -94,9 +92,9 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err } func refresh(extension *solarwindsapmSettingsExtension, filename string) { - extension.logger.Info("time to refresh", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) + extension.telemetrySettings.Logger.Info("time to refresh", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) if hostname, err := os.Hostname(); err != nil { - extension.logger.Error("unable to call os.Hostname()", zap.Error(err)) + extension.telemetrySettings.Logger.Error("unable to call os.Hostname()", zap.Error(err)) } else { ctx, cancel := context.WithTimeout(context.Background(), grpcContextDeadline) defer cancel() @@ -110,13 +108,13 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { } response, err := extension.client.GetSettings(ctx, request) if err != nil { - extension.logger.Error("unable to get settings", zap.String("endpoint", extension.config.ClientConfig.Endpoint), zap.Error(err)) + extension.telemetrySettings.Logger.Error("unable to get settings", zap.String("endpoint", extension.config.ClientConfig.Endpoint), zap.Error(err)) return } switch result := response.GetResult(); result { case collectorpb.ResultCode_OK: if len(response.GetWarning()) > 0 { - extension.logger.Warn("GetSettings succeed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) + extension.telemetrySettings.Logger.Warn("GetSettings succeed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } var settings []map[string]any for _, item := range response.GetSettings() { @@ -163,21 +161,21 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { settings = append(settings, setting) } if content, err := json.Marshal(settings); err != nil { - extension.logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) + extension.telemetrySettings.Logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) } else { if err := os.WriteFile(filename, content, 0600); err != nil { - extension.logger.Error("unable to write "+filename, zap.Error(err)) + extension.telemetrySettings.Logger.Error("unable to write "+filename, zap.Error(err)) } else { if len(response.GetWarning()) > 0 { - extension.logger.Warn(filename + " is refreshed (soft disabled)") + extension.telemetrySettings.Logger.Warn(filename + " is refreshed (soft disabled)") } else { - extension.logger.Info(filename + " is refreshed") + extension.telemetrySettings.Logger.Info(filename + " is refreshed") } - extension.logger.Info(string(content)) + extension.telemetrySettings.Logger.Info(string(content)) } } default: - extension.logger.Warn("GetSettings failed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) + extension.telemetrySettings.Logger.Warn("GetSettings failed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } } } diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index eaf90335099b..3b8278e12048 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -248,12 +248,12 @@ func TestRefresh(t *testing.T) { mockTraceCollectorClient := &mocks.TraceCollectorClient{} mockTraceCollectorClient.On("GetSettings", mock.Anything, mock.Anything).Return(tt.reply, nil) observedZapCore, observedLogs := observer.New(zap.InfoLevel) - logger := zap.New(observedZapCore) - + settings := newNopSettings() + settings.TelemetrySettings.Logger = zap.New(observedZapCore) settingsExtension := &solarwindsapmSettingsExtension{ - config: tt.cfg, - logger: logger, - client: mockTraceCollectorClient, + config: tt.cfg, + telemetrySettings: settings.TelemetrySettings, + client: mockTraceCollectorClient, } refresh(settingsExtension, tt.filename) require.Equal(t, len(tt.expectedLogMessages), observedLogs.Len()) From 9475c30c880993075949406de635d2ba16385c10 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Fri, 16 Aug 2024 10:36:30 -0700 Subject: [PATCH 31/35] nits --- extension/solarwindsapmsettingsextension/extension.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 4040fad565fe..8f8e68d6af20 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -53,7 +53,6 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c } extension.conn, err = extension.config.ClientConfig.ToClientConn(ctx, host, extension.telemetrySettings, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{RootCAs: systemCertPool}))) if err != nil { - extension.telemetrySettings.Logger.Error("grpc.NewClient creation failed: ", zap.Error(err)) return err } extension.telemetrySettings.Logger.Info("created a gRPC client", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) @@ -161,7 +160,7 @@ func refresh(extension *solarwindsapmSettingsExtension, filename string) { settings = append(settings, setting) } if content, err := json.Marshal(settings); err != nil { - extension.telemetrySettings.Logger.Warn("error to marshal setting JSON[] byte from settings", zap.Error(err)) + extension.telemetrySettings.Logger.Error("unable to marshal setting JSON[] byte from settings", zap.Error(err)) } else { if err := os.WriteFile(filename, content, 0600); err != nil { extension.telemetrySettings.Logger.Error("unable to write "+filename, zap.Error(err)) From 096ba0d183e6eb690a983021c14cc7ccd7c81030 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Mon, 19 Aug 2024 10:41:27 -0700 Subject: [PATCH 32/35] make gotidy --- .../solarwindsapmsettingsextension/go.mod | 13 ++++++++- .../solarwindsapmsettingsextension/go.sum | 28 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index fc57df2829c3..b9c12972e470 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -7,7 +7,7 @@ require ( github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.107.1-0.20240816132030-9fd84668bb02 - go.opentelemetry.io/collector/config/configgrpc v0.107.1-0.20240816132030-9fd84668bb02 + go.opentelemetry.io/collector/config/configgrpc v0.107.1-0.20240816132030-9fd84668bb02 go.opentelemetry.io/collector/confmap v0.107.1-0.20240816132030-9fd84668bb02 go.opentelemetry.io/collector/extension v0.107.1-0.20240816132030-9fd84668bb02 go.uber.org/goleak v1.3.0 @@ -39,11 +39,22 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect go.opentelemetry.io/collector/component/componentstatus v0.0.0-20240731165531-6d32c09daf9f // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.107.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect go.opentelemetry.io/collector/featuregate v1.13.1-0.20240816132030-9fd84668bb02 // indirect go.opentelemetry.io/collector/internal/globalgates v0.107.1-0.20240816132030-9fd84668bb02 // indirect go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index c5cb07e78d2d..303e291c6a38 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -71,22 +71,50 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector v0.107.0 h1:C1Mng03iE73flGhEg795IFVlr3qhDLef5GESjIVtx5g= +go.opentelemetry.io/collector v0.107.0/go.mod h1:7xDYvzBb3Ez6qFQl0IArBbmNNazIxZMVoRkbgJYRjyg= +go.opentelemetry.io/collector/client v1.13.0 h1:I0GzZPcOG+F6BY46SgsdcpCN+L0xPfjzTRN2Y4Etdrw= +go.opentelemetry.io/collector/client v1.13.0/go.mod h1:GOE/UvRdklwPCqYLRUOSiU/syl1BGQWa48ex7OGOq9Y= go.opentelemetry.io/collector/component v0.107.1-0.20240816132030-9fd84668bb02 h1:LLWhq5h/z7JdxeMIqKs49oc+xd+7oyqpnbgfFAw1L9c= go.opentelemetry.io/collector/component v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:dJbbK7+PLB4qvX1pboKyBnpRimGCV4qFJemPiLO4rdo= go.opentelemetry.io/collector/component/componentstatus v0.0.0-20240731165531-6d32c09daf9f h1:VuVQ+G0e7HqXTFoGbLfyXUnX2+6dieyxNNE8ITJrBX8= go.opentelemetry.io/collector/component/componentstatus v0.0.0-20240731165531-6d32c09daf9f/go.mod h1:og4XLcnY0wAMtUK+xd2ZFexQnH5Io3AhJx0SPQLmv2Q= +go.opentelemetry.io/collector/config/configauth v0.107.0 h1:2rAoMJjSfdP+ao5i7Ku68QYW5p0jjZ9y6a0nj3cIFp0= +go.opentelemetry.io/collector/config/configauth v0.107.0/go.mod h1:IQx5BBZRoyPX9Qr3W4Ajy/4AnyJZb6jylI4rITrZMHQ= +go.opentelemetry.io/collector/config/configcompression v1.13.0 h1:2LApl3qDZgjsVblY1Qu0gJaw9ZyYnZ6ZDUvid9rCZVg= +go.opentelemetry.io/collector/config/configcompression v1.13.0/go.mod h1:6+m0GKCv7JKzaumn7u80A2dLNCuYf5wdR87HWreoBO0= +go.opentelemetry.io/collector/config/configgrpc v0.107.1-0.20240816132030-9fd84668bb02 h1:tW6H8TM8DEGaVExecQw2ElTPwrqJJ0t+pLB5QDRb6gE= +go.opentelemetry.io/collector/config/configgrpc v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:2K1RbABWTrHAWm7Qw5pw/rjRxY931s1TQQj/YbA9uwg= +go.opentelemetry.io/collector/config/confignet v0.107.0 h1:epggoJD6q17Vd3KFtOv3HgdvGfLR1AePxS2U4alLwmw= +go.opentelemetry.io/collector/config/confignet v0.107.0/go.mod h1:pfOrCTfSZEB6H2rKtx41/3RN4dKs+X2EKQbw3MGRh0E= +go.opentelemetry.io/collector/config/configopaque v1.13.0 h1:EDB9JIifmBth1z9IsEduoE1bT1Q8jV0sR005EMW7q1w= +go.opentelemetry.io/collector/config/configopaque v1.13.0/go.mod h1:0xURn2sOy5j4fbaocpEYfM97HPGsiffkkVudSPyTJlM= go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02 h1:qpoImoLfVpZfND+o2qKJ0hib15yTF7mnjKBnS8O+cKQ= go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/config/configtls v1.13.0 h1:N57vOibMIPX9YZq4ZLFjj5ZjUHMYW7bpkPkygU3vt8w= +go.opentelemetry.io/collector/config/configtls v1.13.0/go.mod h1:3CBJYFQYTCYIPJMRvzn3NVtasv8out21ZNXkSCPepuY= +go.opentelemetry.io/collector/config/internal v0.107.0 h1:aENT1bVin8HCHZuKXc8U1sTYalzl6+RpOMDWpt+VoCQ= +go.opentelemetry.io/collector/config/internal v0.107.0/go.mod h1:2LQPVQPDeIyXN6AXazlls1M0zmlhIM7q80V4K7mQ6PM= go.opentelemetry.io/collector/confmap v0.107.1-0.20240816132030-9fd84668bb02 h1:ebDK+CmU+bGm5T/hAao09vxc4SG6+qQgSuRvDGjzFyY= go.opentelemetry.io/collector/confmap v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:3ybd6KEP2x4PcfFhrrEX86b4Y9dk6uBgFgMgK1Rc+aE= +go.opentelemetry.io/collector/consumer v0.107.0 h1:fF/+xyv9BfXQUvuJqkljrpzKyBQExDQt6zB5rzGyuHs= +go.opentelemetry.io/collector/consumer v0.107.0/go.mod h1:wgWpFes9sbnZ11XeJPSeutU8GJx6dT/gzSUqHpaZZQA= go.opentelemetry.io/collector/extension v0.107.1-0.20240816132030-9fd84668bb02 h1:uuTR9a4mj3vPboCCivieIYa4FMfvyo+ZyqEGF1h6jkY= go.opentelemetry.io/collector/extension v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:eH5yJAfY31Bb4x92siOxf/YVgjurqfAStDkMwlHgFZs= +go.opentelemetry.io/collector/extension/auth v0.107.0 h1:xv+MI9ce8RG1UP4XihTaPR3pCKVvKOl2iIyFqYa0bvE= +go.opentelemetry.io/collector/extension/auth v0.107.0/go.mod h1:tFMzaKaUAx3eWpp3lOLZ8OcLbryydyof9+GCvCWmKmU= go.opentelemetry.io/collector/featuregate v1.13.1-0.20240816132030-9fd84668bb02 h1:ZoCqkkOcfTJW7nd6hNF+cTD2cVSn48/OA4sgQVkxnhM= go.opentelemetry.io/collector/featuregate v1.13.1-0.20240816132030-9fd84668bb02/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/collector/internal/globalgates v0.107.1-0.20240816132030-9fd84668bb02 h1:syCCE97HFHcsgfDVCfRGj0CI1Uwky7rqbUWhTOAtD5A= go.opentelemetry.io/collector/internal/globalgates v0.107.1-0.20240816132030-9fd84668bb02/go.mod h1:7IA1qlvv7qJ9ykanv1lIdjrkS+yL/ugOrr9Rgxb7lwU= go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02 h1:ZWKffCXPwEjYkfoDPCVLHEBdHrFyD/ZcMc4nbCmYkFU= go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02/go.mod h1:z1dTjwwtcoXxZx2/nkHysjxMeaxe9pEmYTEr4SMNIx8= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0 h1:F25VZrEkSaneIBNcNI9LEBWf9nRC/WHKluSBTP0gKAA= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0/go.mod h1:1GrwsKtgogRCt8aG/0lfJ037yDdFtYqF+OtJr+snxRQ= +go.opentelemetry.io/collector/pdata/testdata v0.107.0 h1:02CqvJrYjkrBlWDD+6yrByN1AhG2zT61OScLPhyyMwU= +go.opentelemetry.io/collector/pdata/testdata v0.107.0/go.mod h1:bqaeiDH1Lc5DFJXvjVHwO50x00TXj+oFre+EbOVeZXs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/exporters/prometheus v0.50.0 h1:2Ewsda6hejmbhGFyUvWZjUThC98Cf8Zy6g0zkIimOng= From 630f1ce24ac4853bcf0eae9156f0f52a7d654d54 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 3 Sep 2024 10:04:04 -0700 Subject: [PATCH 33/35] Fixed go.mod --- .../solarwindsapmsettingsextension/go.mod | 15 ++++++- .../solarwindsapmsettingsextension/go.sum | 40 ++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index a2d10108da95..cf39f31e815c 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -7,6 +7,7 @@ require ( github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee + go.opentelemetry.io/collector/config/configgrpc v0.108.1 go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee go.uber.org/goleak v1.3.0 @@ -38,9 +39,21 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.56.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect + go.opentelemetry.io/collector v0.108.1 // indirect + go.opentelemetry.io/collector/client v1.14.1 // indirect go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/configauth v0.108.1 // indirect + go.opentelemetry.io/collector/config/configcompression v1.14.1 // indirect + go.opentelemetry.io/collector/config/confignet v0.108.1 // indirect + go.opentelemetry.io/collector/config/configopaque v1.14.1 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/configtls v1.14.1 // indirect + go.opentelemetry.io/collector/config/internal v0.108.1 // indirect + go.opentelemetry.io/collector/extension/auth v0.108.1 // indirect + go.opentelemetry.io/collector/featuregate v1.14.1 // indirect go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.51.0 // indirect go.opentelemetry.io/otel/metric v1.29.0 // indirect @@ -51,7 +64,7 @@ require ( golang.org/x/net v0.27.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index 5972bad5dbe7..d5902d241efe 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -21,6 +21,10 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= @@ -63,22 +67,54 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/solarwindscloud/apm-proto v1.0.7 h1:7vJWXKjMwCv4Ej1niRQr8nGKLBoBtDXLMM9p5v7mW+I= github.com/solarwindscloud/apm-proto v1.0.7/go.mod h1:PIMzXc8HpB0ryT4Oci4pUz8F0m1X7Q/hVXkQE4jGv6Y= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector v0.108.1 h1:c3JZU5g5KezDXaMgL7GDFB7ihuLNzXo6eBuaJOmBiDA= +go.opentelemetry.io/collector v0.108.1/go.mod h1:7GL32WiQkZzJjxHstHme9igzYumDsw1hFPep3v1guHQ= +go.opentelemetry.io/collector/client v1.14.1 h1:UiBhFP07YbZlv3fW2D/Xi0DrEMRGw2QB1DLV2JiJEis= +go.opentelemetry.io/collector/client v1.14.1/go.mod h1:a8A6aWydaeiItFzY0zlHO/Q6mLNnZsW0Y/iVxbJsO4A= go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee h1:huxxQgE9nyBcwUtiJaJFTupk0MhXsy8Y3ZclJ0mCREY= go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:Z9M91arav1Mf67csQf2484IMUx5a++4oAlikGM28AoI= go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee h1:SsH8uYXHWWLJRnolMW3i4EisxTkm3AQk16hPcakBvTw= go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:QcQ4vrW+Z04cg7bvVuAufet3piiZv2+0ugWcLeuMfz4= +go.opentelemetry.io/collector/config/configauth v0.108.1 h1:If0hRGyfDbC9Y80CYcLBKeSdY7BXcs98r7gPJlzH5uU= +go.opentelemetry.io/collector/config/configauth v0.108.1/go.mod h1:8P3fOkwwP7k09xaTKmu7MrMgTZmMXtWdUrJQgjhy3a4= +go.opentelemetry.io/collector/config/configcompression v1.14.1 h1:YiNlBSeyDaFWrDPFpMJ7y7XlWYMDV0bh8GwO9ukXNa8= +go.opentelemetry.io/collector/config/configcompression v1.14.1/go.mod h1:pnxkFCLUZLKWzYJvfSwZnPrnm0twX14CYj2ADth5xiU= +go.opentelemetry.io/collector/config/configgrpc v0.108.1 h1:kkG/xQUpSdz1utywrxPD6Ohlw65VxUbyrzXAzNAyWX0= +go.opentelemetry.io/collector/config/configgrpc v0.108.1/go.mod h1:QcI3Q17+Bh2PX0hdgpWzk7S8qLsICoUV1VzLeXHsKOw= +go.opentelemetry.io/collector/config/confignet v0.108.1 h1:gmcJI8136JZ0201v0BfGlHcFBxLNy09mGLPUr+GyfHU= +go.opentelemetry.io/collector/config/confignet v0.108.1/go.mod h1:o3v4joAEjvLwntqexg5ixMqRrU1+Vst+jWuCUaBNgOg= +go.opentelemetry.io/collector/config/configopaque v1.14.1 h1:5xAEa4ld+57xWKdU2gR5/6+rBa7LTCPfShJQFUxN0Zw= +go.opentelemetry.io/collector/config/configopaque v1.14.1/go.mod h1:6zlLIyOoRpJJ+0bEKrlZOZon3rOp5Jrz9fMdR4twOS4= go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee h1:LGoJWO9fANov2zNgtX4uYuH6YI4p+H0I/PbY2S+9wLk= go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/config/configtls v1.14.1 h1:cd5kNvLnIe+GVHUV6Fk6O5fkwS4at8dVCrFo7t0O8kE= +go.opentelemetry.io/collector/config/configtls v1.14.1/go.mod h1:StxglrVWeRIFaqc2hpsF9xSsv2A5MOAx5GhG4WjFuP4= +go.opentelemetry.io/collector/config/internal v0.108.1 h1:Z/U8+UpvGT2DZ64/kp/nlosJgjCkhZ7MaEqQ3QHudyo= +go.opentelemetry.io/collector/config/internal v0.108.1/go.mod h1:tRaaE2CNdXE3lUQcIBGJkdBPSGYY3Taa6DzkWmxmgzk= go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee h1:+AZ6R3DhcUGDVQVya18ZVoZK863f8a1LXhHBq9TKkuw= go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:GrIZ12P/9DPOuTpe2PIS51a0P/ZM6iKtByVee1Uf3+k= +go.opentelemetry.io/collector/consumer v0.108.1 h1:75zHUpIDfgZMp3t9fYdpXXE6/wsBs9DwTZdfwS3+NDI= +go.opentelemetry.io/collector/consumer v0.108.1/go.mod h1:xu2pOTqK+uCFXZWd9RcU8s6sCRwK5GyuP64YuHLMzzA= go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee h1:yuy6iGp41ARpBTR3E0IjwbJNps4me7QBlViAXIT00Xs= go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:0Ialf9Lc/ESknUYJnAeQjGdQvlhLtJav0sv+Eo2xMnU= +go.opentelemetry.io/collector/extension/auth v0.108.1 h1:h1kuC5Lvzxb3LcShUXdVHjh+PpqX/Kpd2ypNObwxH0s= +go.opentelemetry.io/collector/extension/auth v0.108.1/go.mod h1:QLvy/dJdiPEhUbkhqIythMoVnZxmvbzeA2Wnm4oZSgU= +go.opentelemetry.io/collector/featuregate v1.14.1 h1:5jvlRe1b5FqhGsyYtuwrzNhFLthGCfm98b3PsCRgXDA= +go.opentelemetry.io/collector/featuregate v1.14.1/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee h1:vqnRTZckt4i+bGcR+d/LAOAe4nAAs/KkN2L2CTXvW0Q= go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:z1dTjwwtcoXxZx2/nkHysjxMeaxe9pEmYTEr4SMNIx8= +go.opentelemetry.io/collector/pdata/pprofile v0.108.1 h1:/XbunfZ+/jt1+d1p4zM4vZ/AgeaIJsayjYdlN1fV+tk= +go.opentelemetry.io/collector/pdata/pprofile v0.108.1/go.mod h1:/GvG2WcN9Dajlw4QaIOjgz7N32wSfPL3qxJ0BKOcVPo= +go.opentelemetry.io/collector/pdata/testdata v0.108.1 h1:TpBDoBMBYvC/Ibswe3Ec2eof8XrRrEec6+tfnTeTSGk= +go.opentelemetry.io/collector/pdata/testdata v0.108.1/go.mod h1:PdUmBA4yDRD4Wf0fpCyrpdZexz9EDoHBw5Ot4iIUPRs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= go.opentelemetry.io/otel/exporters/prometheus v0.51.0 h1:G7uexXb/K3T+T9fNLCCKncweEtNEBMTO+46hKX5EdKw= @@ -128,8 +164,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= From a55f64e4f44beb1373760785ebb9a5a3db62ef07 Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 3 Sep 2024 10:29:07 -0700 Subject: [PATCH 34/35] Improved indentation --- .../extension.go | 149 +++++++++--------- 1 file changed, 75 insertions(+), 74 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 8f8e68d6af20..0ec7dd130a2c 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -92,89 +92,90 @@ func (extension *solarwindsapmSettingsExtension) Shutdown(_ context.Context) err func refresh(extension *solarwindsapmSettingsExtension, filename string) { extension.telemetrySettings.Logger.Info("time to refresh", zap.String("endpoint", extension.config.ClientConfig.Endpoint)) - if hostname, err := os.Hostname(); err != nil { + hostname, err := os.Hostname() + if err != nil { extension.telemetrySettings.Logger.Error("unable to call os.Hostname()", zap.Error(err)) - } else { - ctx, cancel := context.WithTimeout(context.Background(), grpcContextDeadline) - defer cancel() + return + } + ctx, cancel := context.WithTimeout(context.Background(), grpcContextDeadline) + defer cancel() - request := &collectorpb.SettingsRequest{ - ApiKey: extension.config.Key, - Identity: &collectorpb.HostID{ - Hostname: hostname, - }, - ClientVersion: "2", - } - response, err := extension.client.GetSettings(ctx, request) - if err != nil { - extension.telemetrySettings.Logger.Error("unable to get settings", zap.String("endpoint", extension.config.ClientConfig.Endpoint), zap.Error(err)) - return + request := &collectorpb.SettingsRequest{ + ApiKey: extension.config.Key, + Identity: &collectorpb.HostID{ + Hostname: hostname, + }, + ClientVersion: "2", + } + response, err := extension.client.GetSettings(ctx, request) + if err != nil { + extension.telemetrySettings.Logger.Error("unable to get settings", zap.String("endpoint", extension.config.ClientConfig.Endpoint), zap.Error(err)) + return + } + switch result := response.GetResult(); result { + case collectorpb.ResultCode_OK: + if len(response.GetWarning()) > 0 { + extension.telemetrySettings.Logger.Warn("GetSettings succeed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } - switch result := response.GetResult(); result { - case collectorpb.ResultCode_OK: - if len(response.GetWarning()) > 0 { - extension.telemetrySettings.Logger.Warn("GetSettings succeed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) + var settings []map[string]any + for _, item := range response.GetSettings() { + setting := make(map[string]any) + setting["flags"] = string(item.GetFlags()) + setting["timestamp"] = item.GetTimestamp() + setting["value"] = item.GetValue() + arguments := make(map[string]any) + if value, ok := item.Arguments["BucketCapacity"]; ok { + arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - var settings []map[string]any - for _, item := range response.GetSettings() { - setting := make(map[string]any) - setting["flags"] = string(item.GetFlags()) - setting["timestamp"] = item.GetTimestamp() - setting["value"] = item.GetValue() - arguments := make(map[string]any) - if value, ok := item.Arguments["BucketCapacity"]; ok { - arguments["BucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["BucketRate"]; ok { - arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { - arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { - arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { - arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { - arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) - } - if value, ok := item.Arguments["MetricsFlushInterval"]; ok { - arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxTransactions"]; ok { - arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["MaxCustomMetrics"]; ok { - arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["EventsFlushInterval"]; ok { - arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - if value, ok := item.Arguments["ProfilingInterval"]; ok { - arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) - } - setting["arguments"] = arguments - setting["ttl"] = item.GetTtl() - settings = append(settings, setting) + if value, ok := item.Arguments["BucketRate"]; ok { + arguments["BucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketCapacity"]; ok { + arguments["TriggerRelaxedBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerRelaxedBucketRate"]; ok { + arguments["TriggerRelaxedBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketCapacity"]; ok { + arguments["TriggerStrictBucketCapacity"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) + } + if value, ok := item.Arguments["TriggerStrictBucketRate"]; ok { + arguments["TriggerStrictBucketRate"] = math.Float64frombits(binary.LittleEndian.Uint64(value)) } - if content, err := json.Marshal(settings); err != nil { - extension.telemetrySettings.Logger.Error("unable to marshal setting JSON[] byte from settings", zap.Error(err)) + if value, ok := item.Arguments["MetricsFlushInterval"]; ok { + arguments["MetricsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxTransactions"]; ok { + arguments["MaxTransactions"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["MaxCustomMetrics"]; ok { + arguments["MaxCustomMetrics"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["EventsFlushInterval"]; ok { + arguments["EventsFlushInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + if value, ok := item.Arguments["ProfilingInterval"]; ok { + arguments["ProfilingInterval"] = int32(binary.LittleEndian.Uint32(value)) + } + setting["arguments"] = arguments + setting["ttl"] = item.GetTtl() + settings = append(settings, setting) + } + if content, err := json.Marshal(settings); err != nil { + extension.telemetrySettings.Logger.Error("unable to marshal setting JSON[] byte from settings", zap.Error(err)) + } else { + if err := os.WriteFile(filename, content, 0600); err != nil { + extension.telemetrySettings.Logger.Error("unable to write "+filename, zap.Error(err)) } else { - if err := os.WriteFile(filename, content, 0600); err != nil { - extension.telemetrySettings.Logger.Error("unable to write "+filename, zap.Error(err)) + if len(response.GetWarning()) > 0 { + extension.telemetrySettings.Logger.Warn(filename + " is refreshed (soft disabled)") } else { - if len(response.GetWarning()) > 0 { - extension.telemetrySettings.Logger.Warn(filename + " is refreshed (soft disabled)") - } else { - extension.telemetrySettings.Logger.Info(filename + " is refreshed") - } - extension.telemetrySettings.Logger.Info(string(content)) + extension.telemetrySettings.Logger.Info(filename + " is refreshed") } + extension.telemetrySettings.Logger.Info(string(content)) } - default: - extension.telemetrySettings.Logger.Warn("GetSettings failed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } + default: + extension.telemetrySettings.Logger.Warn("GetSettings failed", zap.String("result", result.String()), zap.String("warning", response.GetWarning())) } } From 33570e16bef1cac2ac7dc190a5f04b353ead74fb Mon Sep 17 00:00:00 2001 From: Jerry Leung Date: Tue, 3 Sep 2024 10:57:40 -0700 Subject: [PATCH 35/35] Fixed collector version from CI/CD error --- .../solarwindsapmsettingsextension/go.mod | 28 +++++----- .../solarwindsapmsettingsextension/go.sum | 56 +++++++++---------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/extension/solarwindsapmsettingsextension/go.mod b/extension/solarwindsapmsettingsextension/go.mod index cf39f31e815c..3a2c38d59f93 100644 --- a/extension/solarwindsapmsettingsextension/go.mod +++ b/extension/solarwindsapmsettingsextension/go.mod @@ -7,7 +7,7 @@ require ( github.com/solarwindscloud/apm-proto v1.0.7 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee - go.opentelemetry.io/collector/config/configgrpc v0.108.1 + go.opentelemetry.io/collector/config/configgrpc v0.108.2-0.20240829190554-7da6b618a7ee go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee go.uber.org/goleak v1.3.0 @@ -40,20 +40,20 @@ require ( github.com/prometheus/common v0.56.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/stretchr/objx v0.5.2 // indirect - go.opentelemetry.io/collector v0.108.1 // indirect + go.opentelemetry.io/collector v0.108.2-0.20240829190554-7da6b618a7ee // indirect go.opentelemetry.io/collector/client v1.14.1 // indirect go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee // indirect - go.opentelemetry.io/collector/config/configauth v0.108.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.14.1 // indirect - go.opentelemetry.io/collector/config/confignet v0.108.1 // indirect - go.opentelemetry.io/collector/config/configopaque v1.14.1 // indirect + go.opentelemetry.io/collector/config/configauth v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/configcompression v1.14.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/confignet v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/configopaque v1.14.2-0.20240829190554-7da6b618a7ee // indirect go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee // indirect - go.opentelemetry.io/collector/config/configtls v1.14.1 // indirect - go.opentelemetry.io/collector/config/internal v0.108.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.108.1 // indirect - go.opentelemetry.io/collector/featuregate v1.14.1 // indirect + go.opentelemetry.io/collector/config/configtls v1.14.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/config/internal v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/extension/auth v0.108.2-0.20240829190554-7da6b618a7ee // indirect + go.opentelemetry.io/collector/featuregate v1.14.2-0.20240829190554-7da6b618a7ee // indirect go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.51.0 // indirect go.opentelemetry.io/otel/metric v1.29.0 // indirect @@ -61,10 +61,10 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect go.opentelemetry.io/otel/trace v1.29.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.27.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/extension/solarwindsapmsettingsextension/go.sum b/extension/solarwindsapmsettingsextension/go.sum index d5902d241efe..44d6edb7ea24 100644 --- a/extension/solarwindsapmsettingsextension/go.sum +++ b/extension/solarwindsapmsettingsextension/go.sum @@ -73,48 +73,48 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/collector v0.108.1 h1:c3JZU5g5KezDXaMgL7GDFB7ihuLNzXo6eBuaJOmBiDA= -go.opentelemetry.io/collector v0.108.1/go.mod h1:7GL32WiQkZzJjxHstHme9igzYumDsw1hFPep3v1guHQ= +go.opentelemetry.io/collector v0.108.2-0.20240829190554-7da6b618a7ee h1:qwS5eXqdHQ8/H6adgQXaqYNv/lco6F7Xl7keuwQ+pWA= +go.opentelemetry.io/collector v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:XhZ6xcWvPeAAqp++6tVqvSphaaAs5loWzolvEjLMkUk= go.opentelemetry.io/collector/client v1.14.1 h1:UiBhFP07YbZlv3fW2D/Xi0DrEMRGw2QB1DLV2JiJEis= go.opentelemetry.io/collector/client v1.14.1/go.mod h1:a8A6aWydaeiItFzY0zlHO/Q6mLNnZsW0Y/iVxbJsO4A= go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee h1:huxxQgE9nyBcwUtiJaJFTupk0MhXsy8Y3ZclJ0mCREY= go.opentelemetry.io/collector/component v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:Z9M91arav1Mf67csQf2484IMUx5a++4oAlikGM28AoI= go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee h1:SsH8uYXHWWLJRnolMW3i4EisxTkm3AQk16hPcakBvTw= go.opentelemetry.io/collector/component/componentstatus v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:QcQ4vrW+Z04cg7bvVuAufet3piiZv2+0ugWcLeuMfz4= -go.opentelemetry.io/collector/config/configauth v0.108.1 h1:If0hRGyfDbC9Y80CYcLBKeSdY7BXcs98r7gPJlzH5uU= -go.opentelemetry.io/collector/config/configauth v0.108.1/go.mod h1:8P3fOkwwP7k09xaTKmu7MrMgTZmMXtWdUrJQgjhy3a4= -go.opentelemetry.io/collector/config/configcompression v1.14.1 h1:YiNlBSeyDaFWrDPFpMJ7y7XlWYMDV0bh8GwO9ukXNa8= -go.opentelemetry.io/collector/config/configcompression v1.14.1/go.mod h1:pnxkFCLUZLKWzYJvfSwZnPrnm0twX14CYj2ADth5xiU= -go.opentelemetry.io/collector/config/configgrpc v0.108.1 h1:kkG/xQUpSdz1utywrxPD6Ohlw65VxUbyrzXAzNAyWX0= -go.opentelemetry.io/collector/config/configgrpc v0.108.1/go.mod h1:QcI3Q17+Bh2PX0hdgpWzk7S8qLsICoUV1VzLeXHsKOw= -go.opentelemetry.io/collector/config/confignet v0.108.1 h1:gmcJI8136JZ0201v0BfGlHcFBxLNy09mGLPUr+GyfHU= -go.opentelemetry.io/collector/config/confignet v0.108.1/go.mod h1:o3v4joAEjvLwntqexg5ixMqRrU1+Vst+jWuCUaBNgOg= -go.opentelemetry.io/collector/config/configopaque v1.14.1 h1:5xAEa4ld+57xWKdU2gR5/6+rBa7LTCPfShJQFUxN0Zw= -go.opentelemetry.io/collector/config/configopaque v1.14.1/go.mod h1:6zlLIyOoRpJJ+0bEKrlZOZon3rOp5Jrz9fMdR4twOS4= +go.opentelemetry.io/collector/config/configauth v0.108.2-0.20240829190554-7da6b618a7ee h1:8awSw1sSS0lwNhf6JVhKTFU8tZSaoZpkLH+VQjKnDs0= +go.opentelemetry.io/collector/config/configauth v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:9pjyjXeKrAqvaSrQaQP4vQc2gVKSOtzDrpLasSJp9qk= +go.opentelemetry.io/collector/config/configcompression v1.14.2-0.20240829190554-7da6b618a7ee h1:M9tUkFU3D2/jihM/ZwdsMfoHbKo5t8h2ZajZqQ43VbA= +go.opentelemetry.io/collector/config/configcompression v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:pnxkFCLUZLKWzYJvfSwZnPrnm0twX14CYj2ADth5xiU= +go.opentelemetry.io/collector/config/configgrpc v0.108.2-0.20240829190554-7da6b618a7ee h1:aMtB+FFvK+v7+678+GP4Yq7XyQBjuhxgg+K829J3xUk= +go.opentelemetry.io/collector/config/configgrpc v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:kC5PDeUe/Y9pCelH89ma7qhTTcb785CKL90liy1MaZ8= +go.opentelemetry.io/collector/config/confignet v0.108.2-0.20240829190554-7da6b618a7ee h1:/7J6WuiDLjMN9CKIbYqsw9Y99YJ+QcERcsZAvUWxyWI= +go.opentelemetry.io/collector/config/confignet v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:o3v4joAEjvLwntqexg5ixMqRrU1+Vst+jWuCUaBNgOg= +go.opentelemetry.io/collector/config/configopaque v1.14.2-0.20240829190554-7da6b618a7ee h1:Rg4HrJ2Lu9W4NNvkDLJwmOWJO45u9ucKcQ/G2erVapU= +go.opentelemetry.io/collector/config/configopaque v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:6zlLIyOoRpJJ+0bEKrlZOZon3rOp5Jrz9fMdR4twOS4= go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee h1:LGoJWO9fANov2zNgtX4uYuH6YI4p+H0I/PbY2S+9wLk= go.opentelemetry.io/collector/config/configtelemetry v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= -go.opentelemetry.io/collector/config/configtls v1.14.1 h1:cd5kNvLnIe+GVHUV6Fk6O5fkwS4at8dVCrFo7t0O8kE= -go.opentelemetry.io/collector/config/configtls v1.14.1/go.mod h1:StxglrVWeRIFaqc2hpsF9xSsv2A5MOAx5GhG4WjFuP4= -go.opentelemetry.io/collector/config/internal v0.108.1 h1:Z/U8+UpvGT2DZ64/kp/nlosJgjCkhZ7MaEqQ3QHudyo= -go.opentelemetry.io/collector/config/internal v0.108.1/go.mod h1:tRaaE2CNdXE3lUQcIBGJkdBPSGYY3Taa6DzkWmxmgzk= +go.opentelemetry.io/collector/config/configtls v1.14.2-0.20240829190554-7da6b618a7ee h1:gwOJQiT5+tWB66lwp5nrUrBj67pa0o2N+KNLgfZvngg= +go.opentelemetry.io/collector/config/configtls v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:StxglrVWeRIFaqc2hpsF9xSsv2A5MOAx5GhG4WjFuP4= +go.opentelemetry.io/collector/config/internal v0.108.2-0.20240829190554-7da6b618a7ee h1:trfNlCLq8bycjsdvB6GmoELDf34aFA2G7eOARIberTo= +go.opentelemetry.io/collector/config/internal v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:tRaaE2CNdXE3lUQcIBGJkdBPSGYY3Taa6DzkWmxmgzk= go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee h1:+AZ6R3DhcUGDVQVya18ZVoZK863f8a1LXhHBq9TKkuw= go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:GrIZ12P/9DPOuTpe2PIS51a0P/ZM6iKtByVee1Uf3+k= go.opentelemetry.io/collector/consumer v0.108.1 h1:75zHUpIDfgZMp3t9fYdpXXE6/wsBs9DwTZdfwS3+NDI= go.opentelemetry.io/collector/consumer v0.108.1/go.mod h1:xu2pOTqK+uCFXZWd9RcU8s6sCRwK5GyuP64YuHLMzzA= go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee h1:yuy6iGp41ARpBTR3E0IjwbJNps4me7QBlViAXIT00Xs= go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:0Ialf9Lc/ESknUYJnAeQjGdQvlhLtJav0sv+Eo2xMnU= -go.opentelemetry.io/collector/extension/auth v0.108.1 h1:h1kuC5Lvzxb3LcShUXdVHjh+PpqX/Kpd2ypNObwxH0s= -go.opentelemetry.io/collector/extension/auth v0.108.1/go.mod h1:QLvy/dJdiPEhUbkhqIythMoVnZxmvbzeA2Wnm4oZSgU= -go.opentelemetry.io/collector/featuregate v1.14.1 h1:5jvlRe1b5FqhGsyYtuwrzNhFLthGCfm98b3PsCRgXDA= -go.opentelemetry.io/collector/featuregate v1.14.1/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= +go.opentelemetry.io/collector/extension/auth v0.108.2-0.20240829190554-7da6b618a7ee h1:w6Y6lOz9HRkl0rjdxmlqp209tvtWIaXOUqYH4YqTY1s= +go.opentelemetry.io/collector/extension/auth v0.108.2-0.20240829190554-7da6b618a7ee/go.mod h1:CmNrylNxbrs/awKHOdRWdu5BMAUxXyY94ry9LrKH/tQ= +go.opentelemetry.io/collector/featuregate v1.14.2-0.20240829190554-7da6b618a7ee h1:kOnDlEC1EDsymDjAZe8LZhwbVqnWPtPwSlUXDYwUmws= +go.opentelemetry.io/collector/featuregate v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee h1:vqnRTZckt4i+bGcR+d/LAOAe4nAAs/KkN2L2CTXvW0Q= go.opentelemetry.io/collector/pdata v1.14.2-0.20240829190554-7da6b618a7ee/go.mod h1:z1dTjwwtcoXxZx2/nkHysjxMeaxe9pEmYTEr4SMNIx8= go.opentelemetry.io/collector/pdata/pprofile v0.108.1 h1:/XbunfZ+/jt1+d1p4zM4vZ/AgeaIJsayjYdlN1fV+tk= go.opentelemetry.io/collector/pdata/pprofile v0.108.1/go.mod h1:/GvG2WcN9Dajlw4QaIOjgz7N32wSfPL3qxJ0BKOcVPo= go.opentelemetry.io/collector/pdata/testdata v0.108.1 h1:TpBDoBMBYvC/Ibswe3Ec2eof8XrRrEec6+tfnTeTSGk= go.opentelemetry.io/collector/pdata/testdata v0.108.1/go.mod h1:PdUmBA4yDRD4Wf0fpCyrpdZexz9EDoHBw5Ot4iIUPRs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= go.opentelemetry.io/otel/exporters/prometheus v0.51.0 h1:G7uexXb/K3T+T9fNLCCKncweEtNEBMTO+46hKX5EdKw= @@ -142,8 +142,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -154,8 +154,8 @@ golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -164,8 +164,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=