Skip to content

Commit

Permalink
update prototype to test out otlp, added insecure field
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten committed Feb 15, 2023
1 parent e45b943 commit 159b1b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions json_schema/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@
},
"default_histogram_aggregation": {
"type": "string"
},
"insecure": {
"type": "boolean"
}
},
"required": [
"endpoint",
"protocol"
"endpoint"
],
"title": "Otlp"
},
Expand Down
8 changes: 4 additions & 4 deletions prototypes/python/otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def _resource(self):

# _get_exporter returns an exporter class for the signal
def _get_exporter(self, signal: str, name: str):
# if name not in self._config.get("sdk").get(signal).get("exporters"):
# raise Exception(f"exporter {name} not specified for {signal} signal")
if name not in self._config.get("sdk").get(signal).get("exporters"):
raise Exception(f"exporter {name} not specified for {signal} signal")

exporter = _import_config_component(name, f"opentelemetry_{signal}_exporter")
if issubclass(exporter, SpanExporter):
return exporter
return exporter(**self._config.get("sdk").get(signal).get("exporters").get(name))
raise RuntimeError(f"{name} is not a {signal} exporter")

def set_tracer_provider(self):
Expand All @@ -57,7 +57,7 @@ def set_tracer_provider(self):
logging.debug("adding span processor %s", processor)
try:
# TODO: pass in exporter arguments
processor = BatchSpanProcessor(self._get_exporter("traces", processor.get("args").get("exporter"))())
processor = BatchSpanProcessor(self._get_exporter("traces", processor.get("args").get("exporter")))
provider.add_span_processor(processor)
except ModuleNotFoundError as exc:
logging.error("module not found", exc)
Expand Down
4 changes: 2 additions & 2 deletions prototypes/python/prototype.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def main():
tracer = get_tracer("config-prototype")

with tracer.start_as_current_span("operation-a"):
with tracer.start_as_current_span("operation-a"):
with tracer.start_as_current_span("operation-a"):
with tracer.start_as_current_span("operation-b"):
with tracer.start_as_current_span("operation-c"):
logging.debug("you should see traces after this line")

main()
1 change: 1 addition & 0 deletions prototypes/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ jsonschema
pyyaml
opentelemetry-api
opentelemetry-sdk
opentelemetry-exporter-otlp
opentelemetry-exporter-jaeger
opentelemetry-exporter-zipkin

0 comments on commit 159b1b5

Please sign in to comment.