Files
speckle-sharp-connectors/Importers/Rhino/Speckle.Importers.Rhino/Internal/ServiceRegistration.cs
T
Jedd Morgan 7860c44f4e feat(api)!: Implement new packfile based sends via SendPipline (aka DuckDB changes) (#1277)
* Dim/quack lets go (#1275)

* Add model ingestion to sharp connectors

* correct ingestion message

* Progress

* grasshopper

* GH exception messages

* fix GH

* file names

* revit file name

* grasshopper file names

* etabs file names

* delete tests

* tekla maybe

* ingestion  scope

* bad boolean logic

* Longer TimeSpan

* wip upload pipe

* 10s

* passthrough ingestion id

* happy hack time: prevent ingestion completion

this is handled server-side in the processing logic.

* add packfile send endpoint detection and routing

Route to SendViaPackfile when the server supports the upload-signing
endpoint (POST probe, 404 = unsupported) and a continuous traversal
builder is registered.

* Adds Continuous Traversal Builder

Introduces a Continuous Traversal Builder to manage the conversion and processing of Revit elements within a Send Pipeline.

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>

* feat(api): DI Refactor for Duck DB + Gergo's API endpoint changes (#1282)

* Di

* undo accidental change

* Feat (duck): dui ingestion updates post upload (#1295)

* Pass optional ingestion id to DUI

* Make ingestion id null for the SendViaIngestion, see the note :)

* feat!: Duckdev progress reporitng (#1296)

* Di

* throwaway from laptop

* Progress reporting

* Use matching logger

* Revit and revert rhino unpacker progress

* more revertion

* make pr even cleaner

* and this one

* fix build issues with other connectors

* SDK nuget (#1299)

* Bump to 3.14.0-alpha.2

* Feat(duck): grasshopper (#1297)

* Duck x Grasshopper - who would win?

* Fix registration for new builder

* missing imports

* return version id grasshopper

* Align sync resource to sync

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>

* Bump SDK

* feat(importer): rhino file importer changes for packfile (#1301)

* rhino importer changes

* correct deps

* Bump SDK

* Fix build issues

* ditto

* Fix build issue

* Lower standards

* Fix build

* feat: duck for acad, civil, navis, tekla, etabs (#1300)

* duck: acad, civil, etabs, tekla, navis and bump channels to 10.0.0

* notes

* fix conflicts

* more conflicts

* Ready for testing

* fix(duck): Fix send caching (#1302)

* potential fix

* undo-rhino chnages

* fix xml comment

* amended comment

* revit

* Fix build

* Aligned converting message

* fix: reoccurring object references

* Bump sdk and resolve merge conflict issues

* Merge pull request #1317 from specklesystems/jrm/importer-tracing

feat(otel): Tracing and OTEL changes for Rhino importer

* Fix revit linked model progress (#1312)

* Revert otel packages

* bump SDK

* Trace unpacking groups

* Align trace context nullability with app

* Disable send caching in Navisworks

* comments

* Update FileimportPayload.cs

* fix using directive

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>

* Fix merge conflicts

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: Björn Steinhagen <88777268+bjoernsteinhagen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Witt <sebastian.witt@rwth-aachen.de>
2026-04-08 10:07:56 +01:00

121 lines
3.9 KiB
C#

using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Common;
using Speckle.Connectors.Common.Common;
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.Logging;
using Speckle.Connectors.Rhino.DependencyInjection;
using Speckle.Converters.Rhino;
using Speckle.Objects.Geometry;
using Speckle.Sdk;
using Speckle.Sdk.SQLite;
#if !DEBUG && !LOCAL
using Speckle.Sdk.Common;
#endif
namespace Speckle.Importers.Rhino.Internal;
internal static class ServiceRegistration
{
private const HostAppVersion HOST_APP_VERSION = HostAppVersion.v3;
public static IServiceCollection AddRhinoImporter(
this IServiceCollection serviceCollection,
Application applicationInfo
)
{
var assemblyVersion = Assembly.GetExecutingAssembly().GetVersion();
serviceCollection.AddSpeckleSdk(
applicationInfo,
HostApplications.GetVersion(HOST_APP_VERSION),
assemblyVersion,
typeof(Point).Assembly
);
serviceCollection.AddSingleton(applicationInfo);
serviceCollection.AddRhino(false);
serviceCollection.AddRhinoConverters();
serviceCollection.AddTransient<Sender>();
serviceCollection.AddTransient<ImporterInstance>();
serviceCollection.AddTransient<ImporterInstanceFactory>();
// override default thread context
serviceCollection.AddSingleton<IThreadContext>(new ImporterThreadContext());
// override sqlite cache, since we don't want to persist to disk any object data
serviceCollection.AddTransient<ISqLiteJsonCacheManagerFactory, DummySqliteJsonCacheManagerFactory>();
return serviceCollection;
}
// Important to respect disposal, because disposal ensures pending messages are flushed
public static IDisposable AddLoggingConfig(this IServiceCollection serviceCollection, Application applicationInfo)
{
return serviceCollection.AddOpenTelemetry(
"Speckle.Importers.Rhino",
applicationInfo,
HOST_APP_VERSION,
#if DEBUG || LOCAL
new SpeckleLogging(Console: true, File: new(), MinimumLevel: SpeckleLogLevel.Debug),
new SpeckleTracing(Console: false),
new SpeckleMetrics(Console: false)
#else
new SpeckleLogging(
Console: true,
File: new(),
Otel:
[
new(
Endpoint: new Uri("https://seq.speckle.systems/ingest/otlp/v1/logs"),
Headers: new()
{
// We're using a different token than connectors for seq because we want to beable to
// trust the client's timestamps (rather than use the server's timestamps) for better tracing
// This setting has more opportunity for abuse, so we're keeping it secret, unlike the connectors token.
{ "X-Seq-ApiKey", Environment.GetEnvironmentVariable("SEQ_API_KEY").NotNullOrWhiteSpace() }
}
),
new(
Endpoint: new Uri("https://collector.speckle.dev/v1/logs"),
Headers: new()
{
{
"authorization",
Environment.GetEnvironmentVariable("SPECKLE_COLLECTOR_API_TOKEN").NotNullOrWhiteSpace()
}
}
)
],
MinimumLevel: SpeckleLogLevel.Information
),
new SpeckleTracing(
Console: false,
Otel:
[
new(
Endpoint: new Uri("https://seq.speckle.systems/ingest/otlp/v1/traces"),
Headers: new()
{
{ "X-Seq-ApiKey", Environment.GetEnvironmentVariable("SEQ_API_KEY").NotNullOrWhiteSpace() }
}
),
new(
Endpoint: new Uri("https://collector.speckle.dev/v1/traces"),
Headers: new()
{
{
"authorization",
Environment.GetEnvironmentVariable("SPECKLE_COLLECTOR_API_TOKEN").NotNullOrWhiteSpace()
}
}
)
]
),
null
#endif
);
}
}