Skip to content

Commit 42feaec

Browse files
AnnatarHeclaude
andcommitted
fix(otel): correctly map type attribute based on metric type
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c8f5085 commit 42feaec

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

daemon/ccotel_processor.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (p *CCOtelProcessor) parseMetric(m *metricsv1.Metric) []model.CCOtelMetric
245245
}
246246
// Extract attributes
247247
for _, attr := range dp.GetAttributes() {
248-
applyMetricAttribute(&metric, attr)
248+
applyMetricAttribute(&metric, attr, metricType)
249249
}
250250
metrics = append(metrics, metric)
251251
}
@@ -258,7 +258,7 @@ func (p *CCOtelProcessor) parseMetric(m *metricsv1.Metric) []model.CCOtelMetric
258258
Value: getDataPointValue(dp),
259259
}
260260
for _, attr := range dp.GetAttributes() {
261-
applyMetricAttribute(&metric, attr)
261+
applyMetricAttribute(&metric, attr, metricType)
262262
}
263263
metrics = append(metrics, metric)
264264
}
@@ -392,13 +392,17 @@ func getDataPointValue(dp *metricsv1.NumberDataPoint) float64 {
392392
}
393393

394394
// applyMetricAttribute applies an attribute to a metric
395-
func applyMetricAttribute(metric *model.CCOtelMetric, attr *commonv1.KeyValue) {
395+
func applyMetricAttribute(metric *model.CCOtelMetric, attr *commonv1.KeyValue, metricType string) {
396396
key := attr.GetKey()
397397
value := attr.GetValue()
398398

399399
switch key {
400400
case "type":
401-
metric.TokenType = value.GetStringValue()
401+
if metricType == model.CCMetricLinesOfCodeCount {
402+
metric.LinesType = value.GetStringValue()
403+
} else {
404+
metric.TokenType = value.GetStringValue()
405+
}
402406
case "model":
403407
metric.Model = value.GetStringValue()
404408
case "tool":

0 commit comments

Comments
 (0)