> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# समय सीमा ब्लूप्रिंट

> कंप्यूट, सर्वरलेस फ़ंक्शंस, कंटेनरों और रनटाइम बिलिंग के लिए बीते समय के आधार पर संसाधन खपत को ट्रैक करें।

## उपयोग के मामले

समय सीमा ब्लूप्रिंट द्वारा समर्थित सामान्य परिदृश्यों का अन्वेषण करें:

<CardGroup cols={2}>
  <Card title="Serverless Functions" icon="function">
    फ़ंक्शन निष्पादन समय और मेमोरी उपयोग के आधार पर बिल करें।
  </Card>

  <Card title="Container Runtime" icon="container-storage">
    उपयोग-आधारित बिलिंग के लिए कंटेनर के चलने का समय ट्रैक करें।
  </Card>

  <Card title="Compute Instances" icon="server">
    वीएम रनटाइम की निगरानी करें और मिनट या घंटे के अनुसार शुल्क लें।
  </Card>

  <Card title="Background Jobs" icon="briefcase">
    डेटा एक्सपोर्ट, रिपोर्ट और बैच जॉब्स के लिए प्रोसेसिंग समय ट्रैक करें।
  </Card>
</CardGroup>

<Info>
  कम्प्यूट समय, फ़ंक्शन निष्पादन अवधि, कंटेनर रनटाइम या किसी भी समय-आधारित उपयोग के आधार पर बिलिंग के लिए उपयुक्त है।
</Info>

## त्वरित प्रारंभ

समय अवधि के द्वारा संसाधन उपयोग को ट्रैक करें:

<Steps>
  <Step title="Install the SDK">
    ```bash theme={null}
    npm install @dodopayments/ingestion-blueprints
    ```
  </Step>

  <Step title="Get Your API Keys">
    * **Dodo Payments API Key**: इसे [Dodo Payments Dashboard](https://app.dodopayments.com/developer/api-keys) से प्राप्त करें
  </Step>

  <Step title="Create a Meter">
    अपने [Dodo Payments Dashboard](https://app.dodopayments.com/) में एक मीटर बनाएँ:

    * **Event Name**: `time_range_usage` (or your preferred name)
    * **Aggregation Type**: `sum` कुल अवधि ट्रैक करने के लिए
    * **Over Property**: `durationSeconds`, `durationMinutes`, या `durationMs`
  </Step>

  <Step title="Track Time Usage">
    <CodeGroup>
      ```javascript Serverless Functions theme={null}
      import { Ingestion, trackTimeRange } from '@dodopayments/ingestion-blueprints';

      const ingestion = new Ingestion({
        apiKey: process.env.DODO_PAYMENTS_API_KEY,
        environment: 'test_mode',
        eventName: 'function_execution'
      });

      // Track function execution time
      const startTime = Date.now();

      // Execute your function (example: image processing)
      const result = await yourImageProcessingLogic();

      const durationMs = Date.now() - startTime;

      await trackTimeRange(ingestion, {
        customerId: 'customer_123',
        durationMs: durationMs
      });
      ```

      ```javascript Container Runtime theme={null}
      import { Ingestion, trackTimeRange } from '@dodopayments/ingestion-blueprints';

      const ingestion = new Ingestion({
        apiKey: process.env.DODO_PAYMENTS_API_KEY,
        environment: 'test_mode',
        eventName: 'container_runtime'
      });

      // Track container runtime in seconds
      await trackTimeRange(ingestion, {
        customerId: 'customer_456',
        durationSeconds: 120
      });
      ```

      ```javascript VM Instance Runtime theme={null}
      import { Ingestion, trackTimeRange } from '@dodopayments/ingestion-blueprints';

      const ingestion = new Ingestion({
        apiKey: process.env.DODO_PAYMENTS_API_KEY,
        environment: 'test_mode',
        eventName: 'vm_runtime'
      });

      // Track VM runtime in minutes
      await trackTimeRange(ingestion, {
        customerId: 'customer_789',
        durationMinutes: 60
      });
      ```
    </CodeGroup>
  </Step>
</Steps>

## कॉन्फ़िगरेशन

### इनजेशन कॉन्फ़िगरेशन

<ParamField path="apiKey" type="string" required>
  डैशबोर्ड से आपका Dodo Payments API key।
</ParamField>

<ParamField path="environment" type="string" required>
  एनवायरनमेंट मोड: `test_mode` या `live_mode`.
</ParamField>

<ParamField path="eventName" type="string" required>
  इवेंट नाम जो आपके मीटर कॉन्फ़िगरेशन से मेल खाता हो।
</ParamField>

### समय सीमा विकल्प ट्रैक करें

<ParamField path="customerId" type="string" required>
  बिलिंग एट्रिब्यूशन के लिए ग्राहक आईडी।
</ParamField>

<ParamField path="durationMs" type="number">
  मिलिसेकंड में अवधि। सब-सेकंड सटीकता के लिए उपयोग करें।
</ParamField>

<ParamField path="durationSeconds" type="number">
  सेकंड में अवधि। फ़ंक्शन निष्पादन और छोटे कार्यों के लिए सबसे सामान्य।
</ParamField>

<ParamField path="durationMinutes" type="number">
  मिनट में अवधि। वीएम जैसे लंबे समय तक चलने वाले संसाधनों के लिए उपयोगी।
</ParamField>

<ParamField path="metadata" type="object">
  संसाधन के बारे में वैकल्पिक मेटाडेटा जैसे CPU, मेमोरी, क्षेत्र आदि।
</ParamField>

## सर्वोत्तम प्रथाएँ

<Tip>
  **सही इकाई चुनें**: छोटे ऑपरेशन के लिए मिलिसेकंड, फ़ंक्शन के लिए सेकंड और लंबे समय तक चलने वाले संसाधनों के लिए मिनट का उपयोग करें।
</Tip>

<Warning>
  **सटीक समय निर्धारण**: सटीक समय ट्रैकिंग के लिए `Date.now()` या `performance.now()` का उपयोग करें, विशेष रूप से सर्वरलेस फ़ंक्शन के लिए।
</Warning>
