azure-sdk-for-go: Getting the next page of the activity logs fails with invalid semicolon separator in query

Bug Report

  • import path of package in question: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor
  • SDK version: latest (github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0)
  • output of go version:
go version go1.22.0 linux/amd64
  • What happened?

When fetching the activity logs in some subscriptions, the code errors out with the following message:

invalid semicolon separator in query

Our code (minimized) looks like this:

        query := fmt.Sprintf("eventTimestamp ge '%s' and eventTimestamp le '%s'", startTime.Format(time.RFC3339Nano), endTime.Format(time.RFC3339Nano))
	pager := clientFactory.NewActivityLogsClient().NewListPager(query, nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			return nil, fmt.Errorf("failed to advance page: %w", err) << this is where it fails
		}
       }
  • What did you expect or want to happen?

Get the logs, as in other subs.

  • How can we reproduce it?

idk, check if you can fetch activity logs on all subs.

Additional info

a screenshot from debugging:

image

A similar error happens when using a semicolon in a query, see: https://github.com/golang/go/issues/50034

my guess is: the content of the *NextLink can’t be parsed in some / all cases.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 28 (8 by maintainers)

Most upvoted comments

i got the link from debugging with delve:

https://management.azure.com/subscriptions/$$$subscriptionID$$$/providers/Microsoft.Insights/eventtypes/management/values?%24filter=eventTimestamp+ge+%272024-02-19T04%3A05%3A37Z%27+and+eventTimestamp+le+%272024-02-20T16%3A05%3A37Z%27&api-version=2015-04-01&$skipToken=hoboshim~sbs~querymodeint9;diffreport1;queryutcnow:0638440419441225639;workspaceids:c4e1bdb5-8f3d-44a4-8a25-56924af57454~96dfd74e-3fe7-41ec-a72e-4e1b0d4ad6e7;sessionidf53b1a47-d12e-488d-885b-12c2a395f835;page1;hobo:0638440358902794048~0638440418436268230~0638439151240566239~1~0638440354570000000~1296~94~133~234~0~62~85~2~0~0~20~74~52~95~14~28~54~58~50~30~0~0~2~0~0~2~0~0~2~0~0~2~0~2~2~0~0~2~0~0~2~0~0~2~0~0~2~0~0~4~0~0~0~2~0~0~0~6~0~0~2~0~0~3~0~0~4~42~0~2~2~30~219~163~18~256~0~2~0~14~2~0~0~127~78~139~7~8~0~12~0~0~2~0~0~2~sbs~laqs~sbs~

it seems like a new issue arose yesterday: the data model changed yesterday at around 10 pm CET.

Instead of the semicolon error, the lib now can’t unmarshal the data in the response.

unmarshalling type *armmonitor.EventDataCollection: unmarshalling type *armmonitor.EventDataCollection: struct field Value: unmarshalling type *armmonitor.EventData: struct field Level: json: cannot unmarshal number into Go value of type armmonitor.EventLevel

Will update this comment, once I found out more.

UPDATE:

In constants.go the EventLevel is defined as a string and has some consts defined:

// EventLevel - the event level
type EventLevel string

const (
	EventLevelCritical      EventLevel = "Critical"
	EventLevelError         EventLevel = "Error"
	EventLevelInformational EventLevel = "Informational"
	EventLevelVerbose       EventLevel = "Verbose"
	EventLevelWarning       EventLevel = "Warning"
)

seems like the API returns a number instead of one of the expected strings.

The service shouldn’t be returning EventLevel by its ordinal value. We’re following up on this.

For the semicolons in the query params, we’ll have this fixed in azcore@v1.10.0 which will be released soon.

what region are you in? can you share some more details? the fix was deployed world wide. please send me an email and ill try to assist. orens@microsoft.com

@osalzberg The issue still persists. When will this be resolved?

a fix should be deployed in the next 1-2 days

I found the same issue. When will it be fixed?

+1 I am also getting the same error as of yesterday.

unmarshalling type *armmonitor.EventDataCollection: unmarshalling type *armmonitor.EventDataCollection: struct field Value: unmarshalling type *armmonitor.EventData: struct field Level: json: cannot unmarshal number into Go value of type armmonitor.EventLevel

Edit: Seems like a high severity breakage. I have production applications that rely on being able to consume and process monitor events for customers.