Skip to content

Instantly share code, notes, and snippets.

@heitorlessa
Created April 3, 2023 14:16
Show Gist options
  • Save heitorlessa/58220d4d37727301e0ab28dc4f5db5c8 to your computer and use it in GitHub Desktop.
Save heitorlessa/58220d4d37727301e0ab28dc4f5db5c8 to your computer and use it in GitHub Desktop.
BaseProvider sample
class CustomTracerProvider(BaseProvider):
def start_segment(self):
"""This method is proposed as a solution as it exists for other providers
This method is responsible for starting the trace. This might involve initializing some data structures,
connecting to an external service, or performing some other setup work"""
def end_segment(self):
"""This method is proposed as a solution as it exists for other providers.
This method is responsible for ending the trace. This might involve finalizing data structures,
sending data to an external service, or performing some other cleanup work"""
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:
"""Annotate current active trace entity with a key-value pair."""
def put_metadata(self, key: str, value: Any, namespace: str = "default") -> None:
"""Add metadata to the current active trace entity."""
def add_exception(self, exception):
"""Add an exception to trace entities."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment