Skip to content

Commit

Permalink
feat: Make API endpoint configurable (#29)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
Make API endpoint configurable, this will be required for deploying to
our own environments since they point at different API endpoints.

## Short description of the changes
- Add `HONEYCOMB_API_ENDPOINT` configuration variable

## How to verify that this has the expected result
- Use the new environment variable to send data to Honeycomb's dogfood
environment

---------

Co-authored-by: Mike Goldsmith <goldsmith.mike@gmail.com>
Co-authored-by: Vera Reynolds <vreynolds@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 18, 2023
1 parent 4f9e454 commit b2e9ee7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ spec:
spec:
containers:
- name: hny-ebpf-agent
# image: hny/ebpf-agent:local
image: ghcr.io/honeycombio/ebpf-agent:dev
image: hny/ebpf-agent:local
# image: ghcr.io/honeycombio/ebpf-agent:dev
imagePullPolicy: IfNotPresent
env:
- name: HONEYCOMB_API_KEY
Expand All @@ -54,6 +54,8 @@ spec:
key: api-key
- name: HONEYCOMB_DATASET
value: ebpf-agent-go
- name: HONEYCOMB_API_ENDPOINT
value: $HONEYCOMB_API_ENDPOINT
securityContext:
capabilities:
add:
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ func main() {
log.Fatalf("Failed to get host kernel version: %v", err)
}
log.Printf("Host kernel version: %s\n", kernelVersion)

log.Printf("Honeycomb API endpoint: %s\n", os.Getenv("HONEYCOMB_API_ENDPOINT"))
// setup libhoney
libhoney.Init(libhoney.Config{
APIKey: os.Getenv("HONEYCOMB_API_KEY"),
APIKey: os.Getenv("HONEYCOMB_API_KEY"),
Dataset: os.Getenv("HONEYCOMB_DATASET"),
APIHost: os.Getenv("HONEYCOMB_API_ENDPOINT"),
})
defer libhoney.Close()

Expand Down

0 comments on commit b2e9ee7

Please sign in to comment.