quarkiverse / quarkus-wiremock

Quarkus extension for launching an in-process Wiremock server
https://wiremock.org/
Apache License 2.0
16 stars 12 forks source link

Adding logs to Dev UI #161

Open phillip-kruger opened 1 month ago

phillip-kruger commented 1 month ago

@edeandrea maybe you can look at this. I left it draft because:

1) It needs the latest Quarkus version. 2) I am not sure it working and I am not sure how to test.

If you have time please can you have a look

edeandrea commented 1 month ago

Hey @phillip-kruger sorry for the delay in getting to this as I was out of the office all last week. What specifically should this do?

edeandrea commented 1 month ago

@phillip-kruger I built Quarkus main locally and checked out this PR and built it, then I downloaded the Quarkus Superheroes and configured it to use Quarkus main & the snapshot version of this extension. When I run the Dev UI I see this:

image

But I don't ever see anything in it....

phillip-kruger commented 1 month ago

OK that is what I was seeing too , I was not sure if I needed to do anything to get a log output. What do you expect to see in the wiremock log ?

edeandrea commented 1 month ago

To be honest I'm not sure :)

wjglerum commented 3 weeks ago

Logging has been enabled in this PR recently, maybe that helps fix your issue now? https://github.com/quarkiverse/quarkus-wiremock/pull/142

phillip-kruger commented 3 weeks ago

@edeandrea can you check ?

edeandrea commented 3 weeks ago

@phillip-kruger have you rebased this PR from main? Specifically to include #142 ?

When I use the released version 1.4.0 (which includes #142) I can see the wiremock output on the console:

08:38:34 INFO  [io.qu.wi.de.WireMockServer] (qtp1780942574-143) Request received:
127.0.0.1 - POST /v1/chat/completions

Accept: [application/json]
Authorization: [Bearer change-me]
Content-Type: [application/json]
User-Agent: [langchain4j-openai]
Content-Length: [1138]
Host: [localhost:63309]
traceparent: [00-1c50b447689ef1de6b0e9c772aa789d2-b1db8df3e6502abf-01]
{
  "model" : "gpt-4o-mini",
  "messages" : [ {
    "role" : "system",
    "content" : "You are a marvel comics writer, expert in all sorts of super heroes and super villains."
  }, {
    "role" : "user",
    "content" : "Narrate the fight between a super hero and a super villain.\n\nDuring the narration, don't repeat \"super hero\" or \"super villain\".\n\nWrite 4 paragraphs maximum. Be creative.\n\nThe narration must be:\n- G rated\n- Workplace/family safe\n- No sexism, racism, or other bias/bigotry\n\nHere is the data you will use for the winner:\n\n+++++\nName: Chewbacca\nPowers: Big, hairy, strong\nLevel: 5\n+++++\n\nHere is the data you will use for the loser:\n\n+++++\nName: Wanderer\nPowers: Not strong\nLevel: 3\n+++++\n\nHere is the data you will use for the fight:\n\n+++++\nChewbacca who is a heroes has won the fight against Wanderer who is a .\n\nThe fight took place in Gotham City, which can be described as An American city rife with corruption and crime, the home of its iconic protector Batman..\n+++++\n"
  } ],
  "temperature" : 0.7,
  "top_p" : 0.5,
  "presence_penalty" : 0.0,
  "frequency_penalty" : 0.0
}

Matched response definition:
{
  "status" : 200,
  "body" : "{\n  \"id\": \"chatcmpl-8Uy1UC7ZFUXtjhYcY5VFj7eYGu6jX\",\n  \"object\": \"chat.completion\",\n  \"created\": 1702391260,\n  \"model\": \"gpt-4o-mini-2024-07-18\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"In the gritty streets of Gotham City, a clash of epic proportions unfolded. Han Solo, a hero known for his sharpshooting skills and unwavering skepticism towards the force, faced off against Storm Trooper, a villain armed with nothing more than a small gun. The odds seemed stacked against the Storm Trooper, but he was determined to prove his worth.\\n\\nAs the battle commenced, Han Solo swiftly dodged the Storm Trooper's feeble shots, his agility and experience shining through. With a smirk on his face, Han Solo aimed his big gun with precision, firing shots that echoed through the city. The Storm Trooper, though outmatched, refused to back down, his determination fueling his every move.\\n\\nWith each passing moment, Han Solo's level of expertise became more apparent. His shots were calculated and deadly, while the Storm Trooper struggled to keep up. The hero's confidence grew, his movements becoming more fluid and effortless. It was clear that the Storm Trooper's small gun was no match for Han Solo's superior firepower.\\n\\nIn a final, decisive moment, Han Solo's shot found its mark, incapacitating the Storm Trooper. The hero emerged victorious, his unwavering resolve prevailing over the villain's futile attempts. As the city rejoiced in the triumph of justice, Han Solo stood tall, a symbol of hope and resilience in the face of adversity.\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 232,\n    \"completion_tokens\": 280,\n    \"total_tokens\": 512\n  },\n  \"system_fingerprint\": null\n}\n",
  "headers" : {
    "Content-Type" : "application/json",
    "openai-model" : "gpt-4o-mini-2024-07-18",
    "openai-organization" : "my-org-1234",
    "openai-version" : "2020-10-01",
    "openai-processing-ms" : "15000"
  }
}

Response:
HTTP/1.1 200
Content-Type: [application/json]
openai-model: [gpt-4o-mini-2024-07-18]
openai-organization: [my-org-1234]
openai-version: [2020-10-01]
openai-processing-ms: [15000]
Matched-Stub-Id: [fb0437be-b451-41ef-989b-967d3b609ffe]