Skip to content

Commit

Permalink
Fix variable name typo
Browse files Browse the repository at this point in the history
Improve type checking for applyTelemetry
  • Loading branch information
alexhung committed Apr 12, 2024
1 parent 2b44cca commit 9d31601
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 5 additions & 2 deletions util/sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d31601

Please sign in to comment.