-
Notifications
You must be signed in to change notification settings - Fork 389
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
add K8s meta self metrics #1765
Merged
Merged
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f76b6f3
support k8s meta to collect more resources
Abingcbc 44608d1
adjust fields
Abingcbc a48a77b
fix
Abingcbc 6060ff8
fix
Abingcbc 7b2622f
fix lint
Abingcbc bcc1a3b
fix
Abingcbc 63ddd1e
fix
Abingcbc e0ed5b0
fix
Abingcbc bdce20e
fix
Abingcbc df4d9e2
fix
Abingcbc 29b4a79
fix
Abingcbc f8856e5
fix
Abingcbc 8f93586
fix
Abingcbc 7ffbb5e
fix
Abingcbc 37e73be
Merge branch 'main' into k8s_meta2
Abingcbc 89a12a7
self metric
Abingcbc aa63bf8
fix
Abingcbc 8c774f1
fix
Abingcbc 551953c
Merge remote-tracking branch 'alibaba/main' into k8s_meta2
Abingcbc f7c3182
Merge remote-tracking branch 'alibaba/main' into k8s_meta2
Abingcbc caf137b
fix
Abingcbc 0be2b36
fix
Abingcbc 1f6a177
fix
Abingcbc f36b979
fix
Abingcbc 88e39cd
fix lint
Abingcbc 24f0620
fix
Abingcbc e7e9f36
fix
Abingcbc e3e9c89
fix
Abingcbc 926e2a1
fix
Abingcbc 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 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
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,44 @@ | ||
// Copyright 2024 iLogtail Authors | ||
// | ||
// 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 helper | ||
|
||
import ( | ||
"github.com/alibaba/ilogtail/pkg/pipeline" | ||
) | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
// agent | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
// metric keys | ||
const ( | ||
MetricAgentMemoryGo = "agent_go_memory_used_mb" | ||
MetricAgentGoRoutinesTotal = "agent_go_routines_total" | ||
) | ||
|
||
func GetCommonLabels(context pipeline.Context, pluginMeta *pipeline.PluginMeta) []pipeline.LabelPair { | ||
labels := make([]pipeline.LabelPair, 0) | ||
labels = append(labels, pipeline.LabelPair{Key: MetricLabelKeyProject, Value: context.GetProject()}) | ||
labels = append(labels, pipeline.LabelPair{Key: MetricLabelKeyLogstore, Value: context.GetLogstore()}) | ||
labels = append(labels, pipeline.LabelPair{Key: MetricLabelKeyPipelineName, Value: context.GetConfigName()}) | ||
|
||
if len(pluginMeta.PluginID) > 0 { | ||
labels = append(labels, pipeline.LabelPair{Key: MetricLabelKeyPluginID, Value: pluginMeta.PluginID}) | ||
} | ||
if len(pluginMeta.PluginType) > 0 { | ||
labels = append(labels, pipeline.LabelPair{Key: MetricLabelKeyPluginType, Value: pluginMeta.PluginType}) | ||
} | ||
return labels | ||
} |
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,33 @@ | ||
// Copyright 2024 iLogtail Authors | ||
// | ||
// 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 helper | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
// component | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
/********************************************************** | ||
* k8s meta | ||
**********************************************************/ | ||
const ( | ||
MetricComponentK8sMetaAddEventTotal = "component_k8s_meta_add_event_total" | ||
MetricComponentK8sMetaUpdateEventTotal = "component_k8s_meta_update_event_total" | ||
MetricComponentK8sMetaDeleteEventTotal = "component_k8s_meta_delete_event_total" | ||
MetricComponentK8sMetaCacheSize = "component_k8s_meta_cache_size" | ||
MetricComponentK8sMetaQueueSize = "component_k8s_meta_queue_size" | ||
MetricComponentK8sMetaHTTPRequestTotal = "component_k8s_meta_http_request_total" | ||
MetricComponentK8sMetaHTTPAvgDelayMs = "component_k8s_meta_avg_delay_ms" | ||
MetricComponentK8sMetaHTTPMaxDelayMs = "component_k8s_meta_max_delay_ms" | ||
) |
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.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里直接初始化?label是什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是runner级别的,在导出的时候,会填入cluster id,runner name和project。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认的project要带上