-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add init_otel() function #545
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,16 @@ | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from splunk_otel.configurator import SplunkConfigurator | ||
from splunk_otel.distro import SplunkDistro | ||
|
||
|
||
def init_otel(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Open to suggestions on this name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's more specific and probably better. Done. |
||
""" | ||
Initializes OpenTelemetry Python components (exporters, tracer providers, meter providers, resources etc.). | ||
Like auto instrumentation (`opentelemetry-instrument`) but without loading instrumentors. | ||
""" | ||
sd = SplunkDistro() | ||
sd.configure() | ||
sc = SplunkConfigurator() | ||
sc.configure() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import Mapping, Optional, Sequence | ||
|
||
from oteltest.telemetry import count_spans | ||
from ott_lib import project_path, trace_loop | ||
|
||
NUM_SPANS = 12 | ||
|
||
if __name__ == "__main__": | ||
from splunk_otel import init_otel | ||
|
||
init_otel() | ||
trace_loop(NUM_SPANS) | ||
|
||
|
||
class ConfigureOtelTest: | ||
def environment_variables(self) -> Mapping[str, str]: | ||
return {} | ||
|
||
def requirements(self) -> Sequence[str]: | ||
return [project_path(), "oteltest"] | ||
|
||
def wrapper_command(self) -> str: | ||
return "" | ||
|
||
def on_start(self) -> Optional[float]: | ||
pass | ||
|
||
def on_stop(self, tel, stdout: str, stderr: str, returncode: int) -> None: | ||
assert count_spans(tel) == NUM_SPANS | ||
|
||
def is_http(self) -> bool: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this missed in the rename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch! Will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed here: #547