Skip to content

Commit

Permalink
Updating example
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jun 24, 2020
1 parent 4f1a70b commit 4fe97da
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,29 @@
import time

from opentelemetry import metrics, trace
from opentelemetry.ext.otcollector.metrics_exporter import (
CollectorMetricsExporter,
)
from opentelemetry.ext.otcollector.trace_exporter import CollectorSpanExporter
from opentelemetry.ext.otcollector.trace_exporter import OTLPSpanExporter
from opentelemetry.ext.otcollector.metrics_exporter import OTLPMetricsExporter
from opentelemetry.sdk.metrics import Counter, MeterProvider
from opentelemetry.sdk.metrics.export.controller import PushController
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor

# create a CollectorSpanExporter
span_exporter = CollectorSpanExporter(
# optional:
# endpoint="myCollectorUrl:55678",
# service_name="test_service",
# host_name="machine/container name",
span_exporter = OTLPSpanExporter(
# optional
# endpoint:="myCollectorURL:55678",
# credentials=ChannelCredentials(credentials),
# metadata=(("metadata", "metadata")),
)
tracer_provider = TracerProvider()
trace.set_tracer_provider(tracer_provider)
span_processor = BatchExportSpanProcessor(span_exporter)
tracer_provider.add_span_processor(span_processor)

# create a CollectorMetricsExporter
metric_exporter = CollectorMetricsExporter(
# optional:
# endpoint="myCollectorUrl:55678",
# service_name="test_service",
# host_name="machine/container name",
metric_exporter = OTLPMetricsExporter(
# optional
# endpoint:="myCollectorURL:55678",
# credentials=ChannelCredentials(credentials),
# metadata=(("metadata", "metadata")),
)

# Meter is responsible for creating and recording metrics
Expand Down

0 comments on commit 4fe97da

Please sign in to comment.