Skip to content
/ icdh Public

Go client library for NGINX Ingress Controller Service Insight API

License

Notifications You must be signed in to change notification settings

qba73/icdh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go GitHub GitHub go.mod Go version Go Report Card Go Reference

icdh

icdh is a Go client library for NGINX Ingress Controller Deep Service Insight API.

Using the Go library

Import the library using:

import "github.com/qba73/icdh"

Creating a client

Create a new client object by calling icdh.NewClient(baseURL)

client, err := icdh.NewClient("http://localhost:9114")
if err != nil {
    // handle err
}

Or create a client with a specific http Client:

myHTTPClient := &http.Client{}

client, err := icdh.NewClient(
    "http://localhost:9114",
    icdh.WithHTTPClient(myHTTPClient),
)
if err != nil {
    // handle error
}

Retrieve statistics for host my.service.com

stats, err := client.GetStats(ctx, "my.service.com")
if err != nil {
    // handle err
}

Retrieve statistics for name (transport) service

stats, err := client.GetTSStats(ctx, "service")
if err != nil {
    // handle err
}