Skip to content
Snippets Groups Projects
Select Git revision
  • 67f5686b96491fd7bd0120f1b969577e2a388f23
  • master default
  • nonce
  • encrypt-ticket
  • apache24
  • libsodium
  • mod-sso-cache
7 results

ai-sso-python.install

Blame
  • inputs.go 645 B
    package main
    
    import (
    	"encoding/json"
    	"fmt"
    )
    
    type input struct {
    	Name      string `json:"name"`
    	Submitted int64  `json:"submitted"`
    }
    
    func newInputFromJSON(b []byte) (*input, error) {
    	var pstat input
    	err := json.Unmarshal(b, &pstat)
    	if err != nil {
    		return nil, fmt.Errorf("error decoding input stat `%v`: %v", string(b), err)
    	}
    	return &pstat, nil
    }
    
    func (i *input) toPoints() []*point {
    	points := make([]*point, 1)
    
    	points[0] = &point{
    		Name:        "input_submitted",
    		Type:        counter,
    		Value:       i.Submitted,
    		Description: "messages submitted",
    		LabelName:   "input",
    		LabelValue:  i.Name,
    	}
    
    	return points
    }