Skip to content

Commit dea652c

Browse files
committed
WIP
1 parent f60ec67 commit dea652c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/fluent/plugin/in_opentelemetry_metrics.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def metrics
101101
@monitor_info.plugins_info_all.each do |record|
102102
attributes = {
103103
plugin_id: record["plugin_id"],
104-
plugin: "#{record['plugin_category']}_#{record['type']}",
104+
plugin: plugin_name(record["plugin_category"], record["type"]),
105105
plugin_category: record["plugin_category"],
106106
plugin_type: record["type"]
107107
}.map { |k, v| string_value_attribute(k, v) }
@@ -130,6 +130,20 @@ def metrics
130130
metrics
131131
end
132132

133+
def plugin_name(category, type)
134+
prefix =
135+
case category
136+
when "input"
137+
"in"
138+
when "output"
139+
"out"
140+
else
141+
category
142+
end
143+
144+
"#{prefix}_#{type}"
145+
end
146+
133147
def string_value_attribute(key, value)
134148
{
135149
"key" => key.to_s,

0 commit comments

Comments
 (0)