Skip to content

Commit

Permalink
Merge pull request #35 from instana/configure-port
Browse files Browse the repository at this point in the history
Configure the listen port of data collector
  • Loading branch information
jinsongo authored Jun 3, 2024
2 parents b0e34ba + ff15a51 commit 8d7010f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions llm/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ llm.application: LLM_DC
instances:
- otel.backend.url: http://localhost:4317
otel.service.name: DC1
otel.service.port: 8000
price.prompt.tokens.per.kilo: 0.0
price.complete.tokens.per.kilo: 0.0
4 changes: 2 additions & 2 deletions llm/config/logging.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
# default file output is in user's home directory.
java.util.logging.FileHandler.level=INFO
java.util.logging.FileHandler.pattern = %h/llm-dc%u.log
java.util.logging.FileHandler.limit = 500000
java.util.logging.FileHandler.count = 10
java.util.logging.FileHandler.limit = 5000000
java.util.logging.FileHandler.count = 3
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
1 change: 1 addition & 0 deletions llm/src/main/java/com/instana/dc/llm/LLMDcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class LLMDcUtil {
public static final String SERVICE_INSTANCE_ID = "service.instance.id";
public final static String PRICE_PROMPT_TOKES_PER_KILO = "price.prompt.tokens.per.kilo";
public final static String PRICE_COMPLETE_TOKES_PER_KILO = "price.complete.tokens.per.kilo";
public final static String SERVICE_LISTEN_PORT = "otel.service.port";

/* Configurations for Metrics:
*/
Expand Down
8 changes: 5 additions & 3 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 @@ -31,6 +31,7 @@ public class LLMDc extends AbstractLLMDc {
private MetricsCollectorService metricsCollector = new MetricsCollectorService();
private Double pricePromptTokens = 0.0;
private Double priceCompleteTokens = 0.0;
private int listenPort = 0;

/**
* The poll rate in the configuration, in seconds. In other words, the number of
Expand Down Expand Up @@ -135,14 +136,15 @@ public void resetMetrics() {

public LLMDc(Map<String, Object> properties, CustomDcConfig cdcConfig) throws Exception {
super(properties, cdcConfig);
pricePromptTokens = (Double) properties.getOrDefault(PRICE_PROMPT_TOKES_PER_KILO, 0.03);
priceCompleteTokens = (Double) properties.getOrDefault(PRICE_COMPLETE_TOKES_PER_KILO, 0.03);
pricePromptTokens = (Double) properties.getOrDefault(PRICE_PROMPT_TOKES_PER_KILO, 0.0);
priceCompleteTokens = (Double) properties.getOrDefault(PRICE_COMPLETE_TOKES_PER_KILO, 0.0);
listenPort = (int) properties.getOrDefault(SERVICE_LISTEN_PORT, 8000);
}

@Override
public void initOnce() throws ClassNotFoundException {
var server = Server.builder()
.http(8000)
.http(listenPort)
.service(
GrpcService.builder()
.addService(metricsCollector)
Expand Down

0 comments on commit 8d7010f

Please sign in to comment.