stats

package
v7.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Helm Chart configuration

Prometheus based stats server

Below is the configuration for running exposing the statistics on port 8081. A running prometheus on kubernetes will grab the statistics from this service looking at the annotations.

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
spec:
  template:
    metadata:
      {{- with .Values.deployment.annotations }}
      annotations: {{- toYaml . | nindent 8 }}
      {{- end }}
    spec:
      containers:
        - name: testContainer
          ports:
          - name: promserver
            containerPort: 8081
values.yaml
deployment:
  annotations:
    prometheus.io/path: "/metrics"
    prometheus.io/port: "8081"
    prometheus.io/scrape: "true"
service.yaml
apiVersion: v1
kind: Service
metadata:
  name: test
spec:
  type: ClusterIP
  ports:
    - port: 8081
      targetPort: promserver
      protocol: TCP
      name: promserver

Documentation

Overview

  • Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	// OLT Device stats
	//-----------------
	// Number of ONU Discovery messages received by the OLT adapter
	NumDiscoveriesReceived DeviceCounter = "discoveries_received_total"
	// Number of ONUs successfully activated by the OLT adapter
	NumOnusActivated DeviceCounter = "activated_onus_total"

	// ONT Device stats
	//-----------------
	// Number of times transmission retries for OMCI messages were done for a specific ONU
	OmciCCTxRetries DeviceCounter = "omci_cc_tx_retries_total"
	// Number of times transmission timeouts for OMCI messages happened for a specific ONU
	OmciCCTxTimeouts DeviceCounter = "omci_cc_tx_timeous_total"

	// Other not device specific stats
	//--------------------------------
	// Number of times writing to the message bus failed, could be collected by adapters as well as vCore
	NumErrorsWritingToBus NonDeviceCounter = "bus_write_errors_total"
	// Number of times rpc calls to the vCore resulted in errors at the adapters
	NumCoreRpcErrors NonDeviceCounter = "core_rpc_errors_total"
	// Number of times rpc calls to the adapters resulted in errors at the vCore
	NumAdapterRpcErrors NonDeviceCounter = "adapter_rpc_errors_total"

	// OLT Device durations
	//---------------------
	// Time taken at the OLT adapter to process successfully an ONU Discovery message received
	OnuDiscoveryProcTime DeviceDuration = "onu_discovery_proc_time"
	// Time taken at the OLT adapter to successfully activate an ONU
	OnuDiscToActivateTime DeviceDuration = "onu_discovery_to_activate_time"
	// Time taken at the OLT adapter from the time the ONU Discovery was received to the first flow being pushed for the ONU
	OnuDiscToFlowsPushedTime DeviceDuration = "onu_disc_to_flows_pushed_time"

	// Other not device specific durations
	//------------------------------------
	// Time taken to write an entry to the database, could be collected by all the three users of the database
	DBWriteTime NonDeviceDuration = "db_write_time"
	// Time taken to read an entry from the database, could be collected by all the three users of the database
	DBReadTime NonDeviceDuration = "db_read_time"
)

Variables

View Source
var StatsServer = PromStatsServer{}

Functions

This section is empty.

Types

type CollectorName

type CollectorName string
const (
	OltAdapter CollectorName = "adapter_olt"
	OnuAdapter CollectorName = "adapter_onu"
	VCore      CollectorName = "rw_core"
)

func (CollectorName) String

func (s CollectorName) String() string

type DeviceCounter

type DeviceCounter string

func (DeviceCounter) String

func (s DeviceCounter) String() string

type DeviceDuration

type DeviceDuration string

func (DeviceDuration) String

func (s DeviceDuration) String() string

type NonDeviceCounter

type NonDeviceCounter string

func (NonDeviceCounter) String

func (s NonDeviceCounter) String() string

type NonDeviceDuration

type NonDeviceDuration string

func (NonDeviceDuration) String

func (s NonDeviceDuration) String() string

type NullStatsServer

type NullStatsServer struct {
}

func (*NullStatsServer) Add

func (n *NullStatsServer) Add(counter NonDeviceCounter, val float64)

func (*NullStatsServer) AddForDevice

func (n *NullStatsServer) AddForDevice(devId, sn string, counter DeviceCounter, val float64)

func (*NullStatsServer) CollectDuration

func (n *NullStatsServer) CollectDuration(dName NonDeviceDuration, startTime time.Time)

func (*NullStatsServer) CollectDurationForDevice

func (n *NullStatsServer) CollectDurationForDevice(devID, sn string, dName NonDeviceDuration, startTime time.Time)

func (*NullStatsServer) Count

func (n *NullStatsServer) Count(counter NonDeviceCounter)

func (*NullStatsServer) CountForDevice

func (n *NullStatsServer) CountForDevice(devId, sn string, counterName DeviceCounter)

func (*NullStatsServer) Start

func (n *NullStatsServer) Start(ctx context.Context, p int, name CollectorName)

type PromStatsServer

type PromStatsServer struct {
	// contains filtered or unexported fields
}

func (*PromStatsServer) Add

func (ps *PromStatsServer) Add(counter NonDeviceCounter, val float64)

Add adds val to counter.

func (*PromStatsServer) AddForDevice

func (ps *PromStatsServer) AddForDevice(devId, sn string, counter DeviceCounter, val float64)

AddForDevice adds val to counter.

func (*PromStatsServer) CollectDuration

func (ps *PromStatsServer) CollectDuration(dName NonDeviceDuration, startTime time.Time)

CollectDuration calculates the duration from startTime to time.Now().

func (*PromStatsServer) CollectDurationForDevice

func (ps *PromStatsServer) CollectDurationForDevice(devID, sn string, dName DeviceDuration, startTime time.Time)

CollectDurationForDevice calculates the duration from startTime to time.Now() for device devID with serial number sn.

func (*PromStatsServer) Count

func (ps *PromStatsServer) Count(counter NonDeviceCounter)

Count counts the number of times the counterName happens. Each call to Count increments it by one.

func (*PromStatsServer) CountForDevice

func (ps *PromStatsServer) CountForDevice(devId, sn string, counterName DeviceCounter)

CountForDevice counts the number of times the counterName happens for device devId with serial number sn. Each call to Count increments it by one.

func (*PromStatsServer) Start

func (ps *PromStatsServer) Start(ctx context.Context, p int, name CollectorName)

Start starts the statistics manager with name and makes the collected stats available at port p. All the statistics collected by this collector will be appended with "voltha_(name)_" when they appear in Prometheus. The function starts a prometheus HTTP listener in the background and does not return any errors, the listener is stopped on context cancellation

type StatsManager

type StatsManager interface {
	// Start starts the statistics manager with name and makes the collected stats available at port p.
	Start(ctx context.Context, p int, name CollectorName)

	//CountForDevice counts the number of times the counterName happens for device devId with serial number sn. Each call to Count increments it by one.
	CountForDevice(devId, sn string, counterName DeviceCounter)

	//AddForDevice adds val to counter.
	AddForDevice(devId, sn string, counter DeviceCounter, val float64)

	//CollectDurationForDevice calculates the duration from startTime to time.Now() for device devID with serial number sn.
	CollectDurationForDevice(devID, sn string, dName NonDeviceDuration, startTime time.Time)

	//Count counts the number of times the counterName happens. Each call to Count increments it by one.
	Count(counter NonDeviceCounter)

	//Add adds val to counter.
	Add(counter NonDeviceCounter, val float64)

	//CollectDuration calculates the duration from startTime to time.Now().
	CollectDuration(dName NonDeviceDuration, startTime time.Time)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL