Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@opentelemetry/sql-common
Advanced tools
@opentelemetry/sql-common is a package that provides common utilities and types for instrumenting SQL databases with OpenTelemetry. It helps in tracing and monitoring SQL queries by providing a standardized way to collect and report telemetry data.
Instrumentation of SQL Queries
This feature allows you to create spans around SQL query executions, which helps in tracing the performance and errors of SQL queries.
const { createSpan, context } = require('@opentelemetry/sql-common');
function executeQuery(query) {
const span = createSpan('executeQuery');
try {
// Execute the SQL query
const result = database.execute(query);
span.setStatus({ code: 0 }); // Success
return result;
} catch (error) {
span.setStatus({ code: 2, message: error.message }); // Error
throw error;
} finally {
span.end();
}
}
Context Propagation
This feature allows you to propagate context across asynchronous operations, ensuring that telemetry data is correctly associated with the originating request.
const { context, setSpan } = require('@opentelemetry/sql-common');
function executeQueryWithContext(query) {
const span = createSpan('executeQueryWithContext');
const ctx = setSpan(context.active(), span);
return context.with(ctx, () => {
try {
// Execute the SQL query
const result = database.execute(query);
span.setStatus({ code: 0 }); // Success
return result;
} catch (error) {
span.setStatus({ code: 2, message: error.message }); // Error
throw error;
} finally {
span.end();
}
});
}
@opentelemetry/instrumentation is a core package for OpenTelemetry that provides a framework for instrumenting various libraries and frameworks. It is more general-purpose compared to @opentelemetry/sql-common, which is specifically focused on SQL databases.
Winston is a popular logging library for Node.js. While it is not specifically designed for telemetry, it can be used to log SQL queries and errors, providing some level of monitoring. However, it lacks the built-in context propagation and span creation features of @opentelemetry/sql-common.
Datadog is a comprehensive monitoring and analytics platform that offers SQL query monitoring as part of its APM (Application Performance Monitoring) suite. It provides more out-of-the-box features compared to @opentelemetry/sql-common but is a paid service.
This is an internal utils package used for the different SQL instrumentations:
FAQs
Utilities for SQL instrumentations
We found that @opentelemetry/sql-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.