Skip to content

Commit

Permalink
Client method for getting lastAPIKey
Browse files Browse the repository at this point in the history
  • Loading branch information
dustmop authored and hush-hush committed Jan 20, 2025
1 parent 029c175 commit 6a5371d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/fakeintake/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,19 @@ func (c *Client) ConfigureOverride(override api.ResponseOverride) error {
return nil
}

// GetLastAPIKey returns the last apiKey sent with a payload to the intake
func (c *Client) GetLastAPIKey() (string, error) {
resp, err := http.Get(fmt.Sprintf("%s/debug/lastAPIKey", c.fakeIntakeURL))
if err != nil {
return "", err
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return strings.TrimSpace(string(body)), nil
}

func (c *Client) getMetric(name string) ([]*aggregator.MetricSeries, error) {
err := c.getMetrics()
if err != nil {
Expand Down

0 comments on commit 6a5371d

Please sign in to comment.