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

Metrics exemplars #1306

Closed
dyladan opened this issue Jul 13, 2020 · 6 comments
Closed

Metrics exemplars #1306

dyladan opened this issue Jul 13, 2020 · 6 comments
Labels
feature-request signal:metrics Issues and PRs related to general metrics signal

Comments

@dyladan
Copy link
Member

dyladan commented Jul 13, 2020

open-telemetry/oteps#113

Still waiting on spec, but this OTEP merged. Creating this tracking issue.

@dyladan dyladan added feature-request up-for-grabs Good for taking. Extra help will be provided by maintainers release:required-for-ga labels Jul 13, 2020
@jonahrosenblum
Copy link
Contributor

I would like to claim this issue please.

@mayurkale22 mayurkale22 removed the up-for-grabs Good for taking. Extra help will be provided by maintainers label Jul 27, 2020
@dyladan
Copy link
Member Author

dyladan commented Sep 2, 2020

Unassigned because internship ended. If I'm wrong about that, please let me know.

@pragmaticivan
Copy link
Contributor

Howdy! Is anyone making any progress on this one?

@vmarchaud
Copy link
Member

@pragmaticivan Our current metrics API/SDK is well behind the specification so this isn't something to work on the short term i believe

@legendecas legendecas added the signal:metrics Issues and PRs related to general metrics signal label Sep 1, 2022
@pichlermarc
Copy link
Member

This issue is quite outdated, and #2594 is tracking the same thing and has had more activity. 🤔
I think we can close this and continue over at #2594 🙂

@legendecas
Copy link
Member

Closing in favor of #2594.

@legendecas legendecas closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this issue Dec 15, 2023
* refactor(pg): more defensive, DRYer implementation

The prior code had three different utility functions for constructing
the span to use to trace the query: handleTextQuery, handleConfigQuery,
and handleParameterizedQuery. These functions contained a lot of
duplicated logic, and that duplication was gonna make it harder to
introduce new features (see next commit) and was already leading to
bugs/inconsistencies. For example, `handleConfigQuery` would verify that
the parameter `values` provided with the query were provided as an array
before attaching them to the span, whereas `handleParameterizedQuery`
would do so without this validation.

This commit instead normalizes the arguments to `client.query` first,
so that only function is needed to create the span. In the process of
normalizing the arguments, the new code also performs a bit more
validation on them, to make sure that the instrumentation will not throw
at runtime. For example, the prior code would've thrown on
`client.query(null)`, as it was checking `typeof args[0] === 'object'`
without excluding null. The prior code also assumed, if an object was
passed, that the `text` and `name` keys held a string; this is now
verified before attaching that data to the span.

Finally, the prior code had two different code paths for invoking the
original `client.query` method; one that went through
`handleInvalidQuery` and one directly in `_getClientQueryPatch`. The
former wrapped the call in a try-catch, while the latter did not. Now,
there's only one call to the original client.query, and it's always in
a try-catch, which ensures that other cases of invalid args passed to
client.query (which might lead it to throw synchronously) won't be an
issue.

* refactor(pg): dry up attribute generation

* fix(pg): spec-compliant span naming

BREAKING CHANGE. This improves the way that OTEL span names are
generated in two different ways.

First, if the query is a prepared statement with a `name`, the `name` is
put into the span name as-is. Before, the `name` was transformed first,
as though it were a full SQL query string (i.e., it was split on spaces
and only the first 'word' was used).

Second, when we do only have a full query string, and we take the first
word to form the span name, the code now calls `toUpperCase()` on that
string, so that a `select * from x` and a `SELECT * from x` query both
end up with a span name like `pg.query:SELECT`.

* test(pg): more error handling tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request signal:metrics Issues and PRs related to general metrics signal
Projects
None yet
Development

No branches or pull requests

7 participants