mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
put value/delta renamed to put sample
This commit is contained in:
parent
fe6f7c5bc6
commit
3252c8299e
@ -189,7 +189,7 @@ interface HistogramInterface
|
||||
{
|
||||
public function with(string ...$labelValues): self;
|
||||
|
||||
public function put(float $delta);
|
||||
public function put(float $sample);
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -44,8 +44,8 @@ class Histogram implements HistogramInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function put(float $value): void
|
||||
public function put(float $sample): void
|
||||
{
|
||||
$this->histogram->observe($value, $this->labelValues);
|
||||
$this->histogram->observe($sample, $this->labelValues);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class Histogram implements HistogramInterface
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $value;
|
||||
public $sample;
|
||||
|
||||
public function __construct(string $name, array $labelNames)
|
||||
{
|
||||
@ -54,9 +54,9 @@ class Histogram implements HistogramInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function put(float $value): void
|
||||
public function put(float $sample): void
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->sample = $sample;
|
||||
$process = ProcessCollector::get(static::TARGET_PROCESS_NAME)[0];
|
||||
$process->write(serialize($this));
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class Histogram implements HistogramInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function put(float $delta): void
|
||||
public function put(float $sample): void
|
||||
{
|
||||
$this->client->timing($this->name, $delta, $this->sampleRate, array_combine($this->labelNames, $this->labelValues));
|
||||
$this->client->timing($this->name, $sample, $this->sampleRate, array_combine($this->labelNames, $this->labelValues));
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ interface HistogramInterface
|
||||
{
|
||||
public function with(string ...$labelValues): self;
|
||||
|
||||
public function put(float $delta): void;
|
||||
public function put(float $sample): void;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class OnPipeMessage implements ListenerInterface
|
||||
break;
|
||||
case $inner instanceof Histogram:
|
||||
$histogram = $this->factory->makeHistogram($inner->name, $inner->labelNames);
|
||||
$histogram->with(...$inner->labelValues)->put($inner->value);
|
||||
$histogram->with(...$inner->labelValues)->put($inner->sample);
|
||||
break;
|
||||
default:
|
||||
// Nothing to do
|
||||
|
Loading…
Reference in New Issue
Block a user