diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d0b7c..53b159c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.24.0 (Apr 12, 2024) + +IMPROVEMENTS: + +* Fix typo in provider metadata type name +* Improve error checking on applyTelemetry() + ## 1.23.0 (Apr 11, 2024) IMPROVEMENTS: diff --git a/util/sdk/sdk.go b/util/sdk/sdk.go index e58cd6b..c67ebcf 100644 --- a/util/sdk/sdk.go +++ b/util/sdk/sdk.go @@ -182,8 +182,11 @@ func applyTelemetry(productId, resource, verb string, f func(context.Context, *s } return func(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { // best effort. Go routine it - featureUsage := fmt.Sprintf("Resource/%s/%s", resource, verb) - go util.SendUsage(ctx, meta.(util.ProvderMetadata).Client, productId, featureUsage) + if m, ok := meta.(util.ProviderMetadata); ok { + featureUsage := fmt.Sprintf("Resource/%s/%s", resource, verb) + go util.SendUsage(ctx, m.Client, productId, featureUsage) + } + return f(ctx, data, meta) } } diff --git a/util/util.go b/util/util.go index beb543c..3bc2223 100644 --- a/util/util.go +++ b/util/util.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" ) -type ProvderMetadata struct { +type ProviderMetadata struct { Client *resty.Client ProductId string ArtifactoryVersion string