-
Notifications
You must be signed in to change notification settings - Fork 34
add operational_metrics support #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
| /* | ||
| * Copyright (C) 2022 IBM, Inc. | ||
| * | ||
| * 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. | ||
| * | ||
| */ | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| operationalMetrics "github.com/netobserv/flowlogs-pipeline/pkg/operational/metrics" | ||
| "github.com/netobserv/flowlogs-pipeline/pkg/pipeline" | ||
| ) | ||
|
|
||
| func main() { | ||
| // Do not remove this unnamed variable ---> This is needed for goland compiler/linker to init the | ||
| // variables and functions for all the modules including the operational metrics variables which | ||
| // fills up `metricsOpts` with information | ||
| var _ *pipeline.Pipeline | ||
|
|
||
| header := ` | ||
| > Note: this file was automatically generated, to update execute "make docs" | ||
|
|
||
| # flowlogs-pipeline Operational Metrics | ||
|
|
||
| Each table below provides documentation for an exported flowlogs-pipeline operational metric. | ||
|
|
||
|
|
||
|
|
||
| ` | ||
| doc := operationalMetrics.GetDocumentation() | ||
| data := fmt.Sprintf("%s\n%s\n", header, doc) | ||
| fmt.Printf("%s", data) | ||
| } | ||
This file contains hidden or 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,39 @@ | ||
|
|
||
| > Note: this file was automatically generated, to update execute "make docs" | ||
|
|
||
| # flowlogs-pipeline Operational Metrics | ||
|
|
||
| Each table below provides documentation for an exported flowlogs-pipeline operational metric. | ||
eranra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| ### encode_prom_metrics_processed | ||
| | **Name** | encode_prom_metrics_processed | | ||
| |:---|:---| | ||
| | **Description** | Number of metrics processed | | ||
| | **Type** | counter | | ||
|
|
||
|
|
||
| ### ingest_collector_queue_length | ||
| | **Name** | ingest_collector_queue_length | | ||
| |:---|:---| | ||
| | **Description** | Queue length | | ||
| | **Type** | gauge | | ||
|
|
||
|
|
||
| ### ingest_collector_flow_logs_processed | ||
| | **Name** | ingest_collector_flow_logs_processed | | ||
| |:---|:---| | ||
| | **Description** | Number of log lines (flow logs) processed | | ||
| | **Type** | counter | | ||
|
|
||
|
|
||
| ### loki_records_written | ||
| | **Name** | loki_records_written | | ||
| |:---|:---| | ||
| | **Description** | Number of records written to loki | | ||
| | **Type** | counter | | ||
|
|
||
|
|
||
File renamed without changes.
File renamed without changes.
This file contains hidden or 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,73 @@ | ||
| /* | ||
| * Copyright (C) 2022 IBM, Inc. | ||
| * | ||
| * 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. | ||
| * | ||
| */ | ||
|
|
||
| package operationalMetrics | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/prometheus/client_golang/prometheus" | ||
| "github.com/prometheus/client_golang/prometheus/promauto" | ||
| ) | ||
|
|
||
| type metricDefinition struct { | ||
| Name string | ||
| Help string | ||
| Type string | ||
| } | ||
|
|
||
| var metricsOpts []metricDefinition | ||
|
|
||
| func NewCounter(opts prometheus.CounterOpts) prometheus.Counter { | ||
| metricsOpts = append(metricsOpts, metricDefinition{ | ||
| Name: opts.Name, | ||
| Help: opts.Help, | ||
| Type: "counter", | ||
| }) | ||
| return promauto.NewCounter(opts) | ||
| } | ||
|
|
||
| func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge { | ||
| metricsOpts = append(metricsOpts, metricDefinition{ | ||
| Name: opts.Name, | ||
| Help: opts.Help, | ||
| Type: "gauge", | ||
| }) | ||
| return promauto.NewGauge(opts) | ||
| } | ||
|
|
||
| func GetDocumentation() string { | ||
| doc := "" | ||
| for _, opts := range metricsOpts { | ||
| doc += fmt.Sprintf( | ||
| ` | ||
| ### %s | ||
| | **Name** | %s | | ||
| |:---|:---| | ||
| | **Description** | %s | | ||
| | **Type** | %s | | ||
|
|
||
| `, | ||
| opts.Name, | ||
| opts.Name, | ||
| opts.Help, | ||
| opts.Type, | ||
eranra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
| } | ||
|
|
||
| return doc | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.