Skip to content

Use exit status to indicate failure of exec/span/etc. #91

@ismith

Description

@ismith

I'd like to use otel-cli as a simple "send an event, pass/fail" smoke test. ("Is my local/newly-deployed server up & responding")

I can run this with no server on localhost:4317 to demonstrate the fail case:

$ otel-cli exec --endpoint localhost:4317 --service test --name test echo

2021/10/19 19:22:19 context deadline exceeded

But the exit status is 0. For my described use case, it'd be ideal if the exit status was non-zero - "hey, my test script should fail here". I also recognize that there are many cases where a failure of telemetry code ought not to do that.

Options:

  1. Unhandled errors (like context deadline exceeded) should exit non-zero; it is the responsibility of the caller to catch and handle: otel-cli exec ... || true.

  2. Add a flag for my desired behavior; default to a zero exit status. Non-breaking change; users like me will run as otel-cli exec --errors-exit-non-zero .... (I don't love --errors-exit-non-zero, will have to think about a name. --exit-status-errors? --exit-status?)

Not sure how you all feel about existing use cases, breaking changes, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions