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

one PullStackFromRregistry call creates 3 events in telemetry #933

Closed
kadel opened this issue Sep 20, 2022 · 2 comments
Closed

one PullStackFromRregistry call creates 3 events in telemetry #933

kadel opened this issue Sep 20, 2022 · 2 comments
Assignees
Labels
area/library Common devfile library for interacting with devfiles area/registry Devfile registry for stacks and infrastructure area/telemetry telemetry related issues kind/bug Something isn't working

Comments

@kadel
Copy link
Member

kadel commented Sep 20, 2022

/kind bug

Which area this bug is related to?

/area library
/area registry

What versions of software are you using?

registry library version 36887a7907aa

Bug Summary

Using PullStackFromRregistry function from github.com/devfile/registry-support/registry-library/library to pull devfiles from the registry creates 3 events (two download devfile and one list devfile) in the telemetry.

package main

import (
	"github.com/devfile/registry-support/registry-library/library"
)

func main() {
	td := library.TelemetryData{
		Client: "test-staging",
	}
	opts := library.RegistryOptions{
		Telemetry: td,
	}
	library.PullStackFromRegistry("https://registry.devfile.io", "nodejs-vue", ".", opts)
}

events recorded when the above call executed

client.Track(&analytics.Track{
  UserId: "test-staging",
  Event: "list devfile",
  Properties: map[string]interface{}{
    "client": "test-staging",
    "registry": "devfile-community-registry",
    "type": "stack",
  },
})
client.Track(&analytics.Track{
  UserId: "test-staging",
  Event: "download devfile",
  Properties: map[string]interface{}{
    "client": "test-staging",
    "name": "nodejs-vue",
    "registry": "devfile-community-registry",
  },
})
client.Track(&analytics.Track{
  UserId: "test-staging",
  Event: "download devfile",
  Properties: map[string]interface{}{
    "client": "test-staging",
    "name": "nodejs-vue",
    "registry": "devfile-community-registry",
  },
})

Expected behavior

I would expect that calling PullStackFromRegistry creates just one download devfile event and nothing else

Target Date: 2022-11-04

@openshift-ci openshift-ci bot added kind/bug Something isn't working area/library Common devfile library for interacting with devfiles area/registry Devfile registry for stacks and infrastructure labels Sep 20, 2022
@kim-tsao kim-tsao self-assigned this Sep 20, 2022
@kim-tsao kim-tsao added the area/telemetry telemetry related issues label Oct 3, 2022
@kim-tsao
Copy link
Contributor

kim-tsao commented Nov 1, 2022

The List Devfile call is due to the fact that a request is made in the PullStackFromRegistry function to retrieve the registry index. Since this is an internal call, I can add an identifier to ensure those events get filtered out.

The two download events are expected because our stacks have 2 resources; an archive and an devfile.yaml
see https://registry.devfile.io/index

"resources": [
  "archive.tar",
  "devfile.yaml"
],

When we make an oras call to copy the content, it goes through each supported media type and retrieves the associated resource which results in 2 download requests but the archive.tar does not contain anything useful (just the OWNERS file). I can filter out this file so an archive does not get created from it. That way, the stacks will only have the one devfile.yaml resource.

@kim-tsao
Copy link
Contributor

kim-tsao commented Nov 7, 2022

Fix is now in production. I verified I only see one download event using the test snippet above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/library Common devfile library for interacting with devfiles area/registry Devfile registry for stacks and infrastructure area/telemetry telemetry related issues kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants