openllmetry: π Bug Report: Metrics wasn't sent when use chatmodel (openai , chatopenai ) from langchain
Which component is this bug for?
Langchain Instrumentation
π Description
When I use OpenAI or ChatOpenAI from the Langchain_OpenAI library for normal tasks, there is no issue with spans, but the metrics are not being sent to my Prometheus. However, if I use OpenAI directly, it works without any problems.
π Reproduction steps
It should have some metrics come out after running this code. But it didnβt.
from langchain_openai import OpenAI
llm = OpenAI()
from langchain_core.prompts import PromptTemplate
prompt = PromptTemplate.from_template("How to say {input} in {output_language}:\n")
chain = prompt | llm
chain.invoke(
{
"output_language": "German",
"input": "I love programming.",
}
)
π Expected behavior
it should have metrics as usual.
π Actual Behavior with Screenshots
from above code I canβt see any metrics was sent from that
π€ Python Version
3.11
π Provide any additional context for the Bug.
I sent it to Prometheus
π Have you spent some time to check if this bug has been raised before?
- I checked and didnβt find similar issue
Are you willing to submit PR?
Yes I am willing to submit a PR!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (4 by maintainers)
Mo worry. Im having fun talking with dosu.
@nitin302 already opened #2166 π