Skip to content

Commit

Permalink
finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
alizenhom committed Jun 13, 2024
1 parent 57a6fee commit ed8aa99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/examples/llamaindex_example/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

nest_asyncio.apply()

langtrace.init(write_spans_to_console=False)
langtrace.init()


def multiply(a: int, b: int) -> int:
Expand Down
5 changes: 3 additions & 2 deletions src/examples/llamaindex_example/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


langtrace.init(
write_spans_to_console=False,
disable_tracing_for_methods={"open_ai": ["openai.embeddings.create"]},
disable_tracing_for_methods={
"open_ai": ["openai.chat.completions.create"],
}
)


Expand Down
6 changes: 4 additions & 2 deletions src/langtrace_python_sdk/utils/langtrace_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

class LangtraceSampler(Sampler):
_disabled_methods_names: set
_seen: set = set()

def __init__(
self,
Expand Down Expand Up @@ -42,7 +41,10 @@ def should_sample(
return SamplingResult(decision=Decision.RECORD_AND_SAMPLE)

if parent_context:
if parent_span_context.trace_flags != TraceFlags.SAMPLED:
if (
parent_span_context.span_id != 0
and parent_span_context.trace_flags != TraceFlags.SAMPLED
):
return SamplingResult(decision=Decision.DROP)

if name in self._disabled_methods_names:
Expand Down

0 comments on commit ed8aa99

Please sign in to comment.