-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from fujiwara/otel-metric
Otel metric
- Loading branch information
Showing
14 changed files
with
429 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package maprobe | ||
|
||
type Channels struct { | ||
ServiceMetrics chan ServiceMetric | ||
HostMetrics chan HostMetric | ||
AggregatedMetrics chan ServiceMetric | ||
OtelMetrics chan Metric | ||
Destination *DestinationConfig | ||
} | ||
|
||
func NewChannels(dst *DestinationConfig) *Channels { | ||
chs := Channels{ | ||
ServiceMetrics: make(chan ServiceMetric, PostMetricBufferLength*10), | ||
HostMetrics: make(chan HostMetric, PostMetricBufferLength*10), | ||
AggregatedMetrics: make(chan ServiceMetric, PostMetricBufferLength*10), | ||
OtelMetrics: make(chan Metric, PostMetricBufferLength*10), | ||
Destination: dst, | ||
} | ||
return &chs | ||
} | ||
|
||
func (ch *Channels) SendServiceMetric(m ServiceMetric) { | ||
if ch.Destination.Mackerel.Enabled { | ||
ch.ServiceMetrics <- m | ||
} | ||
if ch.Destination.Otel.Enabled { | ||
ch.OtelMetrics <- m.Metric | ||
} | ||
} | ||
|
||
func (ch *Channels) SendHostMetric(m HostMetric) { | ||
if ch.Destination.Mackerel.Enabled { | ||
ch.HostMetrics <- m | ||
} | ||
if ch.Destination.Otel.Enabled { | ||
ch.OtelMetrics <- m.Metric | ||
} | ||
} | ||
|
||
func (ch *Channels) SendAggregatedMetric(m ServiceMetric) { | ||
if ch.Destination.Mackerel.Enabled { | ||
ch.AggregatedMetrics <- m | ||
} | ||
// TODO: Otel Aggregated Metrics | ||
} | ||
|
||
func (ch *Channels) Close() { | ||
close(ch.ServiceMetrics) | ||
close(ch.HostMetrics) | ||
close(ch.AggregatedMetrics) | ||
close(ch.OtelMetrics) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.