Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Alerts v3 Types not included in published cxsdk package #111

Closed
dylanjustice opened this issue Dec 10, 2024 · 8 comments
Closed

[Bug]: Alerts v3 Types not included in published cxsdk package #111

dylanjustice opened this issue Dec 10, 2024 · 8 comments

Comments

@dylanjustice
Copy link

Expected Result

A lot of the generated types required for the Alerts v3 api are undefined in the cxsdk package that is published to pkg.go.dev.
Using the CreateAlert example verbatim in my workspace yields UndeclaredImportedName errors in my compiler. Is it possible the package is not publishing with recent changes?
Or am I using an SDK that's simply not ready?

	createRequest := &cxsdk.CreateAlertRequest{
		AlertDefProperties: &cxsdk.AlertDefProperties{
			Name:              wrapperspb.String(*currentModel.AlertName),
			Description:       wrapperspb.String(*currentModel.AlertDescription),
			Enabled:           wrapperspb.Bool(true),                 //TODO: Parameter
			Priority:          cxsdk.AlertDefPriorityP3,              // TODO: Parameter
			AlertDefType:      cxsdk.AlertDefTypeMetricMoreThanUsual, //TODO: Parameter
			TypeDefinition:    nil,                                   // Not available through cxsdk
			IncidentsSettings: nil,                                   // Not available through cxsdk
			NotificationGroup: nil,                                   // Not available through cxsdk
		},
	}

Actual Result

undefined: cxsdk.AlertDefWebhooksSettingscompiler[UndeclaredImportedName](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredImportedName)

undefined: cxsdk.AlertDefWebhooksSettingsMinutescompiler[UndeclaredImportedName](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredImportedName)

unknown field Webhooks in struct literal of type "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/alerts/v3".AlertDefNotificationGroupcompiler[MissingLitField](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#MissingLitField)

The list goes on.

Relevant log output

No response

@celaus
Copy link
Contributor

celaus commented Dec 11, 2024

Hi! yes you are right, there has been a lot of development happening without publishing. We'll get a new version out asap.

@alt-dima
Copy link

We also miss types :(
For example

cxsdk.DataprimeQueryMetadata{
			Tier:     nil ,// Not available through cxsdk field Tier *v1.Metadata_Tier 
			Syntax:     nil ,// Not available through cxsdk field Syntax *v1.Metadata_QuerySyntax 
		},

@celaus
Copy link
Contributor

celaus commented Dec 18, 2024

Let me know what else you are missing :)

@dylanjustice
Copy link
Author

For the record... updating your toolchain to 1.23.4 and pulling v0.12.1 from github is a valid workaround. I didn't realize I needed to update Go 🤦

@alt-dima
Copy link

@celaus Hi! Sorry, maybe not directly related to missing types. But missing some information how to use API.
For example, I'm trying to get a list of the Alerts by specific labels/tags. I thought to specify filter (list of labels/tags) in ListAlertDefsRequest

	api := cxsdk.NewAlertsClient(Creator)

	resp, err := api.List(ctx, &cxsdk.ListAlertDefsRequest{})
	if err != nil {
		return resp, err
	}
	return resp, nil

but in type ListAlertDefsRequest I see only

type ListAlertDefsRequest struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields
}

I tried to search ListAlertDefsRequest in proto
https://github.com/coralogix/coralogix-management-sdk/blob/master/proto/com/coralogixapis/alerts/v3/alert_defs_service.proto#L63

  rpc ListAlertDefs(ListAlertDefsRequest) returns (ListAlertDefsResponse){
    option (audit_log_description).description = "get alert definitions list";
    option (google.api.http) = {
      get: "/v3/alert-defs"
      body: "*"
    };
  }

Which means I can't set any parameters/filters for list?

@dylanjustice
Copy link
Author

Thanks for updating the package. Maybe I'm missing something now. But I get a namespace collision error in v0.12.1

panic: proto: extension number 5000 is already registered on message google.protobuf.MethodOptions
                previously from: "github.com/coralogix/coralogix-management-sdk/go/internal/coralogix/common/v1"
                currently from:  "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/apm/common/v2"
        See https://protobuf.dev/reference/go/faq#namespace-conflict

@celaus
Copy link
Contributor

celaus commented Dec 19, 2024

Yes the Alerts API doesn't provide a direct filtering ability, so you'll have to do it manually (unfortunately). However I'll take this in as a feature request 😄

-ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn add that flag and the linking should work. It's a temporary workaround until we remove all the duplicate extensions ...

@celaus
Copy link
Contributor

celaus commented Jan 8, 2025

I'm closing this, reopen in case of more questions 👍

@celaus celaus closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants