Skip to content
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

Fix the model name for UI display #72

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions llm/src/main/java/com/instana/dc/llm/impl/llm/LLMDc.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void collectData() {
// This costs are 10000 times the actual value to prevent very small numbers from being rounded off.
// And it will be adjusted to the correct value on UI.
String backwardCompatible = System.getenv("FORCE_BACKWARD_COMPATIBLE");
if (backwardCompatible != null) {
if (backwardCompatible != null && backwardCompatible.equalsIgnoreCase("true")) {
System.out.printf("FORCE_BACKWARD_COMPATIBLE is set.");
} else {
intervalTotalCost = intervalTotalCost * 10000;
Expand All @@ -276,14 +276,16 @@ public void collectData() {
System.out.println(" - Interval Request : " + intervalReqCount);

Map<String, Object> attributes = new HashMap<>();
attributes.put("model_id", modelId);
String replacedId = modelId.replace(".", "/");
String modelIdExt = aiSystem + ":" + replacedId;
attributes.put("model_id", modelIdExt);
attributes.put("ai_system", aiSystem);
getRawMetric(LLM_STATUS_NAME).setValue(1);
getRawMetric(LLM_DURATION_NAME).getDataPoint(modelId).setValue(avgDurationPerReq, attributes);
getRawMetric(LLM_DURATION_MAX_NAME).getDataPoint(modelId).setValue(maxDurationSoFar, attributes);
getRawMetric(LLM_COST_NAME).getDataPoint(modelId).setValue(intervalTotalCost, attributes);
getRawMetric(LLM_TOKEN_NAME).getDataPoint(modelId).setValue(intervalTotalTokens, attributes);
getRawMetric(LLM_REQ_COUNT_NAME).getDataPoint(modelId).setValue(intervalReqCount, attributes);
getRawMetric(LLM_DURATION_NAME).getDataPoint(modelIdExt).setValue(avgDurationPerReq, attributes);
getRawMetric(LLM_DURATION_MAX_NAME).getDataPoint(modelIdExt).setValue(maxDurationSoFar, attributes);
getRawMetric(LLM_COST_NAME).getDataPoint(modelIdExt).setValue(intervalTotalCost, attributes);
getRawMetric(LLM_TOKEN_NAME).getDataPoint(modelIdExt).setValue(intervalTotalTokens, attributes);
getRawMetric(LLM_REQ_COUNT_NAME).getDataPoint(modelIdExt).setValue(intervalReqCount, attributes);
}
logger.info("-----------------------------------------");
}
Expand Down