Skip to content

Commit 6cdd454

Browse files
committed
Merge branch 'main' into rocm-support
2 parents 8584b6d + 7e55c61 commit 6cdd454

File tree

15 files changed

+73
-98
lines changed

15 files changed

+73
-98
lines changed

Cargo.lock

Lines changed: 10 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ Options:
252252
253253
[env: OTLP_ENDPOINT=]
254254
255+
--otlp-service-name <OTLP_SERVICE_NAME>
256+
The service name for opentelemetry.
257+
258+
[env: OTLP_SERVICE_NAME=]
259+
[default: text-embeddings-inference.server]
260+
255261
--cors-allow-origin <CORS_ALLOW_ORIGIN>
256262
[env: CORS_ALLOW_ORIGIN=]
257263
```

backends/candle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ insta = { git = "https://github.com/OlivierDehaene/insta", rev = "f4f98c0410b91f
3131
is_close = "0.1.3"
3232
hf-hub = "0.3.2"
3333
anyhow = "1.0.75"
34-
tokenizers = { version = "^0.15.0", default-features = false, features = ["onig", "esaxx_fast"] }
34+
tokenizers = { version = "^0.19.1", default-features = false, features = ["onig", "esaxx_fast"] }
3535
serial_test = "2.0.0"
3636

3737
[build-dependencies]

backends/python/server/text_embeddings_server/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def serve(
2323
logger_level: str = "INFO",
2424
json_output: bool = False,
2525
otlp_endpoint: Optional[str] = None,
26+
otlp_service_name: str = "text-embeddings-inference.server",
2627
pooling_mode: Optional[str] = None,
2728
):
2829
# Remove default handler
@@ -43,7 +44,7 @@ def serve(
4344

4445
# Setup OpenTelemetry distributed tracing
4546
if otlp_endpoint is not None:
46-
setup_tracing(otlp_endpoint=otlp_endpoint)
47+
setup_tracing(otlp_endpoint=otlp_endpoint, otlp_service_name=otlp_service_name)
4748

4849
# Downgrade enum into str for easier management later on
4950
dtype = None if dtype is None else dtype.value

backends/python/server/text_embeddings_server/utils/tracing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ def _start_span(self, handler_call_details, context, set_status_on_exception=Fal
5454
)
5555

5656

57-
def setup_tracing(otlp_endpoint: str):
58-
resource = Resource.create(
59-
attributes={"service.name": f"text-embeddings-inference.server"}
60-
)
57+
def setup_tracing(otlp_endpoint: str, otlp_service_name: str):
58+
resource = Resource.create(attributes={"service.name": otlp_service_name})
6159
span_exporter = OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True)
6260
span_processor = BatchSpanProcessor(span_exporter)
6361

backends/python/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ impl PythonBackend {
2222
model_type: ModelType,
2323
uds_path: String,
2424
otlp_endpoint: Option<String>,
25+
otlp_service_name: String,
2526
) -> Result<Self, BackendError> {
2627
match model_type {
2728
ModelType::Classifier => {
@@ -37,8 +38,13 @@ impl PythonBackend {
3738
}
3839
};
3940

40-
let backend_process =
41-
management::BackendProcess::new(model_path, dtype, &uds_path, otlp_endpoint)?;
41+
let backend_process = management::BackendProcess::new(
42+
model_path,
43+
dtype,
44+
&uds_path,
45+
otlp_endpoint,
46+
otlp_service_name,
47+
)?;
4248
let tokio_runtime = tokio::runtime::Builder::new_current_thread()
4349
.enable_all()
4450
.build()

backends/python/src/management.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl BackendProcess {
2121
dtype: String,
2222
uds_path: &str,
2323
otlp_endpoint: Option<String>,
24+
otlp_service_name: String,
2425
) -> Result<Self, BackendError> {
2526
// Get UDS path
2627
let uds = Path::new(uds_path);
@@ -33,21 +34,24 @@ impl BackendProcess {
3334
// Process args
3435
let mut python_server_args = vec![
3536
model_path,
36-
"--dtype".to_string(),
37+
"--dtype".to_owned(),
3738
dtype,
38-
"--uds-path".to_string(),
39-
uds_path.to_string(),
40-
"--logger-level".to_string(),
41-
"INFO".to_string(),
42-
"--json-output".to_string(),
39+
"--uds-path".to_owned(),
40+
uds_path.to_owned(),
41+
"--logger-level".to_owned(),
42+
"INFO".to_owned(),
43+
"--json-output".to_owned(),
4344
];
4445

4546
// OpenTelemetry
4647
if let Some(otlp_endpoint) = otlp_endpoint {
47-
python_server_args.push("--otlp-endpoint".to_string());
48+
python_server_args.push("--otlp-endpoint".to_owned());
4849
python_server_args.push(otlp_endpoint);
4950
}
5051

52+
python_server_args.push("--otlp-service-name".to_owned());
53+
python_server_args.push(otlp_service_name);
54+
5155
// Copy current process env
5256
let envs: Vec<(OsString, OsString)> = env::vars_os().collect();
5357

@@ -64,7 +68,7 @@ impl BackendProcess {
6468
Err(err) => {
6569
if err.kind() == io::ErrorKind::NotFound {
6670
return Err(BackendError::Start(
67-
"python-text-embeddings-server not found in PATH".to_string(),
71+
"python-text-embeddings-server not found in PATH".to_owned(),
6872
));
6973
}
7074
return Err(BackendError::Start(err.to_string()));

backends/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl Backend {
3838
model_type: ModelType,
3939
uds_path: String,
4040
otlp_endpoint: Option<String>,
41+
otlp_service_name: String,
4142
) -> Result<Self, BackendError> {
4243
let (backend_sender, backend_receiver) = mpsc::unbounded_channel();
4344

@@ -47,6 +48,7 @@ impl Backend {
4748
model_type.clone(),
4849
uds_path,
4950
otlp_endpoint,
51+
otlp_service_name,
5052
)?;
5153
let padded_model = backend.is_padded();
5254
let max_batch_size = backend.max_batch_size();
@@ -135,6 +137,7 @@ fn init_backend(
135137
model_type: ModelType,
136138
uds_path: String,
137139
otlp_endpoint: Option<String>,
140+
otlp_service_name: String,
138141
) -> Result<Box<dyn CoreBackend + Send>, BackendError> {
139142
if cfg!(feature = "candle") {
140143
#[cfg(feature = "candle")]
@@ -154,6 +157,7 @@ fn init_backend(
154157
model_type,
155158
uds_path,
156159
otlp_endpoint,
160+
otlp_service_name,
157161
)
158162
})
159163
.join()

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ hf-hub = { version = "^0.3.0", features = ["tokio"], default-features = false }
1010
metrics = "^0.21"
1111
text-embeddings-backend = { path = "../backends" }
1212
thiserror = "^1.0"
13-
tokenizers = { version = "^0.15.2", default-features = false, features = ["onig", "esaxx_fast"] }
13+
tokenizers = { version = "^0.19.1", default-features = false, features = ["onig", "esaxx_fast"] }
1414
tracing = "^0.1"
1515
tokio = { version = "^1.25", features = ["rt", "rt-multi-thread", "parking_lot", "sync"] }

docs/source/en/cli_arguments.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ Options:
153153
154154
[env: OTLP_ENDPOINT=]
155155
156+
--otlp-service-name <OTLP_SERVICE_NAME>
157+
The service name for opentelemetry.
158+
159+
[env: OTLP_SERVICE_NAME=]
160+
[default: text-embeddings-inference.server]
161+
156162
--cors-allow-origin <CORS_ALLOW_ORIGIN>
157163
[env: CORS_ALLOW_ORIGIN=]
158164
```

0 commit comments

Comments
 (0)