...

Source file src/scheduler/metrics/services.go

Documentation: scheduler/metrics

     1  /*
     2   * P2PFaaS - A framework for FaaS Load Balancing
     3   * Copyright (c) 2019 - 2022. Gabriele Proietti Mattia <pm.gabriele@outlook.com>
     4   *
     5   * This program is free software: you can redistribute it and/or modify
     6   * it under the terms of the GNU General Public License as published by
     7   * the Free Software Foundation, either version 3 of the License, or
     8   * (at your option) any later version.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <https://www.gnu.org/licenses/>.
    17   */
    18  
    19  package metrics
    20  
    21  func PostJobMetrics(fnName string, code int, hops int, queueTime float64, execTime float64, faasExecutionTime float64) {
    22  	if enableMetrics {
    23  		// jobHops.WithLabelValues(fnName, strconv.Itoa(code)).Observe(float64(hops))
    24  		// jobExecutionTime.WithLabelValues(fnName, strconv.Itoa(code)).Observe(execTime)
    25  		// jobQueueTime.WithLabelValues(fnName, strconv.Itoa(code)).Observe(queueTime)
    26  		// jobForwardingTime.WithLabelValues(fnName, strconv.Itoa(code)).Observe(forwardingTime)
    27  		// jobFaasExecutionTime.WithLabelValues(fnName, strconv.Itoa(code)).Observe(faasExecutionTime)
    28  	}
    29  }
    30  
    31  func PostJobInvocations(fnName string, code int) {
    32  	if enableMetrics {
    33  		// invocationsTotal.WithLabelValues(fnName, strconv.Itoa(code)).Inc()
    34  	}
    35  }
    36  
    37  func PostQueueFreedSlot() {
    38  	if enableMetrics {
    39  		// queueFree.Inc()
    40  		// queueFill.Dec()
    41  	}
    42  }
    43  
    44  func PostQueueAssignedSlot() {
    45  	if enableMetrics {
    46  		// queueFree.Dec()
    47  		// queueFill.Inc()
    48  	}
    49  }
    50  
    51  func PostStartedExecutingJob() {
    52  	if enableMetrics {
    53  		// currentRunningJobs.Inc()
    54  		// currentFreeRunningJobs.Dec()
    55  	}
    56  }
    57  
    58  func PostStoppedExecutingJob() {
    59  	if enableMetrics {
    60  		// currentRunningJobs.Dec()
    61  		// currentFreeRunningJobs.Inc()
    62  	}
    63  }
    64  
    65  func PostJobIsForwarded(fnName string) {
    66  	if enableMetrics {
    67  		// jobForwardedCount.WithLabelValues(fnName).Inc()
    68  	}
    69  }
    70  
    71  /*
    72   * Init values set
    73   */
    74  
    75  func PostParallelJobsSlots(n int) {
    76  	if enableMetrics {
    77  		// currentFreeRunningJobs.Set(float64(n))
    78  	}
    79  }
    80  
    81  func PostQueueSize(n int) {
    82  	if enableMetrics {
    83  		// queueFree.Set(float64(n))
    84  	}
    85  }
    86  

View as plain text