Skip to content

qingzhuozhen/experiment-go-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

experiment-go-server

Amplitude Experiment SDK for Go.

Documentation

Visit our developer docs site for the full SDK documentation.

Command-line Interface (xpmt)

The xpmt command-line interface tool allows you to make Experiment SDK calls from the command line. This tool is meant to be used for debugging and testing, not for use in production environments.

Build

Makefile currently only builds for macos (amd64 & x64), add a line to the Makefile to support your OS and Architecture.

make xpmt

Run

!!!warning Setting the deployment key All examples below assume the EXPERIMENT_KEY environment variable has been set. Alternatively, use the -k flag to set the key in the command.

Subcommands

  • fetch: fetch variants for a user from the server
  • rules: fetch flag configs (rules) from experiment
  • evaluate: fetch flag configs from experiment and evaluate the user locally

Fetch

Fetch variants via remote evaluation for the given input user.

Usage of fetch:
  -d string
        Device id to fetch variants for.
  -debug
        Log additional debug output to std out.
  -i string
        User id to fetch variants for.
  -k string
        Api key for authorization, or use EXPERIMENT_KEY env var.
  -staging
        Use skylab staging environment.
  -u string
        The full user object to fetch variants for.
  -url string
        The server url to use to fetch variants from.

Examples

Fetch variants for a user given the user ID

./xpmt fetch -i user@company.com

Fetch variants for a user given the device ID

./xpmt fetch -d Xg0nG1v3iToYA

Fetch variants for a user given an experiment user JSON object

./xpmt fetch -u '{"user_id":"user@company.com","user_properties":{"premium":true}}'

Note: must use single quotes around JSON object string

Evaluate

Fetch flag configurations and locally evaluate the user.

Usage of evaluate:
  -d string
        Device id to fetch variants for.
  -debug
        Log additional debug output to std out.
  -i string
        User id to fetch variants for.
  -k string
        Server api key for authorization, or use EXPERIMENT_KEY env var.
  -staging
        Use skylab staging environment.
  -u string
        The full user object to fetch variants for.
  -url string
        The server url to use poll for flag configs from.

Examples

Fetch variants for a user given the user ID

./xpmt evaluate -i user@company.com

Fetch variants for a user given the device ID

./xpmt evaluate -d Xg0nG1v3iToYA

Fetch variants for a user given an experiment user JSON object

./xpmt evaluate -u '{"user_id":"user@company.com","user_properties":{"premium":true}}'

Note: must use single quotes around JSON object string

About

Amplitude Experiment Server-side SDK for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 53.0%
  • C 36.8%
  • Makefile 8.8%
  • Dockerfile 1.4%