Skip to content

Commit

Permalink
feat: support classic Ingest Keys
Browse files Browse the repository at this point in the history
  • Loading branch information
jharley committed Feb 29, 2024
1 parent 834e44f commit 10f52bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions beeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ type Config struct {
}

func IsClassicKey(config Config) bool {
// classic key has 32 characters
return len(config.WriteKey) == 32
return (&libhoney.Config{APIKey: config.WriteKey}).IsClassic()
}

// Init intializes the honeycomb instrumentation library.
Expand All @@ -113,6 +112,7 @@ func Init(config Config) {
fmt.Fprintln(os.Stderr, "WARN: Missing API Key.")
config.WriteKey = defaultWriteKey
}
isClassicKey := IsClassicKey(config)

if config.ServiceName == "" {
fmt.Fprintln(os.Stderr, "WARN: Missing service name.")
Expand All @@ -127,7 +127,7 @@ func Init(config Config) {
}
}

if IsClassicKey(config) {
if isClassicKey {
// if classic and missing dataset, warn on that
if config.Dataset == "" {
fmt.Fprintln(os.Stderr, "WARN: Missing dataset. Data will be sent to:", defaultDatasetClassic)
Expand Down Expand Up @@ -237,7 +237,7 @@ func Init(config Config) {
trace.GlobalConfig.PresendHook = config.PresendHook
}
// if classic, propagate by default
if IsClassicKey(config) {
if isClassicKey {
propagation.GlobalConfig.PropagateDataset = true
} else {
// if non-classic, don't propagate by default
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/gobuffalo/pop/v6 v6.1.1
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/honeycombio/libhoney-go v1.20.0
github.com/honeycombio/libhoney-go v1.21.0
github.com/jmoiron/sqlx v1.3.5
github.com/julienschmidt/httprouter v1.3.0
github.com/labstack/echo/v4 v4.11.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/honeycombio/libhoney-go v1.20.0 h1:PL54R0P9vxIyb28H3twbLb+DCqQlJdMQM55VZg1abKA=
github.com/honeycombio/libhoney-go v1.20.0/go.mod h1:RIaurCpfg5NDWSEV8t3QLcda9dUAiVNyWeHRAaSpN90=
github.com/honeycombio/libhoney-go v1.21.0 h1:uiiSfUipFSrmBucKTrwD9Bm4K60kY98p0hVLjtSLseM=
github.com/honeycombio/libhoney-go v1.21.0/go.mod h1:RIaurCpfg5NDWSEV8t3QLcda9dUAiVNyWeHRAaSpN90=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
Expand Down

0 comments on commit 10f52bd

Please sign in to comment.