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

niko/go-sdk-docs #553

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

niko/go-sdk-docs #553

wants to merge 7 commits into from

Conversation

nikomancy
Copy link
Contributor

What?

Moving the Go docs into the format similar to what we have for node.

Why?

  • The goal is to make the learning journey for engineers working with specific SDKs easier.
  • Content is easier to find in the TOC, improving navigability.
  • Code samples for typed examples have been added for ease of use.
  • Boilerplate prose docs have been added to allow engineers to learn about relevant conceptual information alongside the code without having to context switch to other parts of the docs.

Review instructions

  • Code samples were created through inference and need to be validated.

Todo before merge

  • Update redirects
  • Delete go.md

 On branch niko/go-to-new-template
 Changes to be committed:
	new file:   docs/sdks/server-sdks/go/_category_.json
	new file:   docs/sdks/server-sdks/go/assignments.mdx
	new file:   docs/sdks/server-sdks/go/bandits.mdx
	new file:   docs/sdks/server-sdks/go/initialization.mdx
	new file:   docs/sdks/server-sdks/go/intro.mdx
	new file:   docs/sdks/server-sdks/go/quickstart.mdx
Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for eppo-data-docs ready!

Name Link
🔨 Latest commit 1164202
🔍 Latest deploy log https://app.netlify.com/sites/eppo-data-docs/deploys/6784a5cd22fe1f0008030151
😎 Deploy Preview https://deploy-preview-553--eppo-data-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

docs/sdks/server-sdks/go/quickstart.mdx Outdated Show resolved Hide resolved
Comment on lines +31 to +39
import (
"github.com/eppo-exp/eppo-go-sdk/eppo"
)

config := eppo.NewConfig("<SDK-KEY>")
client, err := eppo.Init(config)
if err != nil {
log.Fatal("Failed to initialize Eppo client:", err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

🐛 This example is off. The one in initialization section is correct

Comment on lines +100 to +112
type MyLogger struct{}

func (l *MyLogger) LogAssignment(assignment *eppo.Assignment) error {
// Replace with your logging logic
log.Printf("Logging assignment: %+v", assignment)
return nil
}

config := eppo.NewConfig(
"<SDK-KEY>",
eppo.WithAssignmentLogger(&MyLogger{}),
)
client, err := eppo.Init(config)
Copy link
Collaborator

@rasendubi rasendubi Dec 19, 2024

Choose a reason for hiding this comment

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

🐛 same here. Go SDK doesn't have NewConfig. See examples in initialization section

docs/sdks/server-sdks/go/quickstart.mdx Outdated Show resolved Hide resolved
docs/sdks/server-sdks/go/quickstart.mdx Outdated Show resolved Hide resolved
docs/sdks/server-sdks/go/bandits.mdx Outdated Show resolved Hide resolved
docs/sdks/server-sdks/go/bandits.mdx Outdated Show resolved Hide resolved

The `result` is an instance of `BanditResult`, which has two fields:
- `Variation` (string): The variation that was assigned to the subject
- `Action` (string): The action that was assigned to the subject (empty string if no action was assigned)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- `Action` (string): The action that was assigned to the subject (empty string if no action was assigned)
- `Action` (`*string`): The action that was assigned to the subject (`nil` if no action was assigned)


The variation returns the feature flag variation, this can be the bandit itself, or the "status quo" variation if the user is not assigned to the bandit.
If we are unable to generate a variation, for example when the flag is turned off, then the `default` variation is returned.
In both of those cases, the `Action` is an empty string, and you should use the status-quo algorithm to select an action.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
In both of those cases, the `Action` is an empty string, and you should use the status-quo algorithm to select an action.
In both of those cases, the `Action` is nil, and you should use the status-quo algorithm to select an action.

docs/sdks/server-sdks/go/bandits.mdx Outdated Show resolved Hide resolved
nikomancy and others added 3 commits December 19, 2024 08:28
Updating to most recent version for the install instructions.

Co-authored-by: Oleksii Shmalko <[email protected]>
Updating typed assignment list to correct names.

Co-authored-by: Oleksii Shmalko <[email protected]>
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.

3 participants