Skip to content
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

feat(Tracing): Allow to specify extra attributes on http calls #57

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

noveo-landa
Copy link

@noveo-landa noveo-landa commented Sep 9, 2024

Usage example

  1. To manage request span attributes:
    The main purpose is to hide request body/attributes from the attributes
$options = [
    'extra' => [
        'span_attributes' => ['request.headers'] // supported "request.headers" and "request.body", both are activated by default
    ]
]

$this->client->request('get', 'https://example.com/spmething', $options);
  1. to add extra attributes to the span:
    The main purpose is to add service specific attributes and help the otel-collector to map data
$options = [
    'extra' => [
        'extra_attributes' => ['endpoint' => 'services', 'adapter' => 'foo']
    ]
]

$this->client->request('get', 'https://example.com/spmething', $options);
  1. To specify trace name
    This name will be name of the trace on jaeger. If not specified it will be method and url. Ex: get api.demo.distribusion.com
$options = [
    'extra' => [
        'operation_name' => 'trains.distribusion.services'
    ]
]

$this->client->request('get', 'https://example.com/spmething', $options);

@cdaguerre
Copy link
Member

@noveo-landa hi dimitri, could you fix the tests?

@noveo-landa
Copy link
Author

@cdaguerre please check it again

@cdaguerre cdaguerre merged commit 68dc2b6 into worldia:master Sep 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants