You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
fromopentelemetryimporttracefromopentelemetry.sdk.trace.exportimportSpanExporter, SpanExportResult, SimpleSpanProcessorfromopentelemetry.ext.honeycombimport_translate_to_hnyfromlibhoney.versionimportVERSIONfromlibhoney.internalimportjson_default_handlerimportjson# We use our own implementation, since the main one deletes classHoneycombConsoleSpanExporter(SpanExporter):
"""Honeycomb console span exporter for the Honeycomb AWS Lambda Instrumentation. """def__init__(
self,
service_name=None,
out=sys.stdout,
dataset=None,
user_agent_addition='',
sample_rate=1,
):
self.out=outself.service_name=service_nameself.sample_rate=sample_rateself.dataset=datasetself.user_agent="libhoney-py/"+VERSIONifuser_agent_addition:
self.user_agent+=" "+user_agent_additiondefexport(self, spans):
dataset=self.datasetuser_agent=self.user_agentout=self.outsample_rate=self.sample_ratefordin_translate_to_hny(spans):
start_time=d["start_time"]
deld["start_time"]
event_time=start_time.isoformat()
ifstart_time.tzinfoisNone:
event_time+="Z"# we add dataset and user_agent to the payload# if processed by another honeycomb agent (i.e. agentless integrations# for AWS), this data will get used to route the event to the right# location with appropriate metadatapayload= {
"time": event_time,
"samplerate": sample_rate,
"dataset": dataset,
"user_agent": user_agent,
"data": d,
}
out.write(json.dumps(payload, default=json_default_handler) +os.linesep)
out.flush()
returnSpanExportResult.SUCCESSimportosimportsysdataset=os.environ['HONEYCOMB_DATASET']
service_name=os.environ['HONEYCOMB_SERVICE_NAME']
exporter=HoneycombConsoleSpanExporter(
service_name=service_name,
out=sys.stdout,
dataset=dataset,
)
trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter))
As mentioned in issue #36, this project is being sunset and so unfortunately we do not have plans to make any further changes to this repo. We will continue to monitor discussion on that sunset issue in the meantime.
Is there a reason the
HoneycombConsoleSpanExporter
andFileTransmission
are implemented so differently?Compare:
opentelemetry-exporter-python/opentelemetry/ext/honeycomb/__init__.py
Lines 107 to 112 in 9ace0a0
with the corresponding implementation in libhoney-py:
https://github.com/honeycombio/libhoney-py/blob/6cc1e205184ab4a0117e00864fc982656f5cbacc/libhoney/transmission.py#L464-L482
The text was updated successfully, but these errors were encountered: