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

docs: update onboarding steps for Go v3 client #6987

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

karel-rehor
Copy link
Contributor

@karel-rehor karel-rehor commented Dec 13, 2024

Updates the onboarding steps for Go v3 client

Checklist

Authors and Reviewer(s), please verify the following:

  • A PR description, regardless of the triviality of this change, that communicates the value of this PR
  • Well-formatted conventional commit messages that provide context into the change
  • Documentation updated or issue created (provide link to issue/PR)
  • Signed CLA (if not already signed)
  • Feature flagged, if applicable

@karel-rehor karel-rehor requested a review from bednar December 13, 2024 14:10
@bednar bednar removed their request for review December 13, 2024 14:32
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, this looks good, and along with the new API for the client. Great job! 👍

@karel-rehor karel-rehor changed the title docs: update onboarding steps for select v3 clients docs: update onboarding steps for Go v3 client Dec 16, 2024
@karel-rehor
Copy link
Contributor Author

I've decided to go ahead with changes only to GO and will update Java onboarding in another branch. I'd rather we get this part of the UI updated ASAP instead of possibly having it held until January because of 1) Christmas Holidays 2) Unexpected obstacles in updating onboarding for Java.

BTW. Not sure what to do about the monitor-ci-tests and remocal. It seems there is an issue in the underlying system deployment apparently unrelated to these changes.

https://output.circle-artifacts.com/output/job/322ce1ff-e9f2-4414-9ebc-59ed3049eddd/artifacts/0/tests/e2e-remocal/e2e-test-remocal-deploy.log

Time limit has been exceeded. Giving up! Listing status of all pods:

NAME                                                              READY   STATUS             RESTARTS        AGE
annotationd-7b48589d76-n9g4w                                      1/1     Running            1 (8m7s ago)    8m8s
...
gateway-external-meta-595c495797-lw6fr                            0/1     CrashLoopBackOff   6 (107s ago)    8m10s
gateway-external-write-bbc4f748b-x9sj8                            0/1     CrashLoopBackOff   6 (107s ago)    8m11s
gateway-internal-meta-7584495fbf-8dclw                            0/1     CrashLoopBackOff   6 (110s ago)    8m10s
gateway-internal-write-744cf85dc8-89fdh                           0/1     CrashLoopBackOff   6 (2m1s ago)    8m11s
...
redpanda-0                                                        0/1     ImagePullBackOff   0               8m48s
...
storage-0                                                         0/1     CrashLoopBackOff   6 (2m14s ago)   8m11s
storage-1                                                         0/1     CrashLoopBackOff   6 (101s ago)    8m7s
...
Gathering ingress logs
Creating archive

@karel-rehor karel-rehor marked this pull request as ready for review December 16, 2024 09:23
@karel-rehor karel-rehor requested review from a team as code owners December 16, 2024 09:23
@david-rusnak
Copy link
Contributor

Hi @karel-rehor, sorry for the delay on this - I was working on fixing the CI pipeline and I see it has passed the tests now. I'll take a look at this PR in more detail tomorrow. Thank you!

Copy link
Contributor

@david-rusnak david-rusnak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thanks for doing this! I apologize for not getting to this when I said I would, it slipped my mind completely. Similar to the Java onboarding, it would be helpful for a video demonstrating the changes since I noticed some spacing and formatting changes, but it looks good to me otherwise! If the video size limit is an issue here, let me know and I can run the branch locally to see these changes

@@ -48,7 +48,8 @@ export const WriteDataComponent = (props: OwnProps) => {
onSelectBucket(bucket.name)
}, [bucket, onSelectBucket])

const codeSnippet = `org := "${org.name}"
const codeSnippet = `// FOO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the // FOO line is the only thing changed here, is that for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed

"count": 40,
},
}
const writeCodeSnippet = ` data := map[string]map[string]interface{}{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to see what effect this whitespace has on the snippet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instruction is to add this snippet at the end of the main() function in a previous snippet. All together this renders as...

func main() {
    // Create client
    url := "http://localhost:8080"
    token := os.Getenv("INFLUXDB_TOKEN")

    // Create a new client using an InfluxDB server base URL and an authentication token
    client, err := influxdb3.New(influxdb3.ClientConfig{
      Host:  url,
      Token: token,
    })

    if err != nil {
      panic(err)
    }
    // Close client at the end and escalate error if present
    defer func (client *influxdb3.Client)  {
      err := client.Close()
      if err != nil {
        panic(err)
      }
    }(client)

    database := "my-bucket"
    data := map[string]map[string]interface{}{
    "point1": {
      "location": "Klamath",
      "species":  "bees",
      "count":    23,
    },
    "point2": {
      "location": "Portland",
      "species":  "ants",
      "count":    30,
    },
    "point3": {
      "location": "Klamath",
      "species":  "bees",
      "count":    28,
    },
    "point4": {
      "location": "Portland",
      "species":  "ants",
      "count":    32,
    },
    "point5": {
      "location": "Klamath",
      "species":  "bees",
      "count":    29,
    },
    "point6": {
      "location": "Portland",
      "species":  "ants",
      "count":    40,
    },
  }

  // convert data to Points
  points := []*influxdb3.Point{}
  // start time stamp
  stamp := time.Now().Add(time.Duration(len(data)) * time.Second * -1)

  for key := range data {
	  points = append(points,
		  influxdb3.NewPointWithMeasurement("census").
			  SetTag("location", data[key]["location"].(string)).
			  SetIntegerField(data[key]["species"].(string),
				  int64(data[key]["count"].(int))).
			  SetTimestamp(stamp))
	  stamp = stamp.Add(time.Second) // Add a second to the stamp
  }

  // Write data
  fmt.Printf("Writing %d points\n", len(points))  
  if err := client.WritePoints(context.Background(),
	  points,
	  influxdb3.WithDatabase(database)); err != nil {
	    panic(err)
  }
    
}

panic(err)
}
if err != nil {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious about the whitespace here, looks like the number of spaces in a tab has changed, is that maintained across all snippets in the go onboarding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the main() method with all copy-pasted snippets.

func main() {
    // Create client
    url := "http://localhost:8080"
    token := os.Getenv("INFLUXDB_TOKEN")

    // Create a new client using an InfluxDB server base URL and an authentication token
    client, err := influxdb3.New(influxdb3.ClientConfig{
      Host:  url,
      Token: token,
    })

    if err != nil {
      panic(err)
    }
    // Close client at the end and escalate error if present
    defer func (client *influxdb3.Client)  {
      err := client.Close()
      if err != nil {
        panic(err)
      }
    }(client)

    database := "my-bucket"
    data := map[string]map[string]interface{}{
    "point1": {
      "location": "Klamath",
      "species":  "bees",
      "count":    23,
    },
    "point2": {
      "location": "Portland",
      "species":  "ants",
      "count":    30,
    },
    "point3": {
      "location": "Klamath",
      "species":  "bees",
      "count":    28,
    },
    "point4": {
      "location": "Portland",
      "species":  "ants",
      "count":    32,
    },
    "point5": {
      "location": "Klamath",
      "species":  "bees",
      "count":    29,
    },
    "point6": {
      "location": "Portland",
      "species":  "ants",
      "count":    40,
    },
  }

  // convert data to Points
  points := []*influxdb3.Point{}
  // start time stamp
  stamp := time.Now().Add(time.Duration(len(data)) * time.Second * -1)

  for key := range data {
	  points = append(points,
		  influxdb3.NewPointWithMeasurement("census").
			  SetTag("location", data[key]["location"].(string)).
			  SetIntegerField(data[key]["species"].(string),
				  int64(data[key]["count"].(int))).
			  SetTimestamp(stamp))
	  stamp = stamp.Add(time.Second) // Add a second to the stamp
  }

  // Write data
  fmt.Printf("Writing %d points\n", len(points))  
  if err := client.WritePoints(context.Background(),
	  points,
	  influxdb3.WithDatabase(database)); err != nil {
	    panic(err)
  }
  
  // Execute query with parameters
  query := `SELECT *
   FROM 'census'
   WHERE time >= now() - interval '1 hour'
   AND ($species1 IS NOT NULL OR $species2 IS NOT NULL)`

  iterator, err := client.QueryWithParameters(context.Background(),
	  query, influxdb3.QueryParameters{
		  "species1": "bees",
		  "species2": "ants",
	  },
	  influxdb3.WithDatabase(database))

  if err != nil {
	  panic(err)
  }

  val2int := func(v interface{}) int64 {
	  if v == nil {
		  return 0
	  }
	  return v.(int64)
  }
	
  for iterator.Next() {
	  value := iterator.Value()

	  location := value["location"]
	  ants := val2int(value["ants"])
	  bees := val2int(value["bees"])
	  ts := value["time"].(time.Time)
	  fmt.Printf("At %s in %s there were %d ants and %d bees\n", 
	    ts.Format(time.RFC3339), location, ants, bees)
  }
  
    
}

Copy link
Contributor

@wdoconnell wdoconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @karel-rehor - thanks for doing this. This looks good based on my review, as long as the rationale for doing this is the same as in the Go PR: i.e., this is just to update to conform to changes to the influxdb v3 client libraries.

Before we approve this to merge in, could you please add a video confirming we don't end up with any visual artifacts here? Thanks very much.

@karel-rehor
Copy link
Contributor Author

Here is a screen cast of the workflow for this on-boarding update. Not shown is pasting code samples to an IDE, or waiting for response after running writes.

Screencast.from.30-01-25.13.58.10.webm

wdoconnell
wdoconnell previously approved these changes Feb 3, 2025
Copy link
Contributor

@wdoconnell wdoconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now - thanks for posting the video. I noted here #6994 that we need to wait for a moment on an internal fix to our CI pipeline - I will ping you once it has been cleared up.

@wdoconnell
Copy link
Contributor

Hi @karel-rehor - you should be able to rebase / repush and attempt to merge now.

@wdoconnell
Copy link
Contributor

Hi @karel-rehor - checking in to see if you are good to rebase and merge this - thank you.

@karel-rehor
Copy link
Contributor Author

karel-rehor commented Feb 26, 2025

@wdoconnell
I've attempted the rebase and push with force, but now that I'm controlling the results locally with yarn start:dev I'm not seeing the contents of the file homepageExperience/components/steps/go/WriteDataSql.tsx but instead the contents of homepageExperience/components/steps/go/WriteData.tsx. In the IDE I still see the changes I made to WriteDataSql.tsx, but I'm not sure what has changed, that they are not showing up in the dev deployment. I was expecting this to take at most an hour and I have some other more pressing priorities to deal with at the moment. So, I'll come back to this once those are solved.

@karel-rehor
Copy link
Contributor Author

karel-rehor commented Feb 28, 2025

@wdconnell
OK, the issue on Wednesday was that I forgot to set the feature flag ioxOnboarding when reviewing the rebased branch. Once this is set, I see the changes for Iox in the SQL based onboarding steps.

If you could once more give this your review - I removed a commented line in a code snippet caught by @david-rusnak - I think this can be merged.

@wdoconnell
Copy link
Contributor

@karel-rehor - Looks good to merge, feel free to do so. Thank you for updating!

@karel-rehor karel-rehor added this pull request to the merge queue Feb 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 28, 2025
@wdoconnell
Copy link
Contributor

More flake occurred. Going to retry this on Monday a.m., as it's late here. We should be able to pass CI as it was in good condition for #7000. I will give it a look first thing in the am.

@karel-rehor karel-rehor added this pull request to the merge queue Mar 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@wdoconnell
Copy link
Contributor

Getting flake on the scriptQueryBuilder test. We may need to revisit that if it keeps causing issues like this.

@wdoconnell wdoconnell added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 5, 2025
@wdoconnell wdoconnell added this pull request to the merge queue Mar 5, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 5, 2025
* docs: update go-client v3 onboarding steps to reflect v2.0.0 release

* chore: ran prettier:fix

* chore: remove stale test comment
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 5, 2025
@wdoconnell
Copy link
Contributor

wdoconnell commented Mar 5, 2025

@karel-rehor Looking at the cause of the e2e failure I think the interim solution will need to be disabling this flaking test. #7020. I have opened an internal issue to have someone allocate time to have a closer look at the root causes so that the relevant test can be re-enabled. You will need to rebase once #7020 is merged.

@wdoconnell wdoconnell force-pushed the update-onboarding-1 branch from 5ed8e0e to 1b6c45b Compare March 5, 2025 17:44
@wdoconnell wdoconnell enabled auto-merge March 5, 2025 17:44
@wdoconnell
Copy link
Contributor

@karel-rehor Looking at the cause of the e2e failure I think the interim solution will need to be disabling this flaking test. #7020. I have opened an internal issue to have someone allocate time to have a closer look at the root causes so that the relevant test can be re-enabled. You will need to rebase once #7020 is merged.

I have handled the rebase - will add it back to the merge queue now.

@wdoconnell wdoconnell removed the request for review from david-rusnak March 5, 2025 18:34
@wdoconnell wdoconnell disabled auto-merge March 5, 2025 18:34
@wdoconnell wdoconnell enabled auto-merge March 5, 2025 18:35
@wdoconnell wdoconnell force-pushed the update-onboarding-1 branch from 1b6c45b to ccaae67 Compare March 5, 2025 18:36
@wdoconnell wdoconnell force-pushed the update-onboarding-1 branch from ccaae67 to 6223bb8 Compare March 5, 2025 20:11
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

Successfully merging this pull request may close these issues.

5 participants